Class ContinuousReindexingService
java.lang.Object
org.alfresco.elasticsearch.batchindexing.ContinuousReindexingService
- All Implemented Interfaces:
org.springframework.context.Lifecycle,org.springframework.context.Phased,org.springframework.context.SmartLifecycle
public class ContinuousReindexingService
extends Object
implements org.springframework.context.SmartLifecycle
Continuously polls the Alfresco DB for new/changed nodes and launches
reindexByDate Spring Batch jobs one at a time. Consecutive time windows intentionally overlap (controlled by the overlap property) to catch late DB writes, but job executions never run concurrently.
Uses ScheduledExecutorService.scheduleWithFixedDelay(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit) so the next tick only starts after the previous cycle completes plus the configured polling delay.
Consecutive failures trigger exponential backoff up to maxPollingInterval to avoid hammering a down ES/DB cluster.
-
Field Summary
FieldsFields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
ConstructorsConstructorDescriptionContinuousReindexingService(org.springframework.batch.core.launch.JobLauncher jobLauncher, org.springframework.batch.core.job.Job reindexByDateJob, ElasticsearchWatermarkStore watermarkStore, ContinuousReindexingProperties properties, Runnable terminationAction) -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.SmartLifecycle
isPauseable
-
Field Details
-
TERMINATE_JVM_ON_LOCK_CONFLICT
-
-
Constructor Details
-
ContinuousReindexingService
public ContinuousReindexingService(org.springframework.batch.core.launch.JobLauncher jobLauncher, org.springframework.batch.core.job.Job reindexByDateJob, ElasticsearchWatermarkStore watermarkStore, ContinuousReindexingProperties properties, Runnable terminationAction)
-
-
Method Details
-
start
public void start()- Specified by:
startin interfaceorg.springframework.context.Lifecycle
-
stop
public void stop()- Specified by:
stopin interfaceorg.springframework.context.Lifecycle
-
stop
- Specified by:
stopin interfaceorg.springframework.context.SmartLifecycle
-
destroy
public void destroy()Shuts down the executor permanently. Called by Spring on context close viadestroyMethod. -
isRunning
public boolean isRunning()- Specified by:
isRunningin interfaceorg.springframework.context.Lifecycle
-
isAutoStartup
public boolean isAutoStartup()- Specified by:
isAutoStartupin interfaceorg.springframework.context.SmartLifecycle
-
getPhase
public int getPhase()- Specified by:
getPhasein interfaceorg.springframework.context.Phased- Specified by:
getPhasein interfaceorg.springframework.context.SmartLifecycle
-