Interface Trigger


public interface Trigger
Trigger is bound to a scheduled job.

It represents the logic that is used to test if a scheduled job should be executed at a specific time, i.e. the trigger is "fired".

See Also:
  • Method Details

    • getId

      String getId()
      Returns:
      the identifier of the job
      See Also:
    • getNextFireTime

      Instant getNextFireTime()
      If the trigger represents a cron-based job with a timezone, then the returned Instant takes the timezone into account.

      For example, if there is a job with cron expression 0 30 20 ? * * * with timezone Europe/Berlin, then the return value looks like 2024-07-08T18:30:00Z. And Instant.atZone(java.time.ZoneId) for Europe/Berlin would yield 2024-07-08T20:30+02:00[Europe/Berlin].

      Returns:
      the next time at which the trigger is scheduled to fire, or null if it will not fire again
    • getPreviousFireTime

      Instant getPreviousFireTime()
      If the trigger represents a cron-based job with a timezone, then the returned Instant takes the timezone into account.

      For example, if there is a job with cron expression 0 30 20 ? * * * with timezone Europe/Berlin, then the return value looks like 2024-07-08T18:30:00Z. And Instant.atZone(java.time.ZoneId) for Europe/Berlin would yield 2024-07-08T20:30+02:00[Europe/Berlin].

      Returns:
      the previous time at which the trigger fired, or null if it has not fired yet
    • isOverdue

      boolean isOverdue()
      The grace period is configurable with Scheduled.overdueGracePeriod().

      Skipped executions are not considered as overdue.

      Returns:
      false if the last execution took place between the expected execution time and the end of the grace period, true otherwise
      See Also:
    • getMethodDescription

      default String getMethodDescription()
      Returns:
      the method description or null for a trigger of a programmatically added job