public class Promise<T> extends Object
Constructor and Description |
---|
Promise() |
Modifier and Type | Method and Description |
---|---|
Condition |
getCond() |
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
|
String |
toString() |
public Lock getLock()
public 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()
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.