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 aScheduleConfigrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> SchedulerConfigBuilder<T>builder()static <T> SchedulerConfigBuilder<T>Returns the value of thecancelConditionrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of theexecutionConditionrecord component.final inthashCode()Returns a hash code value for this object.Returns the value of theinitialDelayrecord component.booleanperiod()Returns the value of theperiodrecord component.Returns the value of therepeatAfterrecord component.intReturns the value of therepeatCountrecord component.final StringtoString()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 aScheduleConfigrecord class.- Parameters:
initialDelay- the value for theinitialDelayrecord componentperiod- the value for theperiodrecord componentrepeatAfter- the value for therepeatAfterrecord componentrepeatCount- the value for therepeatCountrecord componentexecutionCondition- the value for theexecutionConditionrecord componentcancelCondition- the value for thecancelConditionrecord 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 theinitialDelayrecord component.- Returns:
- the value of the
initialDelayrecord component
-
period
Returns the value of theperiodrecord component.- Returns:
- the value of the
periodrecord component
-
repeatAfter
Returns the value of therepeatAfterrecord component.- Returns:
- the value of the
repeatAfterrecord component
-
repeatCount
public int repeatCount()Returns the value of therepeatCountrecord component.- Returns:
- the value of the
repeatCountrecord component
-
executionCondition
Returns the value of theexecutionConditionrecord component.- Returns:
- the value of the
executionConditionrecord component
-
cancelCondition
Returns the value of thecancelConditionrecord component.- Returns:
- the value of the
cancelConditionrecord component
-