java.lang.Object
io.helidon.scheduling.Scheduling
Annotations for Scheduling.
Scheduling can be done in imperative style as follows:
Fixed Rate:
FixedRate.builder()
.interval(Duration.ofSeconds(2))
.task(inv -> System.out.println("Executed every 2 seconds"))
.build();
Cron expression:
Cron.builder()
.expression("0 45 9 ? * *")
.task(inv -> System.out.println("Executed every day at 9:45"))
.build()
The same can be achieved in a declarative style as follows:
Fixed Rate:
@Scheduling.FixedRate("PT2M")
void scheduledMethod() {
System.out.println("Executed every 2 seconds");
}
Cron expression:
@Scheduling.Cron("0 45 9 ? * *")
void scheduledMethod() {
System.out.println("Executed every day at 9:45");
}
All other methods and types in this class are now deprecated.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interface
Marks the method to be invoked periodically according to supplied cron expression.static final class
Deprecated, for removal: This API element is subject to removal in a future version.static @interface
Scheduled to be invoked periodically at fixed rate.static final class
Deprecated, for removal: This API element is subject to removal in a future version.useFixedRateConfig.Builder
instead -
Method Summary
Modifier and TypeMethodDescriptionstatic CronConfig.Builder
cron()
Deprecated, for removal: This API element is subject to removal in a future version.useCron.builder()
insteadstatic Scheduling.CronBuilder
Deprecated, for removal: This API element is subject to removal in a future version.useCron.builder()
insteadstatic FixedRateConfig.Builder
Deprecated, for removal: This API element is subject to removal in a future version.useFixedRate.builder()
insteadstatic Scheduling.FixedRateBuilder
Deprecated, for removal: This API element is subject to removal in a future version.useFixedRate.builder()
instead
-
Method Details
-
fixedRateBuilder
@Deprecated(since="4.0.2", forRemoval=true) public static Scheduling.FixedRateBuilder fixedRateBuilder()Deprecated, for removal: This API element is subject to removal in a future version.useFixedRate.builder()
insteadBuild a task executed periodically at a fixed rate.- Returns:
- this builder
-
fixedRate
Deprecated, for removal: This API element is subject to removal in a future version.useFixedRate.builder()
insteadBuild a task executed periodically at a fixed rate.- Returns:
- this builder
-
cronBuilder
Deprecated, for removal: This API element is subject to removal in a future version.useCron.builder()
insteadBuild a task executed periodically according to provided cron expression.- Returns:
- this builder
-
cron
Deprecated, for removal: This API element is subject to removal in a future version.useCron.builder()
insteadBuild a task executed periodically according to provided cron expression.- Returns:
- this builder
-
CronConfig.Builder
instead