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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CompletableFuture<?>
completion()
void
configure(CoordinationConfigurationContext context)
Configures coordination.PojoMassIndexerAgent
createMassIndexerAgent(PojoMassIndexerAgentCreateContext context)
Creates aPojoMassIndexerAgent
, able to exert control over other agents that could perform indexing concurrently (e.g.CompletableFuture<?>
preStop(CoordinationStrategyPreStopContext context)
Prepares forstop()
, executing any operations that need to be executed before shutdown.CompletableFuture<?>
start(CoordinationStrategyStartContext context)
Configures this strategy and starts processing events in the background.void
stop()
Stops and releases all resources.
-
-
-
Method Detail
-
configure
void configure(CoordinationConfigurationContext context)
Configures coordination.Called once during bootstrap, before anything (mapper, backends, index managers) is started.
- Parameters:
context
- The configuration context.
-
start
CompletableFuture<?> start(CoordinationStrategyStartContext context)
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
PojoMassIndexerAgent createMassIndexerAgent(PojoMassIndexerAgentCreateContext context)
Creates aPojoMassIndexerAgent
, able to exert control over other agents that could perform indexing concurrently (e.g. automatic indexing).- 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
CompletableFuture<?> preStop(CoordinationStrategyPreStopContext context)
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.
-
-