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>

public abstract class InvocationFuture<T> extends CompletableFuture<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.
  • 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.
      Specified by:
      cancel in interface Future<T>
      Overrides:
      cancel in class CompletableFuture<T>
      Parameters:
      mayInterruptIfRunning - true if the thread executing this task should be interrupted; otherwise, in-progress tasks are allowed to complete
      Returns:
      true if this task is now cancelled
    • getCommunicator

      public Communicator getCommunicator()
      Returns the communicator that sent the invocation.
      Returns:
      the communicator
    • getConnection

      public Connection 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

      public ObjectPrx 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

      public final String 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

      public 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. 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)
      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 exceptionally
      executor - 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.