Class Scheduling
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");
}
This class contains only the declarative scheduling annotations. Use
FixedRate.builder() and Cron.builder()
for imperative scheduling.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceMarks the method to be invoked periodically according to supplied cron expression.static @interfaceScheduled to be invoked periodically at fixed rate. -
Method Summary