|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.uwyn.rife.continuations.ContinuationConfigRuntime<T>
public abstract class ContinuationConfigRuntime<T extends ContinuableObject>
Configures the runtime behavior of the continuations engine.
The active runtime configuration always has to be available through
getActiveConfigRuntime() when a ContinuableObject is
executed. Therefore, it's best to always call
setActiveConfigRuntime(com.uwyn.rife.continuations.ContinuationConfigRuntime) before the executing. The
BasicContinuableRunner does
this by default. If you create your own runner, you have to ensure that
this is respected.
By default the lifetime duration and purging of ContinuableObject
instances is set to a sensible default, so this only needs tuning in
specific case.
This class has to be extended though to provide information that suits your continuations usage and to indicate whether continuations should be cloned when they are resumed.
| Field Summary | |
|---|---|
static long |
DEFAULT_CONTINUATION_DURATION
The default duration is 20 minutes. |
static int |
DEFAULT_CONTINUATION_PURGE_FREQUENCY
The default frequency is every 20 times out of the scale, with the default scale of 1000 this means, 1/50th of the time. |
static int |
DEFAULT_CONTINUATION_PURGE_SCALE
The default purge scale is 1000. |
| Constructor Summary | |
|---|---|
ContinuationConfigRuntime()
|
|
| Method Summary | |
|---|---|
abstract boolean |
cloneContinuations(T executingContinuable)
Indicates whether a continuable should be cloned before resuming the execution. |
static ContinuationConfigRuntime |
getActiveConfigRuntime()
Retrieves the active runtime configuration for the executing thread. |
abstract T |
getAssociatedContinuableObject(Object executingInstance)
Retrieves the ContinuableObject that corresponds to the currently
executing object instance. |
long |
getContinuationDuration()
The duration, in milliseconds, by which a continuation stays valid. |
abstract ContinuationManager |
getContinuationManager(T executingContinuable)
Retrieves the manager that is responsible for the ContinuableObject that is currently executing. |
int |
getContinuationPurgeFrequency()
The frequency by which the continuations purging will run in the ContinuationManager. |
int |
getContinuationPurgeScale()
The scale that will be used to determine how often continuations purging will run in the ContinuationManager. |
static void |
setActiveConfigRuntime(ContinuationConfigRuntime config)
Sets the active runtime configuration for the executing thread. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final long DEFAULT_CONTINUATION_DURATION
public static final int DEFAULT_CONTINUATION_PURGE_FREQUENCY
public static final int DEFAULT_CONTINUATION_PURGE_SCALE
| Constructor Detail |
|---|
public ContinuationConfigRuntime()
| Method Detail |
|---|
public static void setActiveConfigRuntime(ContinuationConfigRuntime config)
config - the active runtime configuration for the executing thread
public static ContinuationConfigRuntime getActiveConfigRuntime()
throws MissingActiveContinuationConfigRuntimeException
MissingActiveContinuationConfigRuntimeException - when the active
runtime configuration isn't setpublic long getContinuationDuration()
When this period is exceeded, a continuation can not be retrieved anymore and it will be removed from the manager during the next purge.
public int getContinuationPurgeFrequency()
ContinuationManager.
This works together with the scale that is configured through
getContinuationPurgeScale(). The frequency divided by the scale
makes how often the purging will happen. For instance, a frequency of 20
and a scale of 1000 means that purging will happen 1/50th of the time.
getContinuationPurgeScale()public int getContinuationPurgeScale()
ContinuationManager.
See getContinuationPurgeScale() for more info.
getContinuationPurgeFrequency()public abstract T getAssociatedContinuableObject(Object executingInstance)
ContinuableObject that corresponds to the currently
executing object instance.
If you don't work with a seperate continuable support class
(see here)
and don't allow people to just implement a marker interface without having
to extend a base class, the associated continuable object is the same as
the executing instance.
However, if there is a separate continuable support class, you'll need to return the appropriate continuable object here.
executingInstance - the currently executing object instance
ContinuableObjectContinuationConfigInstrument.getContinuableSupportClassName()public abstract ContinuationManager getContinuationManager(T executingContinuable)
ContinuableObject that is currently executing.
executingContinuable - the currently executing continuable
public abstract boolean cloneContinuations(T executingContinuable)
executingContinuable - the currently executing continuable
true is the continuation should be cloned; or
false otherwise
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||