Annotation Interface Scheduled


Define a Quartz Trigger. Using one of three expressions:
  • interval: like5s;delay=60s;repeat=*, delay and repeat are optional
  • cron: like 0/3 * * * * ?
  • property name: a property defined in .conf file which has one of two previous formats
Examples:

Run every 5 minutes, start immediately and repeat for ever:

 @Scheduled("5m")

 @Scheduled("5m; delay=0")

 @Scheduled("5m; delay=0; repeat=*")
 
Previous, expressions are identical.

Run every 1 hour with an initial delay of 15 minutes for 10 times

 @Scheduled("1h; delay=15m; repeat=10")
 

Fire at 12pm (noon) every day

 0 0 12 * * ?
 

Fire at 10:15am every day

 0 15 10 ? * *
 
Since:
0.5.0
Author:
edgar
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Expression can be one of these three options: Interval: 10s, 10secs, 10minutes, 1h, etc...
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Sometimes, when you have many Triggers (or few worker threads in your Quartz thread pool), Quartz may not have enough resources to immediately fire all of the Triggers that are scheduled to fire at the same time.
    int
    A misfire occurs if a persistent trigger "misses" its firing time because of the scheduler being shutdown, or because there are no available threads in Quartz’s thread pool for executing the job.
    int
    Quartz Calendar objects (not java.util.Calendar objects) can be associated with triggers at the time the trigger is defined and stored in the scheduler.
  • Element Details

    • value

      String value
      Expression can be one of these three options:
      1. Interval: 10s, 10secs, 10minutes, 1h, etc...
      2. Cron expression: 0/3 * * * * ?
      3. Reference to a property, where the property value is one of the two previous options
      Returns:
      an expression to create an scheduler.
      See Also:
      • Config.getDuration(String, java.util.concurrent.TimeUnit)
    • calendar

      String calendar
      Sometimes, when you have many Triggers (or few worker threads in your Quartz thread pool), Quartz may not have enough resources to immediately fire all of the Triggers that are scheduled to fire at the same time. In this case, you may want to control which of your Triggers get first crack at the available Quartz worker threads. For this purpose, you can set the priority property on a Trigger.
      Returns:
      Quartz calendar.
      Default:
      ""
    • priority

      int priority
      Quartz Calendar objects (not java.util.Calendar objects) can be associated with triggers at the time the trigger is defined and stored in the scheduler. Calendars are useful for excluding blocks of time from the the trigger’s firing schedule.
      Returns:
      Priority default 5.
      Default:
      5
    • misfire

      int misfire
      A misfire occurs if a persistent trigger "misses" its firing time because of the scheduler being shutdown, or because there are no available threads in Quartz’s thread pool for executing the job.
      Returns:
      Misfire instruction.
      Default:
      0