Class AbstractWorkOrchestrator<W>

java.lang.Object
org.hibernate.search.engine.backend.orchestration.spi.AbstractWorkOrchestrator<W>
Type Parameters:
W - The type of batched works.

public abstract class AbstractWorkOrchestrator<W> extends Object
An abstract base for orchestrator implementations, implementing a thread-safe shutdown.
  • Constructor Details

    • AbstractWorkOrchestrator

      protected AbstractWorkOrchestrator(String name)
  • Method Details

    • name

      protected final String name()
    • start

      public final void start(ConfigurationPropertySource propertySource)
      Start any resource necessary to operate the orchestrator at runtime.

      Called by the owner of this orchestrator once after bootstrap, before any other method is called.

      Parameters:
      propertySource - The property source to extract configuration from.
    • preStop

      public final CompletableFuture<?> preStop()
      Stop accepting works and return a future that completes when all works have been completely executed.

      Optionally called by the owner of this orchestrator before stop(), if it needs to wait for work completion.

      Returns:
      A future that completes when all ongoing works have been completely executed.
    • stop

      public final void stop()
      Forcibly shut down ongoing work and release any resource necessary to operate the orchestrator at runtime.

      Called by the owner of this orchestrator on shutdown.

    • doStart

      protected abstract void doStart(ConfigurationPropertySource propertySource)
    • doSubmit

      protected abstract void doSubmit(W work) throws InterruptedException
      Throws:
      InterruptedException
    • completion

      protected abstract CompletableFuture<?> completion()
    • doStop

      protected abstract void doStop()
    • submit

      public final void submit(W work)