public class CallbackWrapper<T> extends Object implements IPromise<T>, Serializable
| Constructor and Description |
|---|
CallbackWrapper(Actor targetQ,
Callback<T> realFuture) |
| Modifier and Type | Method and Description |
|---|---|
T |
await(long timeout)
schedule other events/messages until future is resolved/settled (Nonblocking delay).
|
IPromise<T> |
awaitPromise(long timeout)
schedule other events/messages until future is resolved/settled (Nonblocking delay).
|
<OUT> IPromise<OUT> |
catchError(java.util.function.Consumer<Object> function)
called if an error has been signaled by one of the futures in the previous future chain.
|
<OUT> IPromise<OUT> |
catchError(java.util.function.Function<Object,IPromise<OUT>> function)
called if an error has been signaled by one of the futures in the previous future chain.
|
void |
complete(T result,
Object error)
set result or error.
|
T |
get()
Warning: this is different to JDK's BLOCKING future
|
Object |
getError() |
boolean |
isSettled() |
IPromise<T> |
onError(java.util.function.Consumer errorHandler)
called when an error is set as the result
forwards to (new) "catchError" variant.
|
IPromise<T> |
onResult(java.util.function.Consumer<T> resultHandler)
called when a valid result of a future becomes available.
|
IPromise<T> |
onTimeout(java.util.function.Consumer timeoutHandler)
called when the async call times out.
|
IPromise |
then(Callback<T> result)
called once any result of a future becomes available
Can be used in case a sender is not interested in the actual result
but when a remote method has finished processing.
|
<OUT> IPromise<OUT> |
then(java.util.function.Consumer<T> function)
called once any result of a future becomes available
Can be used in case a sender is not interested in the actual result
but when a remote method has finished processing.
|
IPromise<T> |
then(Runnable result)
called once any result of a future becomes available
Can be used in case a sender is not interested in the actual result
but when a remote method has finished processing.
|
<OUT> IPromise<OUT> |
thenAnd(java.util.function.Function<T,IPromise<OUT>> function)
called once any result of a future becomes available
Can be used in case a sender is not interested in the actual result
but when a remote method has finished processing.
|
IPromise<T> |
thenAnd(java.util.function.Supplier<IPromise<T>> result)
called once any result of a future becomes available
Can be used in case a sender is not interested in the actual result
but when a remote method has finished processing.
|
IPromise |
timeoutIn(long millis)
tell the future to call the onTimeout callback in N milliseconds if future is not settled until then
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitawait, awaitPromise, onTimeoutpublic void complete(T result, Object error)
Callbackpublic IPromise<T> then(Runnable result)
IPromisepublic IPromise<T> thenAnd(java.util.function.Supplier<IPromise<T>> result)
IPromisepublic IPromise then(Callback<T> result)
IPromisepublic IPromise<T> onResult(java.util.function.Consumer<T> resultHandler)
IPromisepublic IPromise<T> onError(java.util.function.Consumer errorHandler)
IPromisepublic IPromise<T> onTimeout(java.util.function.Consumer timeoutHandler)
IPromisepublic <OUT> IPromise<OUT> thenAnd(java.util.function.Function<T,IPromise<OUT>> function)
IPromisepublic <OUT> IPromise<OUT> then(java.util.function.Consumer<T> function)
IPromisepublic <OUT> IPromise<OUT> catchError(java.util.function.Function<Object,IPromise<OUT>> function)
IPromisecatchError in interface IPromise<T>public <OUT> IPromise<OUT> catchError(java.util.function.Consumer<Object> function)
IPromisecatchError in interface IPromise<T>public T get()
IPromisepublic T await(long timeout)
IPromisepublic IPromise<T> awaitPromise(long timeout)
IPromiseawaitPromise in interface IPromise<T>public Object getError()
public IPromise timeoutIn(long millis)
IPromiseCopyright © 2015. All rights reserved.