|
barchart-util-concurrent 2.0.16 / 2012-12-19T12:07:36.441-0600 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.barchart.util.concurrent.FutureNotifierBase<V,T>
V - The result typeT - The subclass being defined (for return value parameterization)public class FutureNotifierBase<V,T extends FutureCallback<V,T>>
An implementation of FutureCallback that does not do any actual computation, but just serves as a communication proxy between the executor and listeners. This is a base class suitable for subclassing to return the correct object type in succeed() and fail(). Ad-hoc notifiers can use the FutureNotifier subclass to avoid additional parameterization.
| Constructor Summary | |
|---|---|
FutureNotifierBase()
Creates a FutureNotifier that notifies any callbacks upon completion. |
|
FutureNotifierBase(Thread runner)
Creates a FutureNotifier that notifies any callbacks upon completion. |
|
| Method Summary | |
|---|---|
T |
addResultListener(FutureListener<V> listener)
Register a listener for this deferred result. |
boolean |
cancel(boolean mayInterruptIfRunning)
|
protected void |
done()
Protected method invoked when this task transitions to state isDone (whether normally or via cancellation). |
T |
fail(Throwable error)
Notify listeners that an error occurred. |
V |
get()
|
V |
get(long timeout,
TimeUnit unit)
|
V |
getUnchecked()
Get the return value, or null if a checked exception was caught. |
boolean |
isCancelled()
|
boolean |
isDone()
|
void |
resultAvailable(Future<V> result)
Result listener for chaining callbacks together. |
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. |
T |
succeed(V result)
Notify listeners that a result is available. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FutureNotifierBase()
public FutureNotifierBase(Thread runner)
| Method Detail |
|---|
public boolean isCancelled()
isCancelled in interface Future<V>public boolean isDone()
isDone in interface Future<V>public boolean cancel(boolean mayInterruptIfRunning)
cancel in interface Future<V>
public V get()
throws InterruptedException,
ExecutionException
get in interface Future<V>CancellationException
InterruptedException
ExecutionExceptionpublic V getUnchecked()
FutureCallback
getUnchecked in interface FutureCallback<V,T extends FutureCallback<V,T>>
public V get(long timeout,
TimeUnit unit)
throws InterruptedException,
ExecutionException,
TimeoutException
get in interface Future<V>CancellationException
InterruptedException
ExecutionException
TimeoutExceptionpublic void resultAvailable(Future<V> result)
resultAvailable in interface FutureListener<V>protected void done()
protected void set(V v)
v - the valueprotected void setException(Throwable t)
t - the cause of failurepublic T addResultListener(FutureListener<V> listener)
FutureCallback
addResultListener in interface FutureCallback<V,T extends FutureCallback<V,T>>listener - The listener objectpublic T fail(Throwable error)
FutureCallbackreturn new FutureCallbackTask
fail in interface FutureCallback<V,T extends FutureCallback<V,T>>public T succeed(V result)
FutureCallbackreturn new FutureCallbackTask
succeed in interface FutureCallback<V,T extends FutureCallback<V,T>>
|
barchart-util-concurrent 2.0.16 / 2012-12-19T12:07:36.441-0600 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||