Class DurableSchedules

java.lang.Object
org.j7m.middleware.application.distributed.DurableSchedules
All Implemented Interfaces:
AutoCloseable

public final class DurableSchedules extends Object implements AutoCloseable
Durable one-occurrence trigger engine with no threads or idle polling. A known next due time drives a host timer. Atomic CAS records pending before submission; only confirmed stable submit advances the cursor. A crash between stores replays the same planned UTC identity.
  • Constructor Details

    • DurableSchedules

      public DurableSchedules(ManagedScheduleProfile profile, String definitionKey, String semanticFingerprint, boolean serial, DurableSchedules.Submitter submitter)
      Creates a trigger without starting I/O or application work.
      Parameters:
      profile - trusted immutable settings
      definitionKey - stable namespace/job/version identity, unchanged across artifact replacements
      semanticFingerprint - canonical program and input fingerprint, SHA256 lowercase hex
      serial - whether the target job profile enforces native serial claims
      submitter - trusted captured-frame bridge to the managed job client
      Throws:
      NullPointerException - for missing collaborators
      IllegalArgumentException - for invalid identity, fingerprint or contradictory overlap
  • Method Details

    • prepare

      public void prepare(Instant deadline) throws IOException
      Registers or verifies the immutable definition and initial cursor using quorum CAS.
      Parameters:
      deadline - original absolute I/O deadline
      Throws:
      IOException - on unavailable or ambiguous metadata operations
      IllegalArgumentException - if a different definition already owns this identity
      IllegalStateException - after close or on unsupported native metadata responses
    • tick

      public DurableSchedules.Tick tick(Instant deadline) throws IOException
      Advances at most one confirmed planned occurrence. Pending work is always recovered before applying misfire policy; it is never discarded merely because the scheduler restarted late. Calls before cached next due perform no metadata RPC. Unsafe time fails before any mutation.
      Parameters:
      deadline - original absolute I/O and submit deadline, never refreshed inside the engine
      Returns:
      known next timer and bounded status
      Throws:
      IOException - for unsafe time, unavailable stores, contention or uncertain submission
      IllegalArgumentException - for incompatible/corrupt persisted metadata
      IllegalStateException - before preparation, after close or for rejected submission
    • close

      public void close()
      Stops future engine operations without I/O or closing borrowed metadata/backend resources.
      Specified by:
      close in interface AutoCloseable
    • toString

      public String toString()
      Omits definition identity, input and capabilities.
      Overrides:
      toString in class Object
      Returns:
      fixed safe label