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(Consumer<Object> function)
called if an error has been signaled by one of the futures in the previous future chain.
|
<OUT> IPromise<OUT> |
catchError(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() |
Callback<T> |
getRealCallback() |
boolean |
isRemote() |
boolean |
isRouted() |
boolean |
isSettled() |
boolean |
isTerminated()
relevant for remoted callback's
|
IPromise<T> |
onError(Consumer errorHandler)
called when an error is set as the result
forwards to (new) "catchError" variant.
|
IPromise<T> |
onResult(Consumer<T> resultHandler)
Warning: this will not be called on error or timeout
|
IPromise<T> |
onTimeout(Consumer timeoutHandler)
called when the async call times out.
|
IPromise |
then(Callback<T> result)
Warning: this will not be called on error or timeout
|
<OUT> IPromise<OUT> |
then(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)
Warning: this will not be called on error or timeout
|
<OUT> IPromise<OUT> |
thenAnd(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(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)
tellMsg 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 boolean isRouted()
public void complete(T result, Object error)
Callbackpublic IPromise<T> thenAnd(Supplier<IPromise<T>> result)
IPromisepublic IPromise<T> onResult(Consumer<T> resultHandler)
public IPromise<T> onError(Consumer errorHandler)
IPromisepublic IPromise<T> onTimeout(Consumer timeoutHandler)
IPromisepublic <OUT> IPromise<OUT> thenAnd(Function<T,IPromise<OUT>> function)
IPromisepublic <OUT> IPromise<OUT> then(Consumer<T> function)
IPromisepublic <OUT> IPromise<OUT> catchError(Function<Object,IPromise<OUT>> function)
IPromisecatchError in interface IPromise<T>public <OUT> IPromise<OUT> catchError(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)
IPromisepublic boolean isSettled()
public boolean isRemote()
public boolean isTerminated()
CallbackisTerminated in interface Callback<T>Copyright © 2020. All rights reserved.