|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmessif.executor.MethodThreadList
public class MethodThreadList
This is a wrapper for the MethodExecutor object, which automatically remembers all the method threads that were executed on background. The list of the threads is kept per ThreadLocal variable, thus accessible only by one thread - the one that has started the background execute operation.
A wait function is available - it is a blocking method, which waits for the end of execution for all stored threads.
Parameters from all the stored methods can be retrieved by get operations.
Field Summary | |
---|---|
protected MethodExecutor |
methodExecutor
MethodExecutor object that is bound to this |
protected java.util.List<MethodThread> |
methodFinishedList
List of MethodThreads executed on background and now finished |
protected java.util.List<MethodThread> |
methodStartedList
List of MethodThreads currently executed on background |
Constructor Summary | |
---|---|
MethodThreadList(MethodExecutor methodExecutor)
Create a new instance of MethodThreadList. |
Method Summary | ||
---|---|---|
MethodThread |
backgroundExecute(java.lang.Object... arguments)
Execute registered method by arguments on background. |
|
MethodThread |
backgroundExecute(java.lang.Object[] arguments,
Executable executeBefore,
Executable executeAfter)
Execute registered method by arguments on background. |
|
MethodThread |
backgroundExecute(java.lang.Object[] arguments,
java.util.List<Executable> executeBefore,
java.util.List<Executable> executeAfter)
Execute registered method by arguments on background. |
|
void |
clearThreadLists()
Clears both the lists - started and finished threads. |
|
void |
execute(java.lang.Object... arguments)
Execute registered method by arguments |
|
|
getAllMethodsArgument(java.lang.Class<E> argClass)
Returns list of selected arguments from each finished method. |
|
java.util.List<java.lang.Object> |
getAllMethodsArgument(int position)
Get executed argument on the given position from all finished methods |
|
java.util.List<java.lang.Object> |
getAllMethodsReturnValue()
Returns a list of values returned from each finished method. |
|
|
getAllMethodsReturnValue(java.lang.Class<E> valuesClass)
Returns a list of values returned from each finished method. |
|
int |
waitBackgroundExecuteOperation()
Wait for all operations executed on background to finish |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final MethodExecutor methodExecutor
protected final java.util.List<MethodThread> methodStartedList
protected final java.util.List<MethodThread> methodFinishedList
Constructor Detail |
---|
public MethodThreadList(MethodExecutor methodExecutor)
methodExecutor
- Method Detail |
---|
public void execute(java.lang.Object... arguments) throws java.lang.NoSuchMethodException, java.lang.reflect.InvocationTargetException
arguments
- The array of arguments for the execution method (must be consistent with the prototype in constructor)
java.lang.NoSuchMethodException
- if the specified arguments are invalid or a method for them was not found
java.lang.reflect.InvocationTargetException
- if there was an exception during the method executionpublic MethodThread backgroundExecute(java.lang.Object[] arguments, Executable executeBefore, Executable executeAfter) throws java.lang.NoSuchMethodException
arguments
- The array of arguments for the execution method (must be consistent with the prototype in constructor)executeBefore
- method to call before registered methodexecuteAfter
- method to call after registered method
java.lang.NoSuchMethodException
- if there was no valid method for the specified argumentspublic MethodThread backgroundExecute(java.lang.Object[] arguments, java.util.List<Executable> executeBefore, java.util.List<Executable> executeAfter) throws java.lang.NoSuchMethodException
arguments
- The array of arguments for the execution method (must be consistent with the prototype in constructor)executeBefore
- list of methods to call before registered methodexecuteAfter
- list of methods to call after registered method
java.lang.NoSuchMethodException
- if there was no valid method for the specified argumentspublic MethodThread backgroundExecute(java.lang.Object... arguments) throws java.lang.NoSuchMethodException
arguments
- The array of arguments for the execution method (must be consistent with the prototype in constructor)
java.lang.NoSuchMethodException
- if there was no valid method for the specified argumentspublic int waitBackgroundExecuteOperation() throws java.lang.Exception
java.lang.Exception
- if there was an exception during waiting (the waiting is not finished then)public void clearThreadLists()
public <E> java.util.List<E> getAllMethodsArgument(java.lang.Class<E> argClass)
E
- the class of the selected argumentargClass
- the class of the selected argument
java.util.NoSuchElementException
- if a parameter with the argClass class was not foundpublic java.util.List<java.lang.Object> getAllMethodsArgument(int position)
position
- the argument position to get
java.util.NoSuchElementException
- if a parameter with the argClass class was not foundpublic <E> java.util.List<E> getAllMethodsReturnValue(java.lang.Class<E> valuesClass) throws java.lang.ClassCastException
E
- the class of the return typesvaluesClass
- the class of the return types
java.lang.ClassCastException
- if some of the returned values cannot be cast to valuesClass
public java.util.List<java.lang.Object> getAllMethodsReturnValue()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |