GigaSpaces XAP 7.0 API

org.openspaces.remoting
Class EventDrivenRemoteFuture<T>

java.lang.Object
  extended by 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
EventDrivenRemoteFuture(GigaSpace gigaSpace, EventDrivenSpaceRemotingEntry remotingEntry)
           
 
Method Summary
 boolean cancel(boolean mayInterruptIfRunning)
          Attempts to cancel execution of this task.
 T get()
          Waits if necessary for the computation to complete, and then retrieves its result.
 T 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 isCancelled()
          Returns true if this task was cancelled before it completed normally.
 boolean isDone()
          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 Detail

EventDrivenRemoteFuture

public EventDrivenRemoteFuture(GigaSpace gigaSpace,
                               EventDrivenSpaceRemotingEntry remotingEntry)
Method Detail

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

public T get()
      throws InterruptedException,
             ExecutionException
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

GigaSpaces XAP 7.0 API

Copyright © GigaSpaces.