public interface IPromise<T> extends Callback<T>
| Modifier and Type | Method and Description |
|---|---|
default T |
await()
schedule other events/messages until future is resolved/settled (Nonblocking wait).
|
T |
await(long timeoutMillis)
schedule other events/messages until future is resolved/settled (Nonblocking delay).
|
default IPromise<T> |
awaitPromise()
similar to await but does not unwrap the promise.
|
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.
|
T |
get()
Warning: this is different to JDK's BLOCKING future
|
Object |
getError() |
boolean |
isSettled() |
default IPromise<T> |
onError(Consumer<Object> errorHandler)
called when an error is set as the result
forwards to (new) "catchError" variant.
|
default IPromise<T> |
onResult(Consumer<T> resultHandler)
called when a valid result of a future becomes available.
|
IPromise<T> |
onTimeout(Consumer timeoutHandler)
called when the async call times out. see 'timeOutIn'
|
default IPromise<T> |
onTimeout(Runnable timeoutHandler) |
IPromise<T> |
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(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(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<T> |
timeoutIn(long millis)
tellMsg the future to call the onTimeout callback in N milliseconds if future is not settled until then
|
IPromise<T> then(Runnable result)
IPromise<T> then(Callback<T> result)
IPromise<T> thenAnd(Supplier<IPromise<T>> result)
<OUT> IPromise<OUT> thenAnd(Function<T,IPromise<OUT>> function)
<OUT> IPromise<OUT> then(Consumer<T> function)
<OUT> IPromise<OUT> catchError(Function<Object,IPromise<OUT>> function)
<OUT> IPromise<OUT> catchError(Consumer<Object> function)
default IPromise<T> onResult(Consumer<T> resultHandler)
default IPromise<T> onError(Consumer<Object> errorHandler)
IPromise<T> onTimeout(Consumer timeoutHandler)
timeoutHandler - T get()
default T await()
T await(long timeoutMillis)
IPromise<T> awaitPromise(long timeout)
timeout - default IPromise<T> awaitPromise()
Object getError()
IPromise<T> timeoutIn(long millis)
millis - boolean isSettled()
Copyright © 2019. All rights reserved.