V - public static class ExecutionService.DistributedFuture<V> extends java.lang.Object implements java.util.concurrent.RunnableFuture<V>, ExecutorNotification, NotifyingFuture<V>
| 限定符和类型 | 类和说明 |
|---|---|
protected static class |
ExecutionService.DistributedFuture.Sync<V>
Synchronization control for FutureTask.
|
| 限定符和类型 | 字段和说明 |
|---|---|
protected ExecutionService.DistributedFuture.Sync<V> |
sync
Synchronization control for FutureTask
|
| 构造器和说明 |
|---|
ExecutionService.DistributedFuture(JChannel channel,
java.util.concurrent.locks.Lock unfinishedLock,
java.util.concurrent.locks.Condition condition,
java.util.Set<java.util.concurrent.Future<?>> futuresToFinish,
java.util.concurrent.Callable<V> callable)
Creates a FutureTask that will upon running, execute the
given Callable.
|
ExecutionService.DistributedFuture(JChannel channel,
java.util.concurrent.locks.Lock unfinishedLock,
java.util.concurrent.locks.Condition condition,
java.util.Set<java.util.concurrent.Future<?>> futuresToFinish,
java.lang.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.
|
| 限定符和类型 | 方法和说明 |
|---|---|
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,
java.util.concurrent.TimeUnit unit) |
java.util.concurrent.Callable<V> |
getCallable() |
void |
interrupted(java.lang.Runnable runnable) |
boolean |
isCancelled() |
boolean |
isDone() |
void |
resultReturned(java.lang.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(java.lang.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(java.lang.Throwable t) |
java.lang.String |
toString() |
protected final ExecutionService.DistributedFuture.Sync<V> sync
public ExecutionService.DistributedFuture(JChannel channel, java.util.concurrent.locks.Lock unfinishedLock, java.util.concurrent.locks.Condition condition, java.util.Set<java.util.concurrent.Future<?>> futuresToFinish, java.util.concurrent.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, java.util.concurrent.locks.Lock unfinishedLock, java.util.concurrent.locks.Condition condition, java.util.Set<java.util.concurrent.Future<?>> futuresToFinish, java.lang.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)java.lang.NullPointerException - if runnable is nullpublic java.lang.String toString()
toString 在类中 java.lang.Objectpublic java.util.concurrent.Callable<V> getCallable()
public boolean isCancelled()
isCancelled 在接口中 java.util.concurrent.Future<V>public boolean isDone()
isDone 在接口中 java.util.concurrent.Future<V>public boolean cancel(boolean mayInterruptIfRunning)
cancel 在接口中 java.util.concurrent.Future<V>public V get() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
get 在接口中 java.util.concurrent.Future<V>java.util.concurrent.CancellationExceptionjava.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionpublic V get(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
get 在接口中 java.util.concurrent.Future<V>java.util.concurrent.CancellationExceptionjava.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionjava.util.concurrent.TimeoutExceptionprotected void done()
public NotifyingFuture<V> setListener(FutureListener<V> listener)
NotifyingFuturesetListener 在接口中 NotifyingFuture<V>listener - listener to attachprotected void set(V v)
v - the valueprotected void setException(java.lang.Throwable t)
t - the cause of failurepublic void run()
run 在接口中 java.lang.Runnablerun 在接口中 java.util.concurrent.RunnableFuture<V>public void resultReturned(java.lang.Object obj)
resultReturned 在接口中 ExecutorNotificationpublic void throwableEncountered(java.lang.Throwable t)
throwableEncountered 在接口中 ExecutorNotificationpublic void interrupted(java.lang.Runnable runnable)
interrupted 在接口中 ExecutorNotification