Class NotifyingFutureTask
- java.lang.Object
-
- java.util.concurrent.FutureTask<java.lang.Void>
-
- org.apache.jackrabbit.oak.commons.concurrent.NotifyingFutureTask
-
- All Implemented Interfaces:
java.lang.Runnable
,java.util.concurrent.Future<java.lang.Void>
,java.util.concurrent.RunnableFuture<java.lang.Void>
public class NotifyingFutureTask extends java.util.concurrent.FutureTask<java.lang.Void>
AFuture
that accepts completion listener. The listener is invoked once the future's computation is complete. If the computation has already completed when the listener is added, the listener will execute immediately.Listener is invoked synchronously on the same thread which is used to executed the Future
-
-
Constructor Summary
Constructors Constructor Description NotifyingFutureTask(java.lang.Runnable task)
NotifyingFutureTask(java.util.concurrent.Callable<java.lang.Void> callable)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static NotifyingFutureTask
completed()
void
onComplete(java.lang.Runnable onComplete)
Set the on complete handler.
-
-
-
Method Detail
-
onComplete
public void onComplete(java.lang.Runnable onComplete)
Set the on complete handler. The handler will run exactly once after the task terminated. If the task has already terminated at the time of this method call the handler will execute immediately.Note: there is no guarantee to which handler will run when the method is called multiple times with different arguments.
- Parameters:
onComplete
- listener to invoke upon completion
-
completed
public static NotifyingFutureTask completed()
-
-