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 TypeMethodDescriptionvoidaddRelatedId(String id) [PRIVATE AND UNSUPPORTED] Associates the ID of another continuation to this continuation.static voidClears 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 ContinuationContextcreateOrResetContext(Object executingInstance) [PRIVATE AND UNSUPPORTED] Creates a new continuation context or resets its expiration time.voidMakes sure that thisContinuationContextis not the active one.Retrieves the call state that is active during this continuation.static ContinuationContextRetrieves the currently active continuation for the executing thread.static StringRetrieves 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.intgetLabel()[PRIVATE AND UNSUPPORTED] Retrieves the number of the bytecode label where the continuation has to resume execution from.static ContinuationContextRetrieves 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 parentContinuationContextof thisContinuationContextinstance.Retrieves the unique identifier of the parent continuation of thisContinuationContextinstance.Retrieves the ID of this continuation's parent.booleanisPaused()Indicates whether this continuation is actually paused and can be resumed.voidRegisters this continuation in its manager, so that it can be retrieved later.voidremove()Removes thisContinuationContextinstance from itsContinuationManager.voidRemoves the entire continuation tree that thisContinuationContextinstance belongs to from itsContinuationManager.voidsetActiveCallState(CallState callState) Sets the active call state for this continuation.static voidsetActiveContext(ContinuationContext context) Replaces the active continuation context for the executing thread.voidsetCallAnswer(Object answer) Set the answer to a call continuation.voidsetCreatedCallState(CallState createdCallState) Sets the call continuation's state when a new call continuation is created.voidsetLabel(int label) [PRIVATE AND UNSUPPORTED] Set the number of the bytecode label where the continuation has to resume execution from.voidsetParentId(String id) [PRIVATE AND UNSUPPORTED] Set the ID of this continuation's parent.voidsetPaused(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
nullif 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
nullif no continuation is currently active - Since:
- 1.0
- See Also:
-
setActiveContext
Replaces the active continuation context for the executing thread.- Parameters:
context- the newContinuationContextthat will be active; ornullif 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
nullif 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 thisContinuationContextis not the active one.- Since:
- 1.0
-
remove
public void remove()Removes thisContinuationContextinstance from itsContinuationManager.- Since:
- 1.0
-
removeContextTree
public void removeContextTree()Removes the entire continuation tree that thisContinuationContextinstance belongs to from itsContinuationManager.- Since:
- 1.0
-
getParentContextId
Retrieves the unique identifier of the parent continuation of thisContinuationContextinstance.- Returns:
- the parent's identifier as a unique string; or
nullif thisContinuationContexthas no parent - Since:
- 1.0
- See Also:
-
getParentContext
Retrieves the parentContinuationContextof thisContinuationContextinstance.- Returns:
- the parent
ContinuationContext; ornullif thisContinuationContexthas 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
nullif 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-trueif the continuation is paused; orfalseotherwise- Since:
- 1.0
- See Also:
-
isPaused
public boolean isPaused()Indicates whether this continuation is actually paused and can be resumed.- Returns:
trueif the continuation is paused; orfalseotherwise- 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
-1if 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
nullif 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; ornullif 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; ornullif 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:
clonein classObject- Returns:
- a clone of this continuation for use as a child continuation
- Throws:
CloneNotSupportedException- Since:
- 1.0
-