Package com.offbynull.coroutines.user
Class Continuation
- java.lang.Object
-
- com.offbynull.coroutines.user.Continuation
-
- All Implemented Interfaces:
java.io.Serializable
public final class Continuation extends java.lang.Object implements java.io.Serializable
This class is used to store and restore the execution state. Any method that takes in this type as a parameter will be instrumented to have its state saved/restored.Calls to
suspend()
will suspend/yield the execution of the coroutine. Calls tosetContext(java.lang.Object)
/getContext()
can be used to pass data back and forth between the coroutine and its caller. All other methods are for internal use by the instrumentation logic and should not be used directly..- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Object
context
private MethodState
firstCutpointPointer
private MethodState
firstPointer
private int
mode
static int
MODE_LOADING
Do not use -- for internal use only.static int
MODE_NORMAL
Do not use -- for internal use only.static int
MODE_SAVING
Do not use -- for internal use only.private MethodState
nextLoadPointer
private MethodState
nextUnloadPointer
private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description Continuation()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
failedExecutionCycle()
Do not use -- for internal use only.java.lang.Object
getContext()
Get the context.int
getMode()
Do not use -- for internal use only.MethodState
getSaved(int idx)
Do not use -- for internal use only.int
getSize()
Do not use -- for internal use only.MethodState
loadNextMethodState()
Do not use -- for internal use only.void
pushNewMethodState(MethodState methodState)
Do not use -- for internal use only.void
reset()
Do not use -- for internal use only.void
setContext(java.lang.Object context)
Set the context.void
setMode(int mode)
Do not use -- for internal use only.void
successExecutionCycle()
Do not use -- for internal use only.void
suspend()
Call to suspend/yield execution.void
unloadCurrentMethodState()
Do not use -- for internal use only.void
unloadMethodStateToBefore(MethodState methodState)
Do not use -- for internal use only.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
MODE_NORMAL
public static final int MODE_NORMAL
Do not use -- for internal use only.- See Also:
- Constant Field Values
-
MODE_SAVING
public static final int MODE_SAVING
Do not use -- for internal use only.- See Also:
- Constant Field Values
-
MODE_LOADING
public static final int MODE_LOADING
Do not use -- for internal use only.- See Also:
- Constant Field Values
-
firstPointer
private MethodState firstPointer
-
nextLoadPointer
private MethodState nextLoadPointer
-
nextUnloadPointer
private MethodState nextUnloadPointer
-
firstCutpointPointer
private MethodState firstCutpointPointer
-
mode
private int mode
-
context
private java.lang.Object context
-
-
Method Detail
-
getMode
public int getMode()
Do not use -- for internal use only.- Returns:
- n/a
-
setMode
public void setMode(int mode)
Do not use -- for internal use only.- Parameters:
mode
- n/a
-
loadNextMethodState
public MethodState loadNextMethodState()
Do not use -- for internal use only.- Returns:
- n/a
-
unloadCurrentMethodState
public void unloadCurrentMethodState()
Do not use -- for internal use only.
-
unloadMethodStateToBefore
public void unloadMethodStateToBefore(MethodState methodState)
Do not use -- for internal use only.- Parameters:
methodState
- n/a
-
pushNewMethodState
public void pushNewMethodState(MethodState methodState)
Do not use -- for internal use only.- Parameters:
methodState
- n/a
-
reset
public void reset()
Do not use -- for internal use only.
-
successExecutionCycle
public void successExecutionCycle()
Do not use -- for internal use only.
-
failedExecutionCycle
public void failedExecutionCycle()
Do not use -- for internal use only.
-
suspend
public void suspend()
Call to suspend/yield execution.- Throws:
java.lang.UnsupportedOperationException
- if the caller has not been instrumented
-
getContext
public java.lang.Object getContext()
Get the context.- Returns:
- context
-
setContext
public void setContext(java.lang.Object context)
Set the context.- Parameters:
context
- context
-
getSaved
public MethodState getSaved(int idx)
Do not use -- for internal use only. For testing.- Parameters:
idx
- n/a- Returns:
- n/a
-
getSize
public int getSize()
Do not use -- for internal use only. For testing.- Returns:
- n/a
-
-