|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.vub.at.actors.eventloops.BlockingFuture
A BlockingFuture represents a synchronous, blocking future used by the AT/2 implementation
to synchronize between native threads.
Usage:
BlockingFuture future = object.doAsynchronousComputation();
try {
Object result = future.get();
} catch(Exception e) {
// async computation raised an exception
}
Based on source code written by Doug Lea with assistance from members of JCP JSR-166
Expert Group and released to the public domain.
Field Summary | |
private java.lang.Exception |
exception
|
private boolean |
fulfilled
|
private java.lang.Object |
result
|
Constructor Summary | |
BlockingFuture()
|
Method Summary | |
java.lang.Object |
get()
Used to retrieve the real value from the future. |
private java.lang.Object |
getResult()
Gets the result of the task. |
boolean |
isDetermined()
|
void |
resolve(java.lang.Object v)
Sets the result of this Future to the given value unless this future has already been set or has been cancelled. |
void |
ruin(java.lang.Exception e)
Causes this future to report an ExecutionException with the given throwable as its cause, unless this Future has already been set or has been cancelled. |
private void |
setCompleted(java.lang.Object result)
Marks the task as completed. |
private void |
setFailed(java.lang.Exception exception)
Marks the task as failed. |
private void |
waitFor()
Waits for the task to complete. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private java.lang.Object result
private java.lang.Exception exception
private boolean fulfilled
Constructor Detail |
public BlockingFuture()
Method Detail |
public boolean isDetermined()
public java.lang.Object get() throws java.lang.Exception
Future
get
in interface Future
java.lang.Exception
- if the future has been ruined with an exception.public void resolve(java.lang.Object v)
resolve
in interface Future
v
- the valuepublic void ruin(java.lang.Exception e)
ruin
in interface Future
e
- the cause of failureprivate void setCompleted(java.lang.Object result)
result
- the result of a task.private void setFailed(java.lang.Exception exception)
exception
- the cause of abrupt completion.private void waitFor()
private java.lang.Object getResult() throws java.lang.Exception
java.lang.Exception
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |