Interface CoordinationStrategy
public interface CoordinationStrategy
The strategy for coordinating between threads of a single-node application,
or between nodes of a distributed application.
Advanced implementations may involve an external system to store and asynchronously consume indexing events, ultimately routing them back to Hibernate Search's in-JVM indexing plans.
-
Method Summary
Modifier and TypeMethodDescriptionvoidConfigures coordination.Creates aPojoMassIndexerAgent, able to exert control over other agents that could perform indexing concurrently (e.g.Prepares forstop(), executing any operations that need to be executed before shutdown.start(CoordinationStrategyStartContext context) Configures this strategy and starts processing events in the background.voidstop()Stops and releases all resources.
-
Method Details
-
configure
Configures coordination.Called once during bootstrap, before anything (mapper, backends, index managers) is started.
- Parameters:
context- The configuration context.
-
start
Configures this strategy and starts processing events in the background.Called once during bootstrap, after
configure(CoordinationConfigurationContext).- Parameters:
context- The start context.- Returns:
- A future that completes when the strategy is completely started.
-
createMassIndexerAgent
Creates aPojoMassIndexerAgent, able to exert control over other agents that could perform indexing concurrently (e.g. background processing of entity change events with outbox-polling coordination strategy).- Parameters:
context- A context with information about the mass indexing that is about to start.- Returns:
- An agent.
-
completion
CompletableFuture<?> completion()- Returns:
- A future that completes when all works submitted to background executors so far are completely executed. Works submitted to the executors after entering this method may delay the wait.
-
preStop
Prepares forstop(), executing any operations that need to be executed before shutdown.Called once on shutdown, before backends and index managers are stopped.
- Parameters:
context- The pre-stop context.- Returns:
- A future that completes when pre-stop operations complete.
-
stop
void stop()Stops and releases all resources.Called once on shutdown, after the future returned by
preStop(CoordinationStrategyPreStopContext)completed.
-