...
CompletableFuture<Boolean> whenSent(BiConsumer<Boolean, ? super Throwable> action)
Configures an action to be executed when the request has been successfully written to the client-side transport. The arguments to the action are a boolean indicating whether the request was sent synchronously (seesentSynchronously
above) and aThrowable
. The exception argument will be null if the request was sent successfully. The returned stage is completed when the action returns. If the supplied action itself encounters an exception, then the returned stage exceptionally completes with this exception unless this stage also completed exceptionally. If the invocation is already sent at the timewhenSent
is called, the callback method is invoked recursively from the calling thread. Otherwise, the callback method is invoked by an Ice thread (or by a dispatcher if one is configured).
CompletableFuture<Boolean> whenSentAsync(BiConsumer<Boolean, ? super Throwable> action)
Behaves likewhenSent
except the given action is executed asynchronously using this stage's default asynchronous execution facility.
...
- Suppose you configure an action using
whenComplete
. If the future is already complete at the time you callwhenComplete
, the action will execute immediately in the calling thread. If the future is not yet complete when you callwhenComplete
, the action will eventually execute in an Ice thread pool thread. - Now suppose you configure an action using one of the
whenCompleteAsync
methods. Regardless of the thread in which Ice completes the future, your executor's implementation will determine the thread context in which the action is invoked. The Ice thread pool can be used as an executor; you can obtain the executor by calling theice_executor
proxy method and passing it towhenCompleteAsync
. With the Ice thread pool executor, the action is always queued to be executed by the Ice thread pool. If a dispatcher is configured, the action will be passed to the configured dispatcher by the Ice thread pool thread that dequeues it, otherwise the action will be executed by the Ice thread pool thread that dequeues it.
...