Class ContinuationContext
- All Implemented Interfaces:
Cloneable
It also provides some static retrieval methods to be able to access active continuations.
Active continuations are managed in a ContinuationManager
so that
they can be easily retrieved.
- Since:
- 1.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addRelatedId
(String id) [PRIVATE AND UNSUPPORTED] Associates the ID of another continuation to this continuation.static void
Clears the active currently continuation context for the executing thread.void
[PRIVATE AND UNSUPPORTED] Set the number of the bytecode label where the continuation has to resume execution from.clone()
[PRIVATE AND UNSUPPORTED] Creates a cloned instance of this continuation context, this clone is not a perfect copy but is intended to be a child continuation and all context data is set up for that.static ContinuationContext
createOrResetContext
(Object executingInstance) [PRIVATE AND UNSUPPORTED] Creates a new continuation context or resets its expiration time.void
Makes sure that thisContinuationContext
is not the active one.Retrieves the call state that is active during this continuation.static ContinuationContext
Retrieves the currently active continuation for the executing thread.static String
Retrieves the identifier of the currently active continuation for the current thread.Retrieves the answer that the call continuation stored in this context.Returns the object instance in which this continuation was executing.Retrieves this continuation's call continuation creation state.getId()
Retrieves the continuation ID.int
getLabel()
[PRIVATE AND UNSUPPORTED] Retrieves the number of the bytecode label where the continuation has to resume execution from.static ContinuationContext
Retrieves the last active continuation for the executing thread.[PRIVATE AND UNSUPPORTED] Retrieves the local operand stack of this continuation.[PRIVATE AND UNSUPPORTED] Retrieves the local variable stack of this continuation.Retrieves the manager of thisContinuationContext
.Retrieves the parentContinuationContext
of thisContinuationContext
instance.Retrieves the unique identifier of the parent continuation of thisContinuationContext
instance.Retrieves the ID of this continuation's parent.boolean
isPaused()
Indicates whether this continuation is actually paused and can be resumed.void
Registers this continuation in its manager, so that it can be retrieved later.void
remove()
Removes thisContinuationContext
instance from itsContinuationManager
.void
Removes the entire continuation tree that thisContinuationContext
instance belongs to from itsContinuationManager
.void
setActiveCallState
(CallState callState) Sets the active call state for this continuation.static void
setActiveContext
(ContinuationContext context) Replaces the active continuation context for the executing thread.void
setCallAnswer
(Object answer) Set the answer to a call continuation.void
setCreatedCallState
(CallState createdCallState) Sets the call continuation's state when a new call continuation is created.void
setLabel
(int label) [PRIVATE AND UNSUPPORTED] Set the number of the bytecode label where the continuation has to resume execution from.void
setParentId
(String id) [PRIVATE AND UNSUPPORTED] Set the ID of this continuation's parent.void
setPaused
(boolean paused) [PRIVATE AND UNSUPPORTED] Sets whether the continuation if paused.
-
Method Details
-
createOrResetContext
[PRIVATE AND UNSUPPORTED] Creates a new continuation context or resets its expiration time.This method is used by the instrumented bytecode that provides continuations support, it's not intended for general use.
- Returns:
- a new
ContinuationContext
, or the active one with its expiration time being reset - Since:
- 1.0
-
clearActiveContext
public static void clearActiveContext()Clears the active currently continuation context for the executing thread.- Since:
- 1.0
-
getActiveContextId
Retrieves the identifier of the currently active continuation for the current thread.- Returns:
- the identifier of the currently active continuation as a unique
string; or
null
if no continuation is currently active - Since:
- 1.0
- See Also:
-
getActiveContext
Retrieves the currently active continuation for the executing thread.- Returns:
- the currently active continuation; or
null
if no continuation is currently active - Since:
- 1.0
- See Also:
-
setActiveContext
Replaces the active continuation context for the executing thread.- Parameters:
context
- the newContinuationContext
that will be active; ornull
if no continuation context should be active- Since:
- 1.0
- See Also:
-
getLastContext
Retrieves the last active continuation for the executing thread.- Returns:
- the last active continuation; or
null
if no continuation was active - Since:
- 1.0
-
getManager
Retrieves the manager of thisContinuationContext
.- Returns:
- this continuation's manager instance
- Since:
- 1.0
-
registerContext
public void registerContext()Registers this continuation in its manager, so that it can be retrieved later.- Since:
- 1.0
-
deactivate
public void deactivate()Makes sure that thisContinuationContext
is not the active one.- Since:
- 1.0
-
remove
public void remove()Removes thisContinuationContext
instance from itsContinuationManager
.- Since:
- 1.0
-
removeContextTree
public void removeContextTree()Removes the entire continuation tree that thisContinuationContext
instance belongs to from itsContinuationManager
.- Since:
- 1.0
-
getParentContextId
Retrieves the unique identifier of the parent continuation of thisContinuationContext
instance.- Returns:
- the parent's identifier as a unique string; or
null
if thisContinuationContext
has no parent - Since:
- 1.0
- See Also:
-
getParentContext
Retrieves the parentContinuationContext
of thisContinuationContext
instance.- Returns:
- the parent
ContinuationContext
; ornull
if thisContinuationContext
has no parent - Since:
- 1.0
- See Also:
-
getCallAnswer
Retrieves the answer that the call continuation stored in this context.- Returns:
- the call continuation's answer; or
null
if no answer was provided or the corresponding continuation wasn't a call continuation - Since:
- 1.0
-
setPaused
public void setPaused(boolean paused) [PRIVATE AND UNSUPPORTED] Sets whether the continuation if paused.This method is used by the internals that provide continuations support, it's not intended for general use.
- Parameters:
paused
-true
if the continuation is paused; orfalse
otherwise- Since:
- 1.0
- See Also:
-
isPaused
public boolean isPaused()Indicates whether this continuation is actually paused and can be resumed.- Returns:
true
if the continuation is paused; orfalse
otherwise- Since:
- 1.0
-
setLabel
public void setLabel(int label) [PRIVATE AND UNSUPPORTED] Set the number of the bytecode label where the continuation has to resume execution from.This method is used by the instrumented bytecode that provides continuations support, it's not intended for general use.
- Parameters:
label
- the number of the resumed bytecode label- Since:
- 1.0
-
clearLabel
public void clearLabel()[PRIVATE AND UNSUPPORTED] Set the number of the bytecode label where the continuation has to resume execution from.This method is used by the instrumented bytecode that provides continuations support, it's not intended for general use.
- Since:
- 1.0
-
getLabel
public int getLabel()[PRIVATE AND UNSUPPORTED] Retrieves the number of the bytecode label where the continuation has to resume execution from.This method is used by the instrumented bytecode that provides continuations support, it's not intended for general use.
- Returns:
- the number of the resumed bytecode label; or
-1
if no label number has been set - Since:
- 1.0
-
getLocalVars
[PRIVATE AND UNSUPPORTED] Retrieves the local variable stack of this continuation.This method is used by the instrumented bytecode that provides continuations support, it's not intended for general use.
- Returns:
- this continuation's local variable stack
- Since:
- 1.0
-
getLocalStack
[PRIVATE AND UNSUPPORTED] Retrieves the local operand stack of this continuation.This method is used by the instrumented bytecode that provides continuations support, it's not intended for general use.
- Returns:
- this continuation's local operand stack
- Since:
- 1.0
-
getId
Retrieves the continuation ID.Note that this ID is not necessarily present in the manager and that trying to retrieve a continuation afterward from its ID is never guaranteed to give a result.
- Returns:
- the unique ID of this continuation.
- Since:
- 1.0
-
setParentId
[PRIVATE AND UNSUPPORTED] Set the ID of this continuation's parent.This method is used by the instrumented bytecode that provides continuations support, it's not intended for general use.
- Parameters:
id
- the ID of this continuation's parent- Since:
- 1.0
- See Also:
-
getParentId
Retrieves the ID of this continuation's parent.- Returns:
- the ID of this continuation's parent continuation; or
null
if this continuation has no parent. - Since:
- 1.0
-
addRelatedId
[PRIVATE AND UNSUPPORTED] Associates the ID of another continuation to this continuation.This method is used by the instrumented bytecode that provides continuations support, it's not intended for general use.
- Parameters:
id
- the ID of another continuation that's related to this continuation- Since:
- 1.0
-
getContinuable
Returns the object instance in which this continuation was executing.- Returns:
- this continuation's active object
- Since:
- 1.0
-
setCreatedCallState
Sets the call continuation's state when a new call continuation is created.This state initiates a call continuation and should be set when a new call happens, after that it should never be changed.
- Parameters:
createdCallState
- this call continuation's creation state- Since:
- 1.0
- See Also:
-
getCreatedCallState
Retrieves this continuation's call continuation creation state.If this returns a non-null value, you can detect from it that this was a call continuation.
- Returns:
- this continuation
- Since:
- 1.0
- See Also:
-
setActiveCallState
Sets the active call state for this continuation.This mainly passes on the call state that was created during a call continuation. It allows quick retrieval of the active call state when an answer occurs.
- Parameters:
callState
- the active call state- Since:
- 1.0
- See Also:
-
getActiveCallState
Retrieves the call state that is active during this continuation.- Returns:
- the active
CallState
; ornull
if no call state was active for this continuation
-
setCallAnswer
Set the answer to a call continuation.- Parameters:
answer
- the object that will be the call continuation's answer; ornull
if there was no answer- Since:
- 1.0
-
clone
[PRIVATE AND UNSUPPORTED] Creates a cloned instance of this continuation context, this clone is not a perfect copy but is intended to be a child continuation and all context data is set up for that.This method is used by the instrumented bytecode that provides continuations support, it's not intended for general use.
- Overrides:
clone
in classObject
- Returns:
- a clone of this continuation for use as a child continuation
- Throws:
CloneNotSupportedException
- Since:
- 1.0
-