V - public static class ExecutionService.DistributedFuture<V> extends Object implements RunnableFuture<V>, ExecutorNotification, NotifyingFuture<V>
| Modifier and Type | Class and Description |
|---|---|
protected static class |
ExecutionService.DistributedFuture.Sync<V>
Synchronization control for FutureTask.
|
| Modifier and Type | Field and Description |
|---|---|
protected ExecutionService.DistributedFuture.Sync<V> |
sync
Synchronization control for FutureTask
|
| Constructor and Description |
|---|
ExecutionService.DistributedFuture(JChannel channel,
Lock unfinishedLock,
Condition condition,
Set<Future<?>> futuresToFinish,
Callable<V> callable)
Creates a FutureTask that will upon running, execute the
given Callable.
|
ExecutionService.DistributedFuture(JChannel channel,
Lock unfinishedLock,
Condition condition,
Set<Future<?>> futuresToFinish,
Runnable runnable,
V result)
Creates a FutureTask that will upon running, execute the
given Runnable, and arrange that get will return the
given result on successful completion.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
cancel(boolean mayInterruptIfRunning) |
protected void |
done()
Protected method invoked when this task transitions to state
isDone (whether normally or via cancellation).
|
V |
get() |
V |
get(long timeout,
TimeUnit unit) |
Callable<V> |
getCallable() |
void |
interrupted(Runnable runnable) |
boolean |
isCancelled() |
boolean |
isDone() |
void |
resultReturned(Object obj) |
void |
run()
Sets this Future to the result of its computation
unless it has been cancelled.
|
protected void |
set(V v)
Sets the result of this Future to the given value unless
this future has already been set or has been cancelled.
|
protected void |
setException(Throwable t)
Causes this future to report an ExecutionException
with the given throwable as its cause, unless this Future has
already been set or has been cancelled.
|
NotifyingFuture<V> |
setListener(FutureListener<V> listener)
Attaches a listener and returns the same future instance, to allow for 'building' futures.
|
void |
throwableEncountered(Throwable t) |
String |
toString() |
protected final ExecutionService.DistributedFuture.Sync<V> sync
public ExecutionService.DistributedFuture(JChannel channel, Lock unfinishedLock, Condition condition, Set<Future<?>> futuresToFinish, Callable<V> callable)
channel - The channel that messages are sent downunfinishedLock - The lock which protects the futuresToFinish
set object.condition - The condition to signal when this future finishesfuturesToFinish - The set to remove this future from when
it is finished.callable - The callable to actually run on the server sidepublic ExecutionService.DistributedFuture(JChannel channel, Lock unfinishedLock, Condition condition, Set<Future<?>> futuresToFinish, Runnable runnable, V result)
channel - The channel that messages are sent downunfinishedLock - The lock which protects the futuresToFinish
set object.condition - The condition to signal when this future finishesfuturesToFinish - The set to remove this future from when
it is finished.runnable - the runnable taskresult - the result to return on successful completion. If
you don't need a particular result, consider using
constructions of the form:
Future<?> f = new FutureTask<Object>(runnable, null)NullPointerException - if runnable is nullpublic boolean isCancelled()
isCancelled in interface Future<V>public boolean cancel(boolean mayInterruptIfRunning)
public V get() throws InterruptedException, ExecutionException
get in interface Future<V>CancellationExceptionInterruptedExceptionExecutionExceptionpublic V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
get in interface Future<V>CancellationExceptionInterruptedExceptionExecutionExceptionTimeoutExceptionprotected void done()
public NotifyingFuture<V> setListener(FutureListener<V> listener)
NotifyingFuturesetListener in interface NotifyingFuture<V>listener - listener to attachprotected void set(V v)
v - the valueprotected void setException(Throwable t)
t - the cause of failurepublic void run()
run in interface Runnablerun in interface RunnableFuture<V>public void resultReturned(Object obj)
resultReturned in interface ExecutorNotificationpublic void throwableEncountered(Throwable t)
throwableEncountered in interface ExecutorNotificationpublic void interrupted(Runnable runnable)
interrupted in interface ExecutorNotificationCopyright © 2012 JBoss by Red Hat. All Rights Reserved.