|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jgroups.blocks.executor.ExecutionService.DistributedFuture<V>
V
- public static class ExecutionService.DistributedFuture<V>
This is basically a copy of the FutureTask in java.util.concurrent but added serializable to it. Also added in the NotifyingFuture so that the channel can update the future when the value is calculated.
Nested Class Summary | |
---|---|
protected static class |
ExecutionService.DistributedFuture.Sync<V>
Synchronization control for FutureTask. |
Field Summary | |
---|---|
protected ExecutionService.DistributedFuture.Sync<V> |
sync
Synchronization control for FutureTask |
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
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()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final ExecutionService.DistributedFuture.Sync<V> sync
Constructor Detail |
---|
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 nullMethod Detail |
---|
public java.lang.String toString()
toString
in class java.lang.Object
public java.util.concurrent.Callable<V> getCallable()
public boolean isCancelled()
isCancelled
in interface java.util.concurrent.Future<V>
public boolean isDone()
isDone
in interface java.util.concurrent.Future<V>
public boolean cancel(boolean mayInterruptIfRunning)
cancel
in interface java.util.concurrent.Future<V>
public V get() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
get
in interface java.util.concurrent.Future<V>
java.util.concurrent.CancellationException
java.lang.InterruptedException
java.util.concurrent.ExecutionException
public V get(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
get
in interface java.util.concurrent.Future<V>
java.util.concurrent.CancellationException
java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.util.concurrent.TimeoutException
protected void done()
public NotifyingFuture<V> setListener(FutureListener<V> listener)
NotifyingFuture
setListener
in interface NotifyingFuture<V>
listener
- listener to attach
protected void set(V v)
v
- the valueprotected void setException(java.lang.Throwable t)
t
- the cause of failurepublic void run()
run
in interface java.lang.Runnable
run
in interface java.util.concurrent.RunnableFuture<V>
public void resultReturned(java.lang.Object obj)
resultReturned
in interface ExecutorNotification
public void throwableEncountered(java.lang.Throwable t)
throwableEncountered
in interface ExecutorNotification
public void interrupted(java.lang.Runnable runnable)
interrupted
in interface ExecutorNotification
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |