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 Details

    • TERMINATE_JVM_ON_LOCK_CONFLICT

      public static final Runnable TERMINATE_JVM_ON_LOCK_CONFLICT
  • Constructor Details

  • Method Details

    • start

      public void start()
      Specified by:
      start in interface org.springframework.context.Lifecycle
    • stop

      public void stop()
      Specified by:
      stop in interface org.springframework.context.Lifecycle
    • stop

      public void stop(Runnable callback)
      Specified by:
      stop in interface org.springframework.context.SmartLifecycle
    • destroy

      public void destroy()
      Shuts down the executor permanently. Called by Spring on context close via destroyMethod.
    • isRunning

      public boolean isRunning()
      Specified by:
      isRunning in interface org.springframework.context.Lifecycle
    • isAutoStartup

      public boolean isAutoStartup()
      Specified by:
      isAutoStartup in interface org.springframework.context.SmartLifecycle
    • getPhase

      public int getPhase()
      Specified by:
      getPhase in interface org.springframework.context.Phased
      Specified by:
      getPhase in interface org.springframework.context.SmartLifecycle