Package com.jogamp.common.util
Class RunnableTask
java.lang.Object
com.jogamp.common.util.TaskBase
com.jogamp.common.util.RunnableTask
- All Implemented Interfaces:
Runnable
Helper class to provide a Runnable queue implementation with a Runnable wrapper
which notifies after execution for the
invokeAndWait() semantics.-
Field Summary
FieldsFields inherited from class com.jogamp.common.util.TaskBase
attachment, catchExceptions, exceptionOut, execThread, isExecuted, isFlushed, runnableException, sourceStack, syncObject, tCreated, tExecuted, tStarted -
Constructor Summary
ConstructorsConstructorDescriptionRunnableTask(Runnable runnable, Object syncObject, boolean catchExceptions, PrintStream exceptionOut) Create a RunnableTask object w/ synchronization, ie. -
Method Summary
Modifier and TypeMethodDescriptionfinal RunnableReturn the user actionstatic voidDeprecated.static ThreadinvokeOnNewThread(ThreadGroup tg, boolean waitUntilDone, Runnable runnable, String threadName) Deprecated.static RunnableTaskinvokeOnNewThread(ThreadGroup tg, String threadName, boolean waitUntilDone, Runnable runnable) Invokesrunnableon a newInterruptSource.Thread, seeThread(ThreadGroup, Runnable, String)for details.final voidrun()Methods inherited from class com.jogamp.common.util.TaskBase
flush, getAttachment, getDurationInExec, getDurationInQueue, getDurationTotal, getExceptionOutIntro, getExecutionThread, getSyncObject, getThrowable, getTimestampAfterExec, getTimestampBeforeExec, getTimestampCreate, hasWaiter, isExecuted, isFlushed, isInQueue, printSourceTrace, setAttachment, toString
-
Field Details
-
runnable
-
-
Constructor Details
-
RunnableTask
public RunnableTask(Runnable runnable, Object syncObject, boolean catchExceptions, PrintStream exceptionOut) Create a RunnableTask object w/ synchronization, ie. suitable forinvokeAndWait(), i.e.invoke(true, runnable).- Parameters:
runnable- The user actionsyncObject- The synchronization object if caller wait untilrunnableexecution is completed, ornullif waiting is not desired.catchExceptions- Influence an occurring exception duringrunnableexecution. Iftrue, the exception is silenced and can be retrieved viaTaskBase.getThrowable(), otherwise the exception is thrown.exceptionOut- If notnull, exceptions are written to thisPrintStream.
-
-
Method Details
-
invoke
Deprecated.Simply invokeRunnable.run() -
invokeOnNewThread
public static Thread invokeOnNewThread(ThreadGroup tg, boolean waitUntilDone, Runnable runnable, String threadName) Deprecated. -
invokeOnNewThread
public static RunnableTask invokeOnNewThread(ThreadGroup tg, String threadName, boolean waitUntilDone, Runnable runnable) Invokesrunnableon a newInterruptSource.Thread, seeThread(ThreadGroup, Runnable, String)for details.- Parameters:
tg- theThreadGroupfor the new thread, maybenullthreadName- the name for the new thread, maybenullwaitUntilDone- iftrue, waits untilrunnableexecution is completed, otherwise returns immediately.runnable- theRunnableto execute on the new thread. IfwaitUntilDoneistrue, the runnable must exit, i.e. not loop forever.- Returns:
- the newly created and invoked
RunnableTask - Since:
- 2.3.2
-
getRunnable
Return the user action -
run
public final void run()
-
Runnable.run()