V
- the type of the value wrapped in the futureNb object.public interface HjFuture<V>
final
HjFuture<T> f = futureNb(() -> Expr);
creates a new child task to evaluate Expr that is ready to execute
immediately. In this case, f contains a "futureNb handle" to the newly created task and the operation f.get() (also
known as a force operation) can be performed to obtain the result of the futureNb task. If the futureNb task has not
completed as yet, the task performing the f.get() operation blocks until the result of Expr becomes available. The
get() operation also serves as a join on the futureNb task.Modifier and Type | Interface and Description |
---|---|
static class |
HjFuture.CancelledException
Exception returned
|
Modifier and Type | Method and Description |
---|---|
boolean |
cancel()
Attempts to cancel execution of this task.
|
boolean |
failed()
Return true if there was an exception while computing the value.
|
V |
get()
Returns the value wrapped in the futureNb.
|
boolean |
resolved()
Returns whether the futureNb has been resolved, i.e. the value has been computed.
|
V |
safeGet()
Returns the value wrapped in the Future.
|
V get() throws SuspendableException
If the futureNb task has not completed as yet, the task performing the get() operation blocks until the result of the futureNb becomes available.
HjFuture.CancelledException
- when called on a futureNb which was successfully cancelledSuspendableException
V safeGet()
It is illegal to perform a safeGet() operation on an empty Future (i.e. one that has not yet been resolved).
boolean resolved()
boolean failed()
boolean cancel()
Subsequent calls to failed()
will always return true if this method returned true.
Copyright © 2015 Rice University - Department of Computer Science. All rights reserved.