Class EventDrivenRemoteFuture<T>

java.lang.Object
org.openspaces.remoting.EventDrivenRemoteFuture<T>
All Implemented Interfaces:
Future<T>

public class EventDrivenRemoteFuture<T> extends Object implements Future<T>
A Space remoting future implementation.
Author:
kimchy
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    cancel(boolean mayInterruptIfRunning)
    Attempts to cancel execution of this task.
    get()
    Waits if necessary for the computation to complete, and then retrieves its result.
    get(long timeout, TimeUnit unit)
    Waits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available.
    boolean
    Returns true if this task was cancelled before it completed normally.
    boolean
    Returns true if this task completed.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • cancel

      public boolean cancel(boolean mayInterruptIfRunning)
      Attempts to cancel execution of this task. This attempt will fail if the task has already completed, already been cancelled, or could not be cancelled for some other reason. If successful, and this task has not started when cancel is called, this task should never run.
      Specified by:
      cancel in interface Future<T>
      Parameters:
      mayInterruptIfRunning - Has no affect when using Space Remoting
      Returns:
      false if the task could not be cancelled, typically because it has already completed normally; true otherwise
    • isCancelled

      public boolean isCancelled()
      Returns true if this task was cancelled before it completed normally.
      Specified by:
      isCancelled in interface Future<T>
      Returns:
      true if task was cancelled before it completed
    • isDone

      public boolean isDone()
      Returns true if this task completed.

      Completion may be due to normal termination, an exception, or cancellation -- in all of these cases, this method will return true.

      Specified by:
      isDone in interface Future<T>
      Returns:
      true if this task completed.
    • get

      Waits if necessary for the computation to complete, and then retrieves its result.
      Specified by:
      get in interface Future<T>
      Returns:
      the computed result
      Throws:
      CancellationException - if the computation was cancelled
      ExecutionException - if the computation threw an exception
      InterruptedException - if the current thread was interrupted while waiting
    • get

      public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
      Waits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available.
      Specified by:
      get in interface Future<T>
      Parameters:
      timeout - the maximum time to wait
      unit - the time unit of the timeout argument
      Returns:
      the computed result
      Throws:
      CancellationException - if the computation was cancelled
      ExecutionException - if the computation threw an exception
      InterruptedException - if the current thread was interrupted while waiting
      TimeoutException - if the wait timed out