| Modifier and Type | Field and Description |
|---|---|
protected Runnable |
runnable |
attachment, catchExceptions, exceptionOut, isFlushed, runnableException, sourceStack, syncObject, tCreated, tExecuted, tStarted| Constructor and Description |
|---|
RunnableTask(Runnable runnable,
Object syncObject,
boolean catchExceptions,
PrintStream exceptionOut)
Create a RunnableTask object w/ synchronization,
ie.
|
| Modifier and Type | Method and Description |
|---|---|
Runnable |
getRunnable()
Return the user action
|
static void |
invoke(boolean waitUntilDone,
Runnable runnable)
Invokes
runnable on the current thread. |
static Thread |
invokeOnNewThread(ThreadGroup tg,
boolean waitUntilDone,
Runnable runnable,
String threadName)
Invokes
runnable on a new thread belonging to the given ThreadGroup. |
void |
run() |
flush, getAttachment, getDurationInExec, getDurationInQueue, getDurationTotal, getExceptionOutIntro, getSyncObject, getThrowable, getTimestampAfterExec, getTimestampBeforeExec, getTimestampCreate, hasWaiter, isExecuted, isFlushed, isInQueue, printSourceTrace, setAttachment, toStringprotected final Runnable runnable
public RunnableTask(Runnable runnable, Object syncObject, boolean catchExceptions, PrintStream exceptionOut)
invokeAndWait(), i.e. invoke(true, runnable).runnable - The user actionsyncObject - The synchronization object if caller wait until runnable execution is completed,
or null if waiting is not desired.catchExceptions - Influence an occurring exception during runnable execution.
If true, the exception is silenced and can be retrieved via TaskBase.getThrowable(),
otherwise the exception is thrown.exceptionOut - If not null, exceptions are written to this PrintStream.public static void invoke(boolean waitUntilDone,
Runnable runnable)
runnable on the current thread.waitUntilDone - if true, waits until runnable execution is completed, otherwise returns immediately.runnable - the Runnable to execute.public static Thread invokeOnNewThread(ThreadGroup tg, boolean waitUntilDone, Runnable runnable, String threadName)
runnable on a new thread belonging to the given ThreadGroup.tg - the ThreadGroup for the new thread, maybe nullwaitUntilDone - if true, waits until runnable execution is completed, otherwise returns immediately.runnable - the Runnable to execute on the new thread. If waitUntilDone is true,
the runnable must exist, i.e. not loop forever.threadName - the name for the new threadThreadpublic final Runnable getRunnable()