Package com.jogamp.common.util
Class TaskBase
java.lang.Object
com.jogamp.common.util.TaskBase
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
FunctionTask,RunnableTask
Helper class to provide a Runnable queue implementation with a Runnable wrapper
which notifies after execution for the
invokeAndWait() semantics.-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTaskBase(Object syncObject, boolean catchExceptions, PrintStream exceptionOut) -
Method Summary
Modifier and TypeMethodDescriptionfinal voidSimply flush this task and notify a waiting executor.final ObjectReturn the attachment object if any.final longfinal longfinal longprotected final Stringfinal ThreadReturns the execution thread ornullif not yetrun().final ObjectReturn the synchronization object if any.final Throwablefinal longfinal longfinal longfinal booleanfinal booleanfinal booleanfinal booleanprotected final voidabstract voidrun()final voidAttach a custom object to this task.toString()
-
Field Details
-
syncObject
-
catchExceptions
protected final boolean catchExceptions -
exceptionOut
-
sourceStack
-
attachment
-
runnableException
-
tCreated
protected long tCreated -
tStarted
protected long tStarted -
tExecuted
protected volatile long tExecuted -
isExecuted
protected volatile boolean isExecuted -
isFlushed
protected volatile boolean isFlushed -
execThread
-
-
Constructor Details
-
TaskBase
-
-
Method Details
-
getExceptionOutIntro
-
printSourceTrace
protected final void printSourceTrace() -
getExecutionThread
Returns the execution thread ornullif not yetrun().- Since:
- 2.3.2
-
getSyncObject
Return the synchronization object if any.- See Also:
-
#RunnableTask(Runnable, Object, boolean)
-
setAttachment
Attach a custom object to this task. Useful to piggybag further information, ie tag a task final. -
getAttachment
Return the attachment object if any.- See Also:
-
run
public abstract void run() -
flush
Simply flush this task and notify a waiting executor. The executor which might have been blocked until notified will be unblocked and the task removed from the queue.- Parameters:
t- optional Throwable to be assigned for latergetThrowable()query in case of an error.- See Also:
-
isInQueue
public final boolean isInQueue()- Returns:
- !
isExecuted()&& !isFlushed()
-
isExecuted
public final boolean isExecuted()- Returns:
- True if executed, otherwise false;
-
isFlushed
public final boolean isFlushed()- Returns:
- True if flushed, otherwise false;
-
hasWaiter
public final boolean hasWaiter()- Returns:
- True if invoking thread waits until done,
ie a
notifyObjectwas passed, otherwise false;
-
getThrowable
- Returns:
- A thrown exception while execution of the user action, if any and if caught
- See Also:
-
#RunnableTask(Runnable, Object, boolean)
-
getTimestampCreate
public final long getTimestampCreate() -
getTimestampBeforeExec
public final long getTimestampBeforeExec() -
getTimestampAfterExec
public final long getTimestampAfterExec() -
getDurationInQueue
public final long getDurationInQueue() -
getDurationInExec
public final long getDurationInExec() -
getDurationTotal
public final long getDurationTotal() -
toString
-