Package org.openspaces.remoting
Class EventDrivenRemoteFuture<T>
java.lang.Object
org.openspaces.remoting.EventDrivenRemoteFuture<T>
- All Implemented Interfaces:
Future<T>
A Space remoting future implementation.
- Author:
- kimchy
-
Constructor Summary
ConstructorsConstructorDescriptionEventDrivenRemoteFuture(GigaSpace gigaSpace, SpaceRemotingEntry remotingEntry) -
Method Summary
Modifier and TypeMethodDescriptionbooleancancel(boolean mayInterruptIfRunning) Attempts to cancel execution of this task.get()Waits if necessary for the computation to complete, and then retrieves its result.Waits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available.booleanReturnstrueif this task was cancelled before it completed normally.booleanisDone()Returnstrueif this task completed.
-
Constructor Details
-
EventDrivenRemoteFuture
-
-
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 whencancelis called, this task should never run. -
isCancelled
public boolean isCancelled()Returnstrueif this task was cancelled before it completed normally.- Specified by:
isCancelledin interfaceFuture<T>- Returns:
trueif task was cancelled before it completed
-
isDone
public boolean isDone()Returnstrueif this task completed.Completion may be due to normal termination, an exception, or cancellation -- in all of these cases, this method will return
true. -
get
Waits if necessary for the computation to complete, and then retrieves its result.- Specified by:
getin interfaceFuture<T>- Returns:
- the computed result
- Throws:
CancellationException- if the computation was cancelledExecutionException- if the computation threw an exceptionInterruptedException- 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:
getin interfaceFuture<T>- Parameters:
timeout- the maximum time to waitunit- the time unit of the timeout argument- Returns:
- the computed result
- Throws:
CancellationException- if the computation was cancelledExecutionException- if the computation threw an exceptionInterruptedException- if the current thread was interrupted while waitingTimeoutException- if the wait timed out
-