Record Class Status

java.lang.Object
java.lang.Record
se.diabol.jenkins.pipeline.model.Status
Record Components:
type - the state
timestamp - epoch milliseconds of the start (finished and running builds) or queue entry, 0 when unknown
duration - milliseconds of a finished build, 0 otherwise
estimatedDuration - estimated milliseconds of a running build, or -1

@ExportedBean(defaultVisibility=100) public record Status(StatusType type, long timestamp, long duration, long estimatedDuration) extends Record
The status of a task.

timestamp is when the build started (or was queued); duration is how long a finished build took; for a running build estimatedDuration is the job's estimate. Elapsed time and progress of a running build are derived from the clock while exporting, so a cached status stays correct without recomputation.

  • Constructor Details

    • Status

      public Status(StatusType type, long timestamp, long duration, long estimatedDuration)
      Creates an instance of a Status record class.
      Parameters:
      type - the value for the type record component
      timestamp - the value for the timestamp record component
      duration - the value for the duration record component
      estimatedDuration - the value for the estimatedDuration record component
  • Method Details

    • idle

      public static Status idle()
    • disabled

      public static Status disabled()
    • queued

      public static Status queued(long since)
    • running

      public static Status running(long started, long estimatedDuration)
    • pausedPendingInput

      public static Status pausedPendingInput(long started, long estimatedDuration)
    • finished

      public static Status finished(StatusType type, long started, long duration)
    • type

      @Exported(name="type") public StatusType type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • exportedTimestamp

      @Exported(name="timestamp") public Long exportedTimestamp()
      Epoch milliseconds of the last activity, or null when nothing happened yet.
    • exportedDuration

      @Exported(name="duration") public long exportedDuration()
      Duration of a finished build, or the time a running build has been going on, in milliseconds.
    • progress

      @Exported(name="progress") public Integer progress()
      Progress of a running build in percent, capped at 99 until it finishes; null when not running.
    • isFailed

      public boolean isFailed()
      Whether this status counts as a failure when sorting components.
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • timestamp

      public long timestamp()
      Returns the value of the timestamp record component.
      Returns:
      the value of the timestamp record component
    • duration

      public long duration()
      Returns the value of the duration record component.
      Returns:
      the value of the duration record component
    • estimatedDuration

      public long estimatedDuration()
      Returns the value of the estimatedDuration record component.
      Returns:
      the value of the estimatedDuration record component