|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmessif.executor.SingleMethodExecutor
messif.executor.MethodThread
public final class MethodThread
This class allows the background method execution (i.e. in a new thread) using the MethodExecutor interface. Use backgroundExecute method in MethodExecutor to start the execution. Use waitExecutionEnd method to block until the thread finished the execution of the invocated method.
Field Summary |
---|
Fields inherited from class messif.executor.SingleMethodExecutor |
---|
arguments, method, object, returnedValue |
Constructor Summary | |
---|---|
protected |
MethodThread(java.lang.reflect.Method method,
java.lang.Object object,
java.lang.Object[] arguments)
Create new instance of MethodThread The constructor can't be called directly, use backgroundExecute "factory" member of MethodExecutor |
protected |
MethodThread(java.lang.reflect.Method method,
java.lang.Object object,
java.lang.Object[] arguments,
Executable executeBefore,
Executable executeAfter)
Create new instance of MethodThread The constructor can't be called directly, use backgroundExecute "factory" member of MethodExecutor |
protected |
MethodThread(java.lang.reflect.Method method,
java.lang.Object object,
java.lang.Object[] arguments,
java.util.List<Executable> executeBefore,
java.util.List<Executable> executeAfter)
Create new instance of MethodThread The constructor can't be called directly, use backgroundExecute "factory" member of MethodExecutor |
Method Summary | |
---|---|
java.lang.Exception |
getException()
Returns the exception thrown while executing or null if the execution finished with no exception. |
boolean |
isRunning()
Returns true if the method is still being executed, otherwise false is returned. |
boolean |
isSuccess()
This method waits for the end of execution. |
void |
run()
Execute the method inside the thread |
void |
waitExecutionEnd()
Wait for the end of the operation execution in specified thread (returned by backgroundExecute) This method will block until the background operation finishes its processing. |
Methods inherited from class messif.executor.SingleMethodExecutor |
---|
execute, getArgument, getArgument, getArgumentCount, getArguments, getDeclaredMethod, getReturnedValue, chooseExecutionObject |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected MethodThread(java.lang.reflect.Method method, java.lang.Object object, java.lang.Object[] arguments)
method
- method to call on the specified objectobject
- the executor object, that is used for invocation of methodsarguments
- the arguments of the executed methodprotected MethodThread(java.lang.reflect.Method method, java.lang.Object object, java.lang.Object[] arguments, java.util.List<Executable> executeBefore, java.util.List<Executable> executeAfter)
method
- method to call on the specified objectobject
- the executor object, that is used for invocation of methodsarguments
- the arguments of the executed methodexecuteBefore
- list of methods to call before the execution of the method (can be null if no pre/post execution is required)executeAfter
- list of methods to call after the successful execution of the method (can be null if no pre/post execution is required)protected MethodThread(java.lang.reflect.Method method, java.lang.Object object, java.lang.Object[] arguments, Executable executeBefore, Executable executeAfter)
method
- method to call on the specified objectobject
- the executor object, that is used for invocation of methodsarguments
- the arguments of the executed methodexecuteBefore
- a method to call before the execution of the method (can be null if no pre/post execution is required)executeAfter
- a method to call after the successful execution of the method (can be null if no pre/post execution is required)Method Detail |
---|
public boolean isRunning()
public boolean isSuccess() throws java.lang.InterruptedException
java.lang.InterruptedException
- if the waiting was interruptedpublic java.lang.Exception getException()
public void waitExecutionEnd() throws java.lang.InterruptedException
java.lang.InterruptedException
- if the waiting was interruptedpublic void run()
run
in interface java.lang.Runnable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |