|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectix.util.FutureValue
public abstract class FutureValue
Computes a value in a separate thread. Example:
FutureValue fv = new FutureValue("computes v") {
public Object computeValue() {
...;
}
};
fv.start();
...
Object v = fv.getValue();
getValue() waits until the value is available.
| Constructor Summary | |
|---|---|
FutureValue(java.lang.String name)
Construct a FutureValue that has a daemon thread for computing the value. |
|
| Method Summary | |
|---|---|
abstract java.lang.Object |
computeValue()
|
java.lang.Object |
getValue()
Returns the computed value once it is available. |
boolean |
isReady()
|
void |
start()
Start the thread that will compute the value. |
void |
waitUntilReady(long timeout)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FutureValue(java.lang.String name)
computeValue() method.
| Method Detail |
|---|
public void start()
public java.lang.Object getValue()
RethrownException - if the computation of the value
threw and error or exception.public void waitUntilReady(long timeout)
public boolean isReady()
public abstract java.lang.Object computeValue()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||