com.hammurapi.util.concurrent
Class NonBlockingNotifyingFutureTask<V>
java.lang.Object
java.util.concurrent.FutureTask<V>
com.hammurapi.util.concurrent.NonBlockingNotifyingFutureTask<V>
- Type Parameters:
V -
- All Implemented Interfaces:
- NotifyingFuture<V>, Runnable, Future<V>, RunnableFuture<V>
public class NonBlockingNotifyingFutureTask<V>
- extends FutureTask<V>
- implements NotifyingFuture<V>
Future task which cannot block in get() indefinitely. If it is not yet started,
the task gets executed in the caller thread.
- Author:
- Pavel Vlasov
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NonBlockingNotifyingFutureTask
public NonBlockingNotifyingFutureTask(Callable<V> callable,
TaskCounter taskCounter)
run
public void run()
- Specified by:
run in interface Runnable- Specified by:
run in interface RunnableFuture<V>- Overrides:
run in class FutureTask<V>
get
public V get()
throws InterruptedException,
ExecutionException
- Specified by:
get in interface Future<V>- Overrides:
get in class FutureTask<V>
- Throws:
InterruptedException
ExecutionException
addListener
public void addListener(CallableListener<V> listener)
- Description copied from interface:
NotifyingFuture
- Adds callable listener.
- Specified by:
addListener in interface NotifyingFuture<V>
removeListener
public void removeListener(CallableListener<V> listener)
- Description copied from interface:
NotifyingFuture
- Removes callable listener.
- Specified by:
removeListener in interface NotifyingFuture<V>