Class SingletonTask
java.lang.Object
org.hibernate.search.engine.backend.orchestration.spi.SingletonTask
A task that can be scheduled for a run and is guaranteed to never run concurrently,
regardless of the thread pool it's submitted to.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
static interface
-
Constructor Summary
ConstructorsConstructorDescriptionSingletonTask
(String name, SingletonTask.Worker worker, SingletonTask.Scheduler scheduler, FailureHandler failureHandler) -
Method Summary
-
Constructor Details
-
SingletonTask
public SingletonTask(String name, SingletonTask.Worker worker, SingletonTask.Scheduler scheduler, FailureHandler failureHandler)
-
-
Method Details
-
toString
-
ensureScheduled
public void ensureScheduled()Ensures the task will run in the future.- If the task is neither scheduled nor running, this schedules the task for execution.
- If the task is already scheduled but not running, this does nothing: the task remains scheduled.
- If the task is running: the task execution continues and will trigger re-scheduling when it finishes.
-
completion
- Returns:
- A future that completes when all works submitted to the executor so far are completely executed. Works submitted to the executor after entering this method may delay the wait.
-
stop
public void stop()Stop the task.Callers must call this as the very last method on this object; any concurrent call may lead to unpredictable results.
-