java.lang.Object
java.util.concurrent.CompletableFuture<T>
com.zeroc.Ice.InvocationFuture<T>
- All Implemented Interfaces:
CompletionStage<T>
,Future<T>
An instance of an InvocationFuture subclass is the return value of an asynchronous invocation.
With this object, an application can obtain several attributes of the invocation.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.concurrent.CompletableFuture
CompletableFuture.AsynchronousCompletionTask
-
Method Summary
Modifier and TypeMethodDescriptionboolean
cancel()
If not completed, cancels the request.boolean
cancel
(boolean mayInterruptIfRunning) If not completed, cancels the request.void
cancelable
(com.zeroc.Ice.CancellationHandler handler) Sets a cancellation handler for this invocation.Returns the communicator that sent the invocation.Returns the connection that was used to start the invocation, or null if this future was not obtained via an asynchronous connection invocation (such as flushBatchRequestsAsync).final String
Returns the name of the operation.getProxy()
Returns the proxy that was used to start the asynchronous invocation, or null if this object was not obtained via an asynchronous proxy invocation.final void
Invokes the completion callback to notify that the invocation has completed.final void
Invokes the completion callback asynchronously.final void
Invokes the sent callback to notify that the request has been sent.final void
Invokes the sent callback asynchronously.final boolean
isSent()
When you start an asynchronous invocation, the Ice run time attempts to write the corresponding request to the client-side transport.final boolean
Returns true if a request was written to the client-side transport without first being queued.final void
Blocks the caller until the result of the invocation is available.final void
Blocks the caller until the request has been written to the client-side transport.final CompletableFuture<Boolean>
whenSent
(BiConsumer<Boolean, ? super Throwable> action) Returns a future that completes when the entire request message has been accepted by the transport and executes the given action.final CompletableFuture<Boolean>
whenSentAsync
(BiConsumer<Boolean, ? super Throwable> action) Returns a future that completes when the entire request message has been accepted by the transport and executes the given action using the default executor.final CompletableFuture<Boolean>
whenSentAsync
(BiConsumer<Boolean, ? super Throwable> action, Executor executor) Returns a future that completes when the entire request message has been accepted by the transport and executes the given action using the executor.Methods inherited from class java.util.concurrent.CompletableFuture
acceptEither, acceptEitherAsync, acceptEitherAsync, allOf, anyOf, applyToEither, applyToEitherAsync, applyToEitherAsync, complete, completeAsync, completeAsync, completedFuture, completedStage, completeExceptionally, completeOnTimeout, copy, defaultExecutor, delayedExecutor, delayedExecutor, exceptionally, exceptionallyAsync, exceptionallyAsync, exceptionallyCompose, exceptionallyComposeAsync, exceptionallyComposeAsync, failedFuture, failedStage, get, get, getNow, getNumberOfDependents, handle, handleAsync, handleAsync, isCancelled, isCompletedExceptionally, isDone, join, minimalCompletionStage, newIncompleteFuture, obtrudeException, obtrudeValue, orTimeout, runAfterBoth, runAfterBothAsync, runAfterBothAsync, runAfterEither, runAfterEitherAsync, runAfterEitherAsync, runAsync, runAsync, supplyAsync, supplyAsync, thenAccept, thenAcceptAsync, thenAcceptAsync, thenAcceptBoth, thenAcceptBothAsync, thenAcceptBothAsync, thenApply, thenApplyAsync, thenApplyAsync, thenCombine, thenCombineAsync, thenCombineAsync, thenCompose, thenComposeAsync, thenComposeAsync, thenRun, thenRunAsync, thenRunAsync, toCompletableFuture, toString, whenComplete, whenCompleteAsync, whenCompleteAsync
-
Method Details
-
cancel
public boolean cancel()If not completed, cancels the request. This is a local operation, it won't cancel the request on the server side. Calling cancel prevents a queued request from being sent or ignores a reply if the request has already been sent.- Returns:
- true if this task is now cancelled
-
cancel
public boolean cancel(boolean mayInterruptIfRunning) If not completed, cancels the request. This is a local operation, it won't cancel the request on the server side. Calling cancel prevents a queued request from being sent or ignores a reply if the request has already been sent. -
getCommunicator
Returns the communicator that sent the invocation.- Returns:
- the communicator
-
getConnection
Returns the connection that was used to start the invocation, or null if this future was not obtained via an asynchronous connection invocation (such as flushBatchRequestsAsync).- Returns:
- the connection
-
getProxy
Returns the proxy that was used to start the asynchronous invocation, or null if this object was not obtained via an asynchronous proxy invocation.- Returns:
- the proxy
-
getOperation
Returns the name of the operation.- Returns:
- the operation name
-
waitForCompleted
public final void waitForCompleted()Blocks the caller until the result of the invocation is available. -
isSent
public final boolean isSent()When you start an asynchronous invocation, the Ice run time attempts to write the corresponding request to the client-side transport. If the transport cannot accept the request, the Ice run time queues the request for later transmission. This method returns true if, at the time it is called, the request has been written to the local transport (whether it was initially queued or not). Otherwise, if the request is still queued, this method returns false.- Returns:
- true if the request has been sent, or false if the request is queued
-
waitForSent
public final void waitForSent()Blocks the caller until the request has been written to the client-side transport. -
sentSynchronously
public final boolean sentSynchronously()Returns true if a request was written to the client-side transport without first being queued. If the request was initially queued, this method returns false (independent of whether the request is still in the queue or has since been written to the client-side transport).- Returns:
- true if the request was sent without being queued, or false otherwise
-
whenSent
Returns a future that completes when the entire request message has been accepted by the transport and executes the given action. The boolean value indicates whether the message was sent synchronously.- Parameters:
action
- executed when the future is completed successfully or exceptionally- Returns:
- a future that completes when the message has been handed off to the transport
-
whenSentAsync
Returns a future that completes when the entire request message has been accepted by the transport and executes the given action using the default executor. The boolean value indicates whether the message was sent synchronously.- Parameters:
action
- executed when the future is completed successfully or exceptionally- Returns:
- a future that completes when the message has been handed off to the transport
-
whenSentAsync
public final CompletableFuture<Boolean> whenSentAsync(BiConsumer<Boolean, ? super Throwable> action, Executor executor) Returns a future that completes when the entire request message has been accepted by the transport and executes the given action using the executor. The boolean value indicates whether the message was sent synchronously.- Parameters:
action
- executed when the future is completed successfully or exceptionallyexecutor
- the executor to use for asynchronous execution- Returns:
- a future that completes when the message has been handed off to the transport
-
invokeSent
public final void invokeSent()Invokes the sent callback to notify that the request has been sent. -
invokeCompleted
public final void invokeCompleted()Invokes the completion callback to notify that the invocation has completed. -
invokeCompletedAsync
public final void invokeCompletedAsync()Invokes the completion callback asynchronously. -
cancelable
public void cancelable(com.zeroc.Ice.CancellationHandler handler) Sets a cancellation handler for this invocation.- Parameters:
handler
- the cancellation handler
-
invokeSentAsync
public final void invokeSentAsync()Invokes the sent callback asynchronously.
-