public class Promise
extends java.lang.Object
Constructor and Description |
---|
Promise() |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
getResult() |
java.lang.Object |
getResult(long timeout)
Returns the result, but never throws a TimeoutException; returns null instead.
|
java.lang.Object |
getResultWithTimeout(long timeout)
Blocks until a result is available, or timeout milliseconds have elapsed
|
boolean |
hasResult()
Checks whether result is available.
|
void |
reset()
Causes all waiting threads to return
|
void |
setResult(java.lang.Object obj)
Sets the result and notifies any threads
waiting for it
|
java.lang.String |
toString() |
public java.lang.Object getResultWithTimeout(long timeout) throws TimeoutException
timeout
- TimeoutException.
- If a timeout occurred (implies that timeout > 0)TimeoutException
public java.lang.Object getResult()
public java.lang.Object getResult(long timeout)
timeout
- public boolean hasResult()
public void setResult(java.lang.Object obj)
public void reset()
public java.lang.String toString()
toString
in class java.lang.Object
Copyright ? 1998-2006 Bela Ban. All Rights Reserved.