T - the result returned by the actionpublic class SingleWriterResilientPromise<T> extends AbstractResilientPromise<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.
This class is designed to be written to by ONE thread only. It primarily exists to
avoid expensive compareAndSet calls that are required in the multiple writer scenario.
This promise is used in synchronous run)
calls.result| Constructor and Description |
|---|
SingleWriterResilientPromise() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
deliverError(java.lang.Exception error)
Deliver an error to this promise.
|
boolean |
deliverResult(T result)
Deliver the result to this promise.
|
boolean |
setTimedOut()
Set the promise
Status to timeout. |
await, await, awaitResult, getError, getResult, getStatus, isDone, isError, isSuccessful, isTimedOut, wrapPromisepublic boolean deliverResult(T result)
ResilientPromiseresult - the result of the promisepublic boolean deliverError(java.lang.Exception error)
ResilientPromiseerror - the error to deliverpublic boolean setTimedOut()
ResilientPromiseStatus to timeout. If the promise has already been completed,
this method will return false.Copyright © 2014 Tim Brooks. All Rights Reserved.