public class Promise<T>
extends java.lang.Object
| Constructor and Description |
|---|
Promise() |
| Modifier and Type | Method and Description |
|---|---|
java.util.concurrent.locks.Condition |
getCond() |
java.util.concurrent.locks.Lock |
getLock() |
T |
getResult() |
T |
getResult(long timeout)
Returns the result, but never throws a TimeoutException; returns null instead.
|
T |
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(T obj)
Sets the result and notifies any threads
waiting for it
|
java.lang.String |
toString() |
public java.util.concurrent.locks.Lock getLock()
public java.util.concurrent.locks.Condition getCond()
public T getResultWithTimeout(long timeout) throws TimeoutException
timeout - TimeoutException - If a timeout occurred (implies that timeout > 0)public T getResult()
public T getResult(long timeout)
timeout - public boolean hasResult()
public void setResult(T obj)
public void reset()
public java.lang.String toString()
toString in class java.lang.ObjectCopyright ? 1998-2008 Bela Ban. All Rights Reserved.