Top Description Fields Constructors Methods
com.jogamp.common.util

public abstract Class TaskBase

extends Object
implements Runnable
Class Inheritance
All Implemented Interfaces
java.lang.Runnable
Known Direct Subclasses
com.jogamp.common.util.FunctionTask, com.jogamp.common.util.RunnableTask
Imports
java.io.PrintStream, jogamp.common.Debug

Helper class to provide a Runnable queue implementation with a Runnable wrapper which notifies after execution for the invokeAndWait() semantics.

Field Summary

Modifier and TypeField and Description
protected Object
protected final boolean
protected final PrintStream
protected volatile Thread
protected volatile boolean
protected volatile boolean
protected Throwable
protected final Throwable
protected final Object
protected long
protected volatile long
private static final boolean
TRACE_SOURCE

Enable via the property jogamp.debug.TaskBase.TraceSource

protected long

Constructor Summary

AccessConstructor and Description
protected
TaskBase(final Object syncObject, final boolean catchExceptions, final PrintStream exceptionOut)

Method Summary

Modifier and TypeMethod and Description
public final void
flush(final Throwable
optional Throwable to be assigned for later getThrowable() query in case of an error.
t
)

Simply flush this task and notify a waiting executor.

public final Object
getAttachment()

Return the attachment object if any.

public final long
public final long
public final long
protected final String
public final Thread
getExecutionThread()

Returns the execution thread or null if not yet run().

public final Object
getSyncObject()

Return the synchronization object if any.

public final Throwable

Returns:

A thrown exception while execution of the user action, if any and if caught
getThrowable
()

public final long
public final long
public final long
public final boolean

Returns:

True if invoking thread waits until done, ie a notifyObject was passed, otherwise false;
hasWaiter
()

public final boolean

Returns:

True if executed, otherwise false;
isExecuted
()

public final boolean

Returns:

True if flushed, otherwise false;
isFlushed
()

public final boolean
protected final void
public abstract void
run()

Redeclares java.lang.Runnable.run.

Runs this operation.
public final void
setAttachment(final Object o)

Attach a custom object to this task.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

attachmentback to summary
protected Object attachment
catchExceptionsback to summary
protected final boolean catchExceptions
exceptionOutback to summary
protected final PrintStream exceptionOut
execThreadback to summary
protected volatile Thread execThread
isExecutedback to summary
protected volatile boolean isExecuted
isFlushedback to summary
protected volatile boolean isFlushed
runnableExceptionback to summary
protected Throwable runnableException
sourceStackback to summary
protected final Throwable sourceStack
syncObjectback to summary
protected final Object syncObject
tCreatedback to summary
protected long tCreated
tExecutedback to summary
protected volatile long tExecuted
TRACE_SOURCEback to summary
private static final boolean TRACE_SOURCE

Enable via the property jogamp.debug.TaskBase.TraceSource

tStartedback to summary
protected long tStarted

Constructor Detail

TaskBaseback to summary
protected TaskBase(final Object syncObject, final boolean catchExceptions, final PrintStream exceptionOut)

Method Detail

flushback to summary
public final void flush(final Throwable t)

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:Throwable

optional Throwable to be assigned for later getThrowable() query in case of an error.

See Also
isFlushed(), isInQueue()
getAttachmentback to summary
public final Object getAttachment()

Return the attachment object if any.

See Also
setAttachment(Object)
getDurationInExecback to summary
public final long getDurationInExec()
getDurationInQueueback to summary
public final long getDurationInQueue()
getDurationTotalback to summary
public final long getDurationTotal()
getExceptionOutIntroback to summary
protected final String getExceptionOutIntro()
getExecutionThreadback to summary
public final Thread getExecutionThread()

Returns the execution thread or null if not yet run().

Since
2.3.2
getSyncObjectback to summary
public final Object getSyncObject()

Return the synchronization object if any.

See Also
RunnableTask(Runnable, Object, boolean)
getThrowableback to summary
public final Throwable getThrowable()
Returns:Throwable

A thrown exception while execution of the user action, if any and if caught

See Also
RunnableTask(Runnable, Object, boolean)
getTimestampAfterExecback to summary
public final long getTimestampAfterExec()
getTimestampBeforeExecback to summary
public final long getTimestampBeforeExec()
getTimestampCreateback to summary
public final long getTimestampCreate()
hasWaiterback to summary
public final boolean hasWaiter()
Returns:boolean

True if invoking thread waits until done, ie a notifyObject was passed, otherwise false;

isExecutedback to summary
public final boolean isExecuted()
Returns:boolean

True if executed, otherwise false;

isFlushedback to summary
public final boolean isFlushed()
Returns:boolean

True if flushed, otherwise false;

isInQueueback to summary
public final boolean isInQueue()
Returns:boolean

!isExecuted() && !isFlushed()

printSourceTraceback to summary
protected final void printSourceTrace()
runback to summary
public abstract void run()

Redeclares java.lang.Runnable.run.

Doc from java.lang.Runnable.run.

Runs this operation.

Annotations
@Override
setAttachmentback to summary
public final void setAttachment(final Object o)

Attach a custom object to this task. Useful to piggybag further information, ie tag a task final.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override