|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.almendra.commons.threads.Future
public abstract class Future
Field Summary | |
---|---|
protected java.lang.Exception |
exception
Stores exception that may occur waiting for result. |
(package private) java.util.List |
historyItems
|
protected boolean |
holds
Indicates whether the Future is waiting or not. |
protected EDU.oswego.cs.dl.util.concurrent.Latch |
latch
Used to block the calling thread if it requests the result that has not been produced so far. |
protected java.lang.Object |
lock
Used to synchronize access to the signaled and holds state variable. |
protected java.lang.String |
name
User-defined name of the future. |
protected boolean |
signaled
Variable set to true when the latch has been released. |
protected boolean |
timeoutOccurred
Answers whether a timeout occurred waiting for the result. |
protected boolean |
verbose
Flag that indicates whether trace information should be written to the console when the future is waiting for the result. |
Constructor Summary | |
---|---|
Future()
Creates a new Future object. |
|
Future(java.lang.String name)
Creates a new Future object. |
Method Summary | |
---|---|
void |
acquire()
Make the calling thread wait till the result has arrived. |
void |
acquire(long timeoutInMillisOrZero)
Make the calling thread wait till the result has arrived. |
void |
addHistoryItems(java.util.List items)
|
void |
createHistorySummary(IHistorySummary historySummary)
|
java.lang.Exception |
getException()
|
java.util.List |
getHistoryItems()
Returns null if called before acquire() has resumed. |
java.lang.String |
getName()
All objects that have a user-defined name must implement this method. |
boolean |
hasException()
Anser whether an exception has occurred waiting for the result. |
boolean |
holds()
|
boolean |
isTimeout()
|
boolean |
isVerbose()
|
protected void |
primAcquire(long milliseconds)
Utility method to block the calling thread until the result has arrived or the timeout period expired. |
void |
setException(java.lang.Exception exception)
|
void |
setVerbose(boolean verbose)
|
void |
signal()
Unblock the calling thread in case the result has arrived or some event has occurred. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
java.util.List historyItems
protected java.lang.String name
protected EDU.oswego.cs.dl.util.concurrent.Latch latch
protected boolean timeoutOccurred
protected boolean signaled
latch
has been released. Used to determine
whether latch has been released explicitly after result has arrived or whether a
timeout has occurred.
protected java.lang.Object lock
signaled
and holds
state variable.
protected java.lang.Exception exception
protected boolean holds
Future
is waiting or not.
protected boolean verbose
Constructor Detail |
---|
public Future()
Future
object.
public Future(java.lang.String name)
Future
object.
Method Detail |
---|
public java.lang.String getName()
INamedObject
getName
in interface INamedObject
public boolean isTimeout()
public void setVerbose(boolean verbose)
verbose
- The verbose to set.public boolean isVerbose()
public java.lang.Exception getException()
public void setException(java.lang.Exception exception)
exception
- The exception to set.public void acquire()
getResult(...)
when the calling thread only has to be blocked till some
event has occurred and there is no interest in some result.
public void acquire(long timeoutInMillisOrZero) throws java.lang.IllegalArgumentException, TimeoutException
getResult(...)
when the calling thread only has to be blocked till some
event has occurred and there is no interest in some result.
timeoutInMillisOrZero
- timeout period in milliseconds after which the calling thread is released
java.lang.IllegalArgumentException
- thrown if timeoutInMillisOrZero
smaller than zero
TimeoutException
protected void primAcquire(long milliseconds) throws TimeoutException
milliseconds
- the timeout period in milliseconds
TimeoutException
- thrown when timeout period expired waiting for the resultpublic boolean hasException()
public void signal()
signal
in interface ISignalable
public boolean holds()
holds
in interface ISignalable
public java.util.List getHistoryItems()
acquire()
has resumed.
getHistoryItems
in interface IHistorizable
public void createHistorySummary(IHistorySummary historySummary)
createHistorySummary
in interface IHistorizable
public void addHistoryItems(java.util.List items)
addHistoryItems
in interface IHistorizable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |