|
||||||||||
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 |
await()
Wait for the asynchronous operation to end. |
boolean |
await(long timeoutMillis)
Wait for the asynchronous operation to end with the specified timeout. |
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 |
removeCancellation(Cancellable cancellable)
Remove a listener. |
BaseFuture |
removeListener(BaseFutureListener<? extends BaseFuture> listener)
Removes a listener which is notified when the state of this future changes. |
void |
setFailed(BaseFuture origin)
Sets the failed flat to true and the completed flag to true. |
void |
setFailed(String reason)
Sets the failed flat to true and the completed flag to true. |
void |
setFailed(String reason,
BaseFuture origin)
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 interruptedboolean await(long timeoutMillis) throws InterruptedException
timeoutMillis
- time to wait at most
InterruptedException
- if thread is interruptedBaseFuture awaitUninterruptibly()
boolean awaitUninterruptibly(long timeoutMillis)
me
- to wait at most
boolean isCompleted()
boolean isSuccess()
boolean isFailed()
void setFailed(String reason)
void setFailed(BaseFuture origin)
void setFailed(String reason, BaseFuture origin)
String getFailedReason()
BaseFuture.FutureType getType()
BaseFuture addListener(BaseFutureListener<? extends BaseFuture> listener)
listener
- The listener extends the BaseFuture
BaseFuture removeListener(BaseFutureListener<? extends BaseFuture> listener)
listener
- The listener extends the BaseFuture
BaseFuture addCancellation(Cancellable cancellable)
cancellable
- A cancellable classBaseFuture removeCancellation(Cancellable cancellable)
cancellable
- A cancellable class
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |