T - the result returned by the actionpublic interface ResilientPromise<T>
ResilientFuture. However, unlike a future, a
promise can be written to. A promise can only completed once. Once it is completed,
all further attempts to update the status should fail.| Modifier and Type | Method and Description |
|---|---|
void |
await()
Block on this promise being completed.
|
boolean |
await(long timePeriod,
java.util.concurrent.TimeUnit unit) |
T |
awaitResult()
Block on this promise being completed and return the result.
|
boolean |
deliverError(java.lang.Exception error)
Deliver an error to this promise.
|
boolean |
deliverResult(T result)
Deliver the result to this promise.
|
java.lang.Exception |
getError()
Return any error that has been delivered.
|
T |
getResult()
Return any result that has been delivered.
|
Status |
getStatus()
Return the status of the promise.
|
boolean |
isDone()
Indicate if the
Status of the promise is not pending. |
boolean |
isError()
Indicate if the
Status of the promise is error. |
boolean |
isSuccessful()
Indicate if the
Status of the promise is successful. |
boolean |
isTimedOut()
Indicate if the
Status of the promise is timeout. |
boolean |
setTimedOut()
Set the promise
Status to timeout. |
boolean deliverResult(T result)
result - the result of the promiseboolean deliverError(java.lang.Exception error)
error - the error to delivervoid await()
throws java.lang.InterruptedException
java.lang.InterruptedExceptionboolean await(long timePeriod,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
java.lang.InterruptedExceptionT awaitResult() throws java.lang.InterruptedException
java.lang.InterruptedExceptionT getResult()
java.lang.Exception getError()
Status getStatus()
boolean setTimedOut()
Status to timeout. If the promise has already been completed,
this method will return false.boolean isSuccessful()
Status of the promise is successful.boolean isDone()
Status of the promise is not pending.boolean isError()
Status of the promise is error.boolean isTimedOut()
Status of the promise is timeout.Copyright © 2014 Tim Brooks. All Rights Reserved.