Class Scheduling

java.lang.Object
io.helidon.scheduling.Scheduling

public final class Scheduling extends Object
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: