Record Class ScheduleConfig<T>

java.lang.Object
java.lang.Record
eu.rarogsoftware.rarog.platform.api.task.ScheduleConfig<T>
Record Components:
initialDelay - time from now to delay execution
period - repeat period aka next execution start is calculated since previous execution start time. It's mutually exclusive with repeatAfter.
repeatAfter - wait duration before next execution aka next execution start is calculated since previous execution end time. It's mutually exclusive with period. -1 for unlimited
repeatCount - defines how many repeat task should do before it removes itself from queue
executionCondition - Predicate for running task. if condition is false repeat counter will not increase. This condition is executed before task is ran.
cancelCondition - Predicate for cancelling task after running it. If predicate returns true, then task will be cancelled

public record ScheduleConfig<T>(Duration initialDelay, Duration period, Duration repeatAfter, int repeatCount, Predicate<ExecutionInfo<T>> executionCondition, Predicate<ExecutionInfo<T>> cancelCondition) extends Record
Configuration for TaskManager scheduled tasks
  • Constructor Details

  • Method Details

    • builder

      public static <T> SchedulerConfigBuilder<T> builder()
    • builder

      public static <T> SchedulerConfigBuilder<T> builder(Class<T> ignoredBuilderType)
    • isPeriodic

      public boolean isPeriodic()
    • 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.
    • initialDelay

      public Duration initialDelay()
      Returns the value of the initialDelay record component.
      Returns:
      the value of the initialDelay record component
    • period

      public Duration period()
      Returns the value of the period record component.
      Returns:
      the value of the period record component
    • repeatAfter

      public Duration repeatAfter()
      Returns the value of the repeatAfter record component.
      Returns:
      the value of the repeatAfter record component
    • repeatCount

      public int repeatCount()
      Returns the value of the repeatCount record component.
      Returns:
      the value of the repeatCount record component
    • executionCondition

      public Predicate<ExecutionInfo<T>> executionCondition()
      Returns the value of the executionCondition record component.
      Returns:
      the value of the executionCondition record component
    • cancelCondition

      public Predicate<ExecutionInfo<T>> cancelCondition()
      Returns the value of the cancelCondition record component.
      Returns:
      the value of the cancelCondition record component