public interface BaseFuture extends Cancellable
| Modifier and Type | Interface and Description |
|---|---|
static class |
BaseFuture.FutureType
The first state is always INIT and will always end in either OK, FAILED,
or CANCEl
|
| Modifier and Type | Method and Description |
|---|---|
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(String reason)
Sets the failed flat to true and the completed flag to true.
|
cancelBaseFuture await() throws InterruptedException
InterruptedException - if thread is interruptedboolean await(long timeoutMillis)
throws InterruptedException
timeoutMillis - time to wait at mostInterruptedException - if thread is interruptedBaseFuture awaitUninterruptibly()
boolean awaitUninterruptibly(long timeoutMillis)
me - to wait at mostboolean isCompleted()
boolean isSuccess()
boolean isFailed()
void setFailed(String reason)
String getFailedReason()
BaseFuture.FutureType getType()
BaseFuture addListener(BaseFutureListener<? extends BaseFuture> listener)
listener - The listener extends the BaseFutureBaseFuture removeListener(BaseFutureListener<? extends BaseFuture> listener)
listener - The listener extends the BaseFutureBaseFuture addCancellation(Cancellable cancellable)
cancellable - A cancellable classBaseFuture removeCancellation(Cancellable cancellable)
cancellable - A cancellable classCopyright © 2011. All Rights Reserved.