Record Class JobLease

java.lang.Object
java.lang.Record
com.kingsrook.qqq.backend.core.jobs.model.JobLease
Record Components:
chunkId - the leased chunk
jobId - its job
seq - the chunk's sequence in the job
attempt - the attempt number this lease runs (1 = first)
podId - the pod holding the lease
token - the fencing token
expiresAt - when the lease ends without a heartbeat (database clock)

public record JobLease(Integer chunkId, Integer jobId, Integer seq, Integer attempt, String podId, String token, Instant expiresAt) extends Record
A worker's lease on one chunk. Every chunk write (progress, checkpoint, completion) is fenced by the token: a writer whose lease was reclaimed fails.
  • Constructor Details

    • JobLease

      public JobLease(Integer chunkId, Integer jobId, Integer seq, Integer attempt, String podId, String token, Instant expiresAt)
      Creates an instance of a JobLease record class.
      Parameters:
      chunkId - the value for the chunkId record component
      jobId - the value for the jobId record component
      seq - the value for the seq record component
      attempt - the value for the attempt record component
      podId - the value for the podId record component
      token - the value for the token record component
      expiresAt - the value for the expiresAt record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • chunkId

      public Integer chunkId()
      Returns the value of the chunkId record component.
      Returns:
      the value of the chunkId record component
    • jobId

      public Integer jobId()
      Returns the value of the jobId record component.
      Returns:
      the value of the jobId record component
    • seq

      public Integer seq()
      Returns the value of the seq record component.
      Returns:
      the value of the seq record component
    • attempt

      public Integer attempt()
      Returns the value of the attempt record component.
      Returns:
      the value of the attempt record component
    • podId

      public String podId()
      Returns the value of the podId record component.
      Returns:
      the value of the podId record component
    • token

      public String token()
      Returns the value of the token record component.
      Returns:
      the value of the token record component
    • expiresAt

      public Instant expiresAt()
      Returns the value of the expiresAt record component.
      Returns:
      the value of the expiresAt record component