Constructor and Description |
---|
RunnableTask(Runnable runnable)
Create a RunnableTask object w/o synchronization,
ie.
|
RunnableTask(Runnable runnable,
Object syncObject)
Create a RunnableTask object w/ synchronization,
ie.
|
RunnableTask(Runnable runnable,
Object syncObject,
boolean catchExceptions)
Create a RunnableTask object w/ synchronization,
ie.
|
Modifier and Type | Method and Description |
---|---|
void |
flush()
Simply flush this task and notify a waiting executor.
|
Object |
getAttachment()
Return the attachment object if any.
|
long |
getDurationInExec() |
long |
getDurationInQueue() |
long |
getDurationTotal() |
Runnable |
getRunnable()
Return the user action
|
Object |
getSyncObject()
Return the synchronization object if any.
|
Throwable |
getThrowable() |
long |
getTimestampAfterExec() |
long |
getTimestampBeforeExec() |
long |
getTimestampCreate() |
boolean |
hasWaiter() |
boolean |
isExecuted() |
boolean |
isFlushed() |
boolean |
isInQueue() |
void |
run() |
void |
setAttachment(Object o)
Attach a custom object to this task.
|
String |
toString() |
public RunnableTask(Runnable runnable)
invokeAndWait()
.runnable
- the user actionpublic RunnableTask(Runnable runnable, Object syncObject)
invokeAndWait()
.runnable
- the user actionsyncObject
- the synchronization object the caller shall wait for in case of invokeAndWait()
public RunnableTask(Runnable runnable, Object syncObject, boolean catchExceptions)
invokeAndWait()
.runnable
- the user actionsyncObject
- the synchronization object the caller shall wait for in case of invokeAndWai()t
catchExceptions
- if true, exception during runnable
execution are catched, otherwise not.
Use getThrowable()
to determine whether an exception has been catched.public Runnable getRunnable()
public Object getSyncObject()
public void setAttachment(Object o)
public Object getAttachment()
setAttachment(Object)
public void flush()
isFlushed()
,
isInQueue()
public boolean isInQueue()
isExecuted()
&& !isFlushed()
public boolean isExecuted()
public boolean isFlushed()
public boolean hasWaiter()
notifyObject
was passed, otherwise false;public Throwable getThrowable()
RunnableTask(Runnable, Object, boolean)
public long getTimestampCreate()
public long getTimestampBeforeExec()
public long getTimestampAfterExec()
public long getDurationInQueue()
public long getDurationInExec()
public long getDurationTotal()