com.jogamp.common.util
Class RunnableTask

java.lang.Object
  extended by com.jogamp.common.util.TaskBase
      extended by com.jogamp.common.util.RunnableTask
All Implemented Interfaces:
Runnable

public class RunnableTask
extends TaskBase

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


Field Summary
protected  Runnable runnable
           
 
Fields inherited from class com.jogamp.common.util.TaskBase
attachment, catchExceptions, isFlushed, runnableException, syncObject, tCreated, tExecuted, tStarted
 
Constructor Summary
RunnableTask(Runnable runnable, Object syncObject, boolean catchExceptions)
          Create a RunnableTask object w/ synchronization, ie.
 
Method Summary
 Runnable getRunnable()
          Return the user action
static void invoke(boolean waitUntilDone, Runnable runnable)
          Invoks runnable.
 void run()
           
 
Methods inherited from class com.jogamp.common.util.TaskBase
flush, getAttachment, getDurationInExec, getDurationInQueue, getDurationTotal, getSyncObject, getThrowable, getTimestampAfterExec, getTimestampBeforeExec, getTimestampCreate, hasWaiter, isExecuted, isFlushed, isInQueue, setAttachment, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

runnable

protected final Runnable runnable
Constructor Detail

RunnableTask

public RunnableTask(Runnable runnable,
                    Object syncObject,
                    boolean catchExceptions)
Create a RunnableTask object w/ synchronization, ie. suitable for invokeAndWait(), i.e. invoke(true, runnable).

Parameters:
runnable - the user action
syncObject - the synchronization object if caller wait until runnable execution is completed, or null if waiting is not desired.
catchExceptions - if true, exception during runnable execution are catched, otherwise not. Use TaskBase.getThrowable() to determine whether an exception has been catched.
Method Detail

invoke

public static void invoke(boolean waitUntilDone,
                          Runnable runnable)
Invoks runnable.

Parameters:
waitUntilDone - if true, waits until runnable execution is completed, otherwise returns immediately.
runnable - the Runnable to execute.

getRunnable

public final Runnable getRunnable()
Return the user action


run

public final void run()
Specified by:
run in interface Runnable
Specified by:
run in class TaskBase