common.threads
Class WorkRequest
java.lang.Object
common.threads.WorkRequest
public final class WorkRequest
- extends java.lang.Object
A work request to the thread pool. Allow other threads to wait until
the "runnable" is finished. This is basically a concurrent.Future implementation.
- Since:
- CC 0.9.0
- Author:
- Marcelo Vanzin
- See Also:
Future
,
Task
,
ThreadUtilities
Constructor Summary |
WorkRequest(java.lang.Runnable work)
|
Method Summary |
java.lang.Exception |
getError()
Returns any exception that was caught while running the request. |
protected java.lang.Runnable |
getRunnable()
|
boolean |
isDone()
|
protected void |
run()
|
void |
waitFor()
Waits until the running job is finished. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
WorkRequest
public WorkRequest(java.lang.Runnable work)
waitFor
public void waitFor()
throws java.lang.InterruptedException
- Waits until the running job is finished.
- Throws:
java.lang.InterruptedException
isDone
public boolean isDone()
getError
public java.lang.Exception getError()
- Returns any exception that was caught while running the request.
- Since:
- CC 0.9.4
run
protected void run()
getRunnable
protected java.lang.Runnable getRunnable()