Class DurableJobsRuntime

java.lang.Object
com.kingsrook.qqq.backend.core.jobs.runtime.DurableJobsRuntime

public class DurableJobsRuntime extends Object
The per-pod durable jobs runtime: worker threads that claim and run chunks, a heartbeat per running chunk (every ttl/3), the lease reaper (every pod, every reaperIntervalSeconds), stall detection, and graceful drain. Chunks run on this runtime's own bounded pool (workerThreads), never on AsyncJobManager's pool. workerThreads = 0 makes an API-only pod: it still reaps, but claims nothing.
DurableJobsRuntime.start(qInstance);   // at server start
 DurableJobsRuntime.stop(qInstance, Duration.ofSeconds(30));   // on SIGTERM
  • Method Details

    • start

      public static DurableJobsRuntime start(QInstance instance)
      Start the runtime for an instance (no-op if durable jobs are off or it is already running). Returns the runtime, or null when off.
    • stop

      public static void stop(QInstance instance, Duration drainTimeout)
      Stop an instance's runtime: stop claiming, let running chunks reach a safe point and release their leases (no attempt counted), wait up to the given time, then stop. Chunks still running after that are reclaimed by another pod when their lease expires.
    • get

      public static DurableJobsRuntime get(QInstance instance)
      The running runtime for an instance, or null.
    • setEffectFaultHook

      public static void setEffectFaultHook(EffectDispatcher.FaultHook hook)
      Test seam: a hook called around each effect delivery (fault injection). Set before start; production never sets it.
    • getPodId

      public String getPodId()
      Getter for podId
    • getStore

      public DurableJobStore getStore()
      Getter for store
    • getInlineJobTracker

      public InlineJobTracker getInlineJobTracker()
      Tracker for this pod.