|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.uwyn.rife.continuations.basic.BasicContinuableRunner
public class BasicContinuableRunner
Basic implementation of a 'continuable runner' that will execute the continuable objects and correctly handle the continuations-related exceptions that are triggered.
This runner is probably only applicable to the most simple of use-cases, but by reading its source it should be relatively easy to adapt of extend it for purposes that don't fall inside its scope.
| Constructor Summary | |
|---|---|
BasicContinuableRunner(ContinuationConfigInstrument configInstrument)
Create a new runner instance. |
|
BasicContinuableRunner(ContinuationConfigInstrument configInstrument,
ClassLoader classloader)
Create a new runner instance with a custom classloader. |
|
| Method Summary | |
|---|---|
String |
answer(String continuationId,
Object callAnswer)
Resumes the execution of a call continuation. |
void |
beforeExecuteEntryMethodHook(ContinuableObject object)
Hook method that will be executed right before executing the entry method of a continuable object, when the default implementation of executeContinuable(com.uwyn.rife.continuations.ContinuableObject) is used. |
BasicContinuableRunner |
callTargetRetriever(CallTargetRetriever callTargetRetriever)
Sets the call target retriever that will be used when a call continuation is triggered. |
BasicContinuableRunner |
cloneContinuations(boolean cloneContinuations)
Configures the runner to clone continuations or not. |
void |
executeContinuable(ContinuableObject object)
Executes the continuable object by looking up the entrance method and invoking it. |
CallTargetRetriever |
getCallTargetRetriever()
Retrieves the call target retriever that will be used when a call continuation is triggered. |
ClassLoader |
getClassLoader()
Retrieves the classloader that is used by this runner. |
boolean |
getCloneContinuations()
Indicates whether continuations should be cloned when they are resumed. |
ContinuationConfigInstrument |
getConfigInstrumentation()
Retrieves the instrumentation configuration that is used by this runner. |
ContinuableObject |
getCurrentContinuable()
Retrieves the continuable that is active for the executing thread. |
ContinuationManager |
getManager()
Retrieves the manager that is used by the continuation runner. |
String |
resume(String continuationId)
Resumes the execution of a paused continuation. |
String |
run(String continuationId)
Executes a continuation whether it's paused or not. |
void |
setCallTargetRetriever(CallTargetRetriever callTargetRetriever)
Sets the call target retriever that will be used when a call continuation is triggered. |
void |
setCloneContinuations(boolean cloneContinuations)
Configures the runner to clone continuations or not. |
String |
start(String className)
Starts the execution of a new instance of the provided class. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BasicContinuableRunner(ContinuationConfigInstrument configInstrument)
configInstrument - the instance of the instrumentation
configuration that will be used for the transformation
public BasicContinuableRunner(ContinuationConfigInstrument configInstrument,
ClassLoader classloader)
configInstrument - the instance of the instrumentation
configuration that will be used for the transformationclassloader - the classloader that will be used to load the
continuable classes, this is for example an instance of
BasicContinuableClassLoader| Method Detail |
|---|
public String start(String className)
throws Throwable
className - the name of the class that will be executed
null if no continuation was paused
Throwable - when an error occurs
public String resume(String continuationId)
throws Throwable
continuationId - the ID of the continuation that will be resumed
null if no continuation was paused or if the provided ID
couldn't be found
Throwable - when an error occurs
public String answer(String continuationId,
Object callAnswer)
throws Throwable
continuationId - the ID of the continuation that will be resumedcallAnswer - the call answer object
null if no continuation was paused or if the provided ID
couldn't be found
Throwable - when an error occurs
public String run(String continuationId)
throws Throwable
continuationId - the ID of the existing continuation context that
will be executed
null if no continuation was paused or if the provided ID
couldn't be found
Throwable - when an error occurs
public void executeContinuable(ContinuableObject object)
throws Throwable
This method can be overridden in case the default behavior isn't approriate.
object - the continuatioble that will be executed
Throwable - when an unexpected error occurspublic void beforeExecuteEntryMethodHook(ContinuableObject object)
executeContinuable(com.uwyn.rife.continuations.ContinuableObject) is used.
This can for example be used to inject a continuable support object
in case the main continuable class only implements the marker interface
without having any of the support methods (see ContinuationConfigInstrument.getContinuableSupportClassName()).
object - the continuable object that will be executedexecuteContinuable(com.uwyn.rife.continuations.ContinuableObject)public ContinuationConfigInstrument getConfigInstrumentation()
public ClassLoader getClassLoader()
public BasicContinuableRunner cloneContinuations(boolean cloneContinuations)
cloneContinuations - true if continuations should be
cloned when they are resumed; or
false if they should not be cloned
setCloneContinuations(boolean),
getCloneContinuations()public void setCloneContinuations(boolean cloneContinuations)
cloneContinuations - true if continuations should be
cloned when they are resumed; or
false if they should not be cloned
cloneContinuations(boolean),
getCloneContinuations()public boolean getCloneContinuations()
true if continuations should be cloned when they are
resumed; or
false if they should not be cloned
cloneContinuations(boolean),
setCloneContinuations(boolean)public BasicContinuableRunner callTargetRetriever(CallTargetRetriever callTargetRetriever)
callTargetRetriever - the call target retriever that will be used
setCallTargetRetriever(com.uwyn.rife.continuations.basic.CallTargetRetriever),
getCallTargetRetriever()public void setCallTargetRetriever(CallTargetRetriever callTargetRetriever)
callTargetRetriever - the call target retriever that will be usedcallTargetRetriever(com.uwyn.rife.continuations.basic.CallTargetRetriever),
getCallTargetRetriever()public CallTargetRetriever getCallTargetRetriever()
callTargetRetriever(com.uwyn.rife.continuations.basic.CallTargetRetriever),
setCallTargetRetriever(com.uwyn.rife.continuations.basic.CallTargetRetriever)public ContinuableObject getCurrentContinuable()
null if there's no current continuable
public ContinuationManager getManager()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||