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

public Class RunnableTask

extends TaskBase
Class Inheritance
Imports
java.io.PrintStream, com.jogamp.common.JogampRuntimeException

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 final Runnable
Inherited from com.jogamp.common.util.TaskBase:
attachmentcatchExceptionsexceptionOutexecThreadisExecutedisFlushedrunnableExceptionsourceStacksyncObjecttCreatedtExecutedtStarted

Constructor Summary

AccessConstructor and Description
public
RunnableTask(final Runnable
The user action
runnable
,
final Object
The synchronization object if caller wait until runnable execution is completed, or null if waiting is not desired.
syncObject
,
final boolean
Influence an occurring exception during runnable execution. If true, the exception is silenced and can be retrieved via getThrowable(), otherwise the exception is thrown.
catchExceptions
,
final PrintStream
If not null, exceptions are written to this PrintStream.
exceptionOut
)

Create a RunnableTask object w/ synchronization, ie.

Method Summary

Modifier and TypeMethod and Description
public final Runnable
getRunnable()

Return the user action

public static void
invoke(final boolean waitUntilDone, final Runnable runnable)

Deprecated Simply invoke Runnable#run()
public static Thread
invokeOnNewThread(final ThreadGroup tg, final boolean waitUntilDone, final Runnable runnable, final String threadName)

public static RunnableTask

Returns:

the newly created and invoked RunnableTask
invokeOnNewThread
(final ThreadGroup
the ThreadGroup for the new thread, maybe null
tg
,
final String
the name for the new thread, maybe null
threadName
,
final boolean
if true, waits until runnable execution is completed, otherwise returns immediately.
waitUntilDone
,
final Runnable
the Runnable to execute on the new thread. If waitUntilDone is true, the runnable must exit, i.e. not loop forever.
runnable
)

Invokes runnable on a new InterruptSource.Thread, see InterruptSource.Thread#Thread(ThreadGroup, Runnable, String) for details.

public final void
run()

Implements abstract com.jogamp.common.util.TaskBase.run.

Implements java.lang.Runnable.run.

Runs this operation.
Inherited from com.jogamp.common.util.TaskBase:
flushgetAttachmentgetDurationInExecgetDurationInQueuegetDurationTotalgetExceptionOutIntrogetExecutionThreadgetSyncObjectgetThrowablegetTimestampAfterExecgetTimestampBeforeExecgetTimestampCreatehasWaiterisExecutedisFlushedisInQueueprintSourceTracesetAttachmenttoString

Field Detail

runnableback to summary
protected final Runnable runnable

Constructor Detail

RunnableTaskback to summary
public RunnableTask(final Runnable runnable, final Object syncObject, final boolean catchExceptions, final PrintStream exceptionOut)

Create a RunnableTask object w/ synchronization, ie. suitable for invokeAndWait(), i.e. invoke(true, runnable).

Parameters
runnable:Runnable

The user action

syncObject:Object

The synchronization object if caller wait until runnable execution is completed, or null if waiting is not desired.

catchExceptions:boolean

Influence an occurring exception during runnable execution. If true, the exception is silenced and can be retrieved via getThrowable(), otherwise the exception is thrown.

exceptionOut:PrintStream

If not null, exceptions are written to this PrintStream.

Method Detail

getRunnableback to summary
public final Runnable getRunnable()

Return the user action

invokeback to summary
public static void invoke(final boolean waitUntilDone, final Runnable runnable)

Deprecated

Simply invoke Runnable#run()

invokeOnNewThreadback to summary
public static Thread invokeOnNewThread(final ThreadGroup tg, final boolean waitUntilDone, final Runnable runnable, final String threadName)
invokeOnNewThreadback to summary
public static RunnableTask invokeOnNewThread(final ThreadGroup tg, final String threadName, final boolean waitUntilDone, final Runnable runnable)

Invokes runnable on a new InterruptSource.Thread, see InterruptSource.Thread#Thread(ThreadGroup, Runnable, String) for details.

Parameters
tg:ThreadGroup

the ThreadGroup for the new thread, maybe null

threadName:String

the name for the new thread, maybe null

waitUntilDone:boolean

if true, waits until runnable execution is completed, otherwise returns immediately.

runnable:Runnable

the Runnable to execute on the new thread. If waitUntilDone is true, the runnable must exit, i.e. not loop forever.

Returns:RunnableTask

the newly created and invoked RunnableTask

Since
2.3.2
runback to summary
public final void run()

Implements abstract com.jogamp.common.util.TaskBase.run.

Implements java.lang.Runnable.run.

Doc from java.lang.Runnable.run.

Runs this operation.

Annotations
@Override