Package com.jogamp.common.util
Class RunnableTask
- java.lang.Object
-
- com.jogamp.common.util.TaskBase
-
- com.jogamp.common.util.RunnableTask
-
-
Field Summary
Fields Modifier and Type Field Description protected Runnablerunnable-
Fields inherited from class com.jogamp.common.util.TaskBase
attachment, catchExceptions, exceptionOut, execThread, isExecuted, isFlushed, runnableException, sourceStack, syncObject, tCreated, tExecuted, tStarted
-
-
Constructor Summary
Constructors Constructor Description RunnableTask(Runnable runnable, Object syncObject, boolean catchExceptions, PrintStream exceptionOut)Create a RunnableTask object w/ synchronization, ie.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description RunnablegetRunnable()Return the user actionstatic voidinvoke(boolean waitUntilDone, Runnable runnable)Deprecated.Simply invokeRunnable.run()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.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 Detail
-
runnable
protected final Runnable runnable
-
-
Constructor Detail
-
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 Detail
-
invoke
public static void invoke(boolean waitUntilDone, Runnable runnable)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
public final Runnable getRunnable()
Return the user action
-
-