|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.jogamp.common.util.TaskBase
com.jogamp.common.util.FunctionTask<R,A>
public class FunctionTask<R,A>
Helper class to provide a Runnable queue implementation with a Runnable wrapper
which notifies after execution for the invokeAndWait() semantics.
| Field Summary | |
|---|---|
protected A[] |
args
|
protected R |
result
|
protected Function<R,A> |
runnable
|
| Fields inherited from class com.jogamp.common.util.TaskBase |
|---|
attachment, catchExceptions, isFlushed, runnableException, syncObject, tCreated, tExecuted, tStarted |
| Constructor Summary | |
|---|---|
FunctionTask(Function<R,A> runnable,
Object syncObject,
boolean catchExceptions)
Create a RunnableTask object w/ synchronization, ie. |
|
| Method Summary | ||
|---|---|---|
R |
eval(A... args)
Implementation may compute variable args list
and returns a result. |
|
R |
getResult()
Retrieves the cached result of run()
and is cleared within this method. |
|
Function<R,A> |
getRunnable()
Return the user action |
|
static
|
invoke(boolean waitUntilDone,
Function<U,V> func,
V... args)
Invokes func. |
|
void |
run()
|
|
void |
setArgs(A... args)
Sets the arguments for run(). |
|
| Methods inherited from class com.jogamp.common.util.TaskBase |
|---|
flush, getAttachment, getDurationInExec, getDurationInQueue, getDurationTotal, getSyncObject, getThrowable, getTimestampAfterExec, getTimestampBeforeExec, getTimestampCreate, hasWaiter, isExecuted, isFlushed, isInQueue, setAttachment, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected Function<R,A> runnable
protected R result
protected A[] args
| Constructor Detail |
|---|
public FunctionTask(Function<R,A> runnable,
Object syncObject,
boolean catchExceptions)
invokeAndWait().
runnable - the user actionsyncObject - the synchronization object the caller shall wait until runnable execution is completed,
or null if waiting is not desired.catchExceptions - if true, exception during runnable execution are catched, otherwise not.
Use TaskBase.getThrowable() to determine whether an exception has been catched.| Method Detail |
|---|
public static <U,V> U invoke(boolean waitUntilDone,
Function<U,V> func,
V... args)
func.
waitUntilDone - if true, waits until func execution is completed, otherwise returns immediately.func - the Function to execute.args - the Function arguments
Function return valuepublic final Function<R,A> getRunnable()
public final void setArgs(A... args)
run().
They will be cleared after calling run() or eval(Object...).
public final R getResult()
run()
and is cleared within this method.
public final void run()
Calls eval(Object...).
You may set the eval(Object...) arguments via setArgs(Object...)
and retrieve the result via getResult().
run in interface Runnablerun in class TaskBasepublic final R eval(A... args)
Functionargs list
and returns a result.
eval in interface Function<R,A>args - variable argument list, A[], maybe null
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||