|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.almendra.commons.threads.Future
org.almendra.commons.threads.FutureResult
public class FutureResult
Holds a promise to deliver a result after unlimited time or after a specifiable period. Used to make the calling thread wait until the result has been produced by some other thread. Upon arrival of the result the calling thread is unblocked or when the timeout period has expired. In the latter case null is returned as the result.
Field Summary | |
---|---|
protected java.io.Serializable |
result
Attribute used to store the result the calling thread is asking for. |
Fields inherited from class org.almendra.commons.threads.Future |
---|
exception, historyItems, holds, latch, lock, name, signaled, timeoutOccurred, verbose |
Constructor Summary | |
---|---|
FutureResult()
Creates a new FutureResult object. |
|
FutureResult(java.lang.String name)
Creates a new FutureResult object. |
|
FutureResult(java.lang.String name,
boolean verbose)
Creates a new FutureResult object. |
Method Summary | |
---|---|
java.io.Serializable |
getResult()
|
java.io.Serializable |
getResult(int timeoutPeriod)
Returns the result. |
void |
setResult(java.io.Serializable result)
|
Methods inherited from class org.almendra.commons.threads.Future |
---|
acquire, acquire, addHistoryItems, createHistorySummary, getException, getHistoryItems, getName, hasException, holds, isTimeout, isVerbose, primAcquire, setException, setVerbose, signal |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.io.Serializable result
Constructor Detail |
---|
public FutureResult()
FutureResult
object.
public FutureResult(java.lang.String name)
FutureResult
object.
name
- the user-defined name of the futurepublic FutureResult(java.lang.String name, boolean verbose)
FutureResult
object.
name
- the user-defined name of the futureverbose
- indicates whether trace information should be written to the consoleMethod Detail |
---|
public java.io.Serializable getResult()
public java.io.Serializable getResult(int timeoutPeriod) throws java.lang.IllegalArgumentException, TimeoutException
timeoutPeriod
- timeout period in milliseconds
java.lang.IllegalArgumentException
TimeoutException
public void setResult(java.io.Serializable result)
result
- The result to set.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |