|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.javagroups.util.Promise
Allows a thread to submit an asynchronous request and to wait for the result. The caller may choose to check for the result at a later time, or immediately and it may block or not. Both the caller and responder have to know the promise.
Constructor Summary | |
---|---|
Promise()
|
Method Summary | |
---|---|
java.lang.Object |
checkForResult()
Checks whether result is available. |
java.lang.Object |
getResult(long timeout)
Gets result. |
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()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Promise()
Method Detail |
public java.lang.Object getResult(long timeout)
timeout
- Max time to wait for result. If it is 0, we wait indefinitelypublic java.lang.Object checkForResult()
public void setResult(java.lang.Object obj)
public void reset()
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |