|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface BaseFuture
Represents the result of an asynchronous operation.
| Nested Class Summary | |
|---|---|
static class |
BaseFuture.FutureType
The first state is always INIT and will always end in either OK, FAILED, or CANCEl |
| Method Summary | |
|---|---|
BaseFuture |
addCancellation(Cancellable cancellable)
Adds a cancel listener to this future, which is called when cancel is executed. |
BaseFuture |
addListener(BaseFutureListener<? extends BaseFuture> listener)
Adds a listener which is notified when the state of this future changes. |
BaseFuture |
addListener(BaseFutureListener<? extends BaseFuture> listener,
boolean last)
Adds a listener which is notified when the state of this future changes. |
BaseFuture |
await()
Wait for the asynchronous operation to end. |
boolean |
await(long timeoutMillis)
Wait for the asynchronous operation to end with the specified timeout. |
BaseFuture |
awaitListeners()
Waits until all the listener finished. |
BaseFuture |
awaitUninterruptibly()
Wait for the asynchronous operation to end without interruption. |
boolean |
awaitUninterruptibly(long timeoutMillis)
Wait for the asynchronous operation to end with the specified timeout without interruption. |
String |
getFailedReason()
The default failed reason is Unknown. |
BaseFuture.FutureType |
getType()
If the type is not OK, then something unexpected happened. |
boolean |
isCompleted()
Checks if the asynchronous operation is finished. |
boolean |
isFailed()
Checks if operation has failed. |
boolean |
isSuccess()
Returns the opposite of isFailed (returns !isFailed). |
BaseFuture |
removeListener(BaseFutureListener<? extends BaseFuture> listener)
Removes a listener which is notified when the state of this future changes. |
BaseFuture |
setFailed(BaseFuture origin)
Sets the failed flat to true and the completed flag to true. |
BaseFuture |
setFailed(String reason)
Sets the failed flat to true and the completed flag to true. |
BaseFuture |
setFailed(String reason,
BaseFuture origin)
Sets the failed flat to true and the completed flag to true. |
BaseFuture |
setFailed(String reason,
Throwable t)
Sets the failed flat to true and the completed flag to true. |
BaseFuture |
setFailed(Throwable t)
Sets the failed flat to true and the completed flag to true. |
| Methods inherited from interface net.tomp2p.futures.Cancellable |
|---|
cancel |
| Method Detail |
|---|
BaseFuture await()
throws InterruptedException
InterruptedException - if thread is interrupted
boolean await(long timeoutMillis)
throws InterruptedException
timeoutMillis - time to wait at most
InterruptedException - if thread is interruptedBaseFuture awaitUninterruptibly()
boolean awaitUninterruptibly(long timeoutMillis)
timeoutMillis - to wait at most
boolean isCompleted()
boolean isSuccess()
boolean isFailed()
BaseFuture setFailed(String reason)
reason - The reason of failure
BaseFuture setFailed(BaseFuture origin)
origin - The origin of failure
BaseFuture setFailed(String reason,
BaseFuture origin)
reason - The reason of failureorigin - The origin of failure
BaseFuture setFailed(Throwable t)
t - The stack trace where the failure happened
BaseFuture setFailed(String reason,
Throwable t)
reason - The reason of failuret - The stack trace where the failure happened
String getFailedReason()
BaseFuture.FutureType getType()
BaseFuture awaitListeners()
throws InterruptedException
InterruptedException - If interrupted from outsideBaseFuture addListener(BaseFutureListener<? extends BaseFuture> listener)
listener - The listener extends the BaseFuture
BaseFuture addListener(BaseFutureListener<? extends BaseFuture> listener,
boolean last)
listener - The listener extends the BaseFuturelast - Set to true if the listener should be added at the end of the list, true if it should be added first
BaseFuture removeListener(BaseFutureListener<? extends BaseFuture> listener)
listener - The listener extends the BaseFuture
BaseFuture addCancellation(Cancellable cancellable)
cancellable - A cancellable class
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||