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 executionperiod
- 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 unlimitedrepeatCount
- defines how many repeat task should do before it removes itself from queueexecutionCondition
- 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 Summary
ConstructorsConstructorDescriptionScheduleConfig
(Duration initialDelay, Duration period, Duration repeatAfter, int repeatCount, Predicate<ExecutionInfo<T>> executionCondition, Predicate<ExecutionInfo<T>> cancelCondition) Creates an instance of aScheduleConfig
record class. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> SchedulerConfigBuilder<T>
builder()
static <T> SchedulerConfigBuilder<T>
Returns the value of thecancelCondition
record component.final boolean
Indicates whether some other object is "equal to" this one.Returns the value of theexecutionCondition
record component.final int
hashCode()
Returns a hash code value for this object.Returns the value of theinitialDelay
record component.boolean
period()
Returns the value of theperiod
record component.Returns the value of therepeatAfter
record component.int
Returns the value of therepeatCount
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
ScheduleConfig
public ScheduleConfig(Duration initialDelay, Duration period, Duration repeatAfter, int repeatCount, Predicate<ExecutionInfo<T>> executionCondition, Predicate<ExecutionInfo<T>> cancelCondition) Creates an instance of aScheduleConfig
record class.- Parameters:
initialDelay
- the value for theinitialDelay
record componentperiod
- the value for theperiod
record componentrepeatAfter
- the value for therepeatAfter
record componentrepeatCount
- the value for therepeatCount
record componentexecutionCondition
- the value for theexecutionCondition
record componentcancelCondition
- the value for thecancelCondition
record component
-
-
Method Details
-
builder
-
builder
-
isPeriodic
public boolean isPeriodic() -
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. -
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. -
equals
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 withObjects::equals(Object,Object)
; primitive components are compared with '=='. -
initialDelay
Returns the value of theinitialDelay
record component.- Returns:
- the value of the
initialDelay
record component
-
period
Returns the value of theperiod
record component.- Returns:
- the value of the
period
record component
-
repeatAfter
Returns the value of therepeatAfter
record component.- Returns:
- the value of the
repeatAfter
record component
-
repeatCount
public int repeatCount()Returns the value of therepeatCount
record component.- Returns:
- the value of the
repeatCount
record component
-
executionCondition
Returns the value of theexecutionCondition
record component.- Returns:
- the value of the
executionCondition
record component
-
cancelCondition
Returns the value of thecancelCondition
record component.- Returns:
- the value of the
cancelCondition
record component
-