Package com.zeroc.Ice
Class InvocationFuture<T>
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
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract boolean
cancel()
If not completed, cancels the request.abstract Communicator
Returns the communicator that sent the invocation.abstract Connection
Returns the connection that was used to start the invocation, or nil if this future was not obtained via an asynchronous connection invocation (such asflushBatchRequestsAsync
).abstract String
Returns the name of the operation.abstract ObjectPrx
getProxy()
Returns the proxy that was used to start the asynchronous invocation, or nil if this object was not obtained via an asynchronous proxy invocation.abstract boolean
isSent()
When you start an asynchronous invocation, the Ice run time attempts to write the corresponding request to the client-side transport.abstract boolean
Returns true if a request was written to the client-side transport without first being queued.abstract void
Blocks the caller until the result of the invocation is available.abstract void
Blocks the caller until the request has been written to the client-side transport.abstract 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.abstract 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.abstract 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, cancel, 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
-
Constructor Details
-
InvocationFuture
public InvocationFuture()
-
-
Method Details
-
cancel
public abstract boolean cancel()If not completed, cancels the request. This is a local operation, it won't cancel the request on the server side. Callingcancel
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.
-
getCommunicator
Returns the communicator that sent the invocation.- Returns:
- The communicator.
-
getConnection
Returns the connection that was used to start the invocation, or nil if this future was not obtained via an asynchronous connection invocation (such asflushBatchRequestsAsync
).- Returns:
- The connection.
-
getProxy
Returns the proxy that was used to start the asynchronous invocation, or nil 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 abstract void waitForCompleted()Blocks the caller until the result of the invocation is available. -
isSent
public abstract 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 abstract void waitForSent()Blocks the caller until the request has been written to the client-side transport. -
sentSynchronously
public abstract 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
public abstract 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. 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 abstract 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 exceptionally.executor
- The executor to use for asynchronous execution.- Returns:
- A future that completes when the message has been handed off to the transport.
-