Class SchedulerConfigBuilder<T>
java.lang.Object
eu.rarogsoftware.rarog.platform.api.task.SchedulerConfigBuilder<T>
Convenient builder for
ScheduleConfig
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Build new instance of configcancelCondition
(Predicate<ExecutionInfo<T>> cancelCondition) Condition for cancelling task after execution.executionCondition
(Predicate<ExecutionInfo<T>> executionCondition) Condition for executing task.initialDelay
(Duration initialDelay) Initial delay for running scheduled task.Set how often task should repeat.repeatAfter
(Duration repeatAfter) Set delay for next execution.repeatCount
(int repeatCount) Set count of repeats for task.Task will repeat until cancelled.
-
Constructor Details
-
SchedulerConfigBuilder
public SchedulerConfigBuilder()
-
-
Method Details
-
initialDelay
Initial delay for running scheduled task. If zero then start as soon as possible. Default:Duration.ZERO
- Parameters:
initialDelay
- initial delay duration- Returns:
- this builder
-
period
Set how often task should repeat. If zero together withrepeatAfter
then do not repeat task. Default:Duration.ZERO
. It's mutually exclusive withrepeatAfter
. The last set is final.- Parameters:
period
- task period- Returns:
- this builder
-
repeatAfter
Set delay for next execution. If zero together withperiod
then do not repeat task. Default:Duration.ZERO
. It's mutually exclusive withperiod
. The last set is final.- Parameters:
repeatAfter
- task delay for next repeat- Returns:
- this builder
-
repeatCount
Set count of repeats for task. Task will execute specified amount if not cancelled earlier.- Parameters:
repeatCount
- number of task repeats- Returns:
- this builder
-
unlimitedRepeats
Task will repeat until cancelled.- Returns:
- this builder
-
executionCondition
Condition for executing task. If condition returns false then task is not executed and repeat count is not increased. If not set, task will execute each time when it is scheduled.- Parameters:
executionCondition
- execution condition predicate- Returns:
- this builder
-
cancelCondition
Condition for cancelling task after execution. If not set then task will not automatically cancel itself.- Parameters:
cancelCondition
- cancel condition predicate- Returns:
- this builder
-
build
Build new instance of config- Returns:
- fully build
ScheduleConfig
-