Class NotifyingFutureTask
java.lang.Object
java.util.concurrent.FutureTask<Void>
org.apache.jackrabbit.oak.commons.concurrent.NotifyingFutureTask
- All Implemented Interfaces:
Runnable,Future<Void>,RunnableFuture<Void>
A
Future 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
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.concurrent.Future
Future.State -
Constructor Summary
ConstructorsConstructorDescriptionNotifyingFutureTask(Runnable task) NotifyingFutureTask(Callable<Void> callable) -
Method Summary
Modifier and TypeMethodDescriptionstatic NotifyingFutureTaskvoidonComplete(Runnable onComplete) Set the on complete handler.Methods inherited from class java.util.concurrent.FutureTask
cancel, exceptionNow, get, get, isCancelled, isDone, resultNow, run, state, toString
-
Constructor Details
-
NotifyingFutureTask
-
NotifyingFutureTask
-
-
Method Details
-
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
-