Interface Scheduler


public interface Scheduler
The container provides a built-in bean with bean type Scheduler and qualifier Default.
  • Method Details

    • isStarted

      boolean isStarted()
      By default, the scheduler is not started unless a Scheduled business method is discovered. However, it is possible to set the forced start mode with the quarkus.scheduler.start-mode configuration property. In this case, the scheduler will be started even if no scheduled business methods are found.
      Returns:
      true if the scheduler was started, false otherwise
    • pause

      void pause()
      Pause the scheduler. No triggers are fired when a scheduler is paused.
      Throws:
      UnsupportedOperationException - If the scheduler was not started
    • pause

      void pause(String identity)
      Pause a specific job. Identity must not be null and non-existent identity results in no-op.
      Parameters:
      identity -
      Throws:
      UnsupportedOperationException - If the scheduler was not started
      See Also:
    • resume

      void resume()
      Resume the scheduler. Triggers can be fired again.
      Throws:
      UnsupportedOperationException - If the scheduler was not started
    • resume

      void resume(String identity)
      Resume a specific job. Identity must not be null and non-existent identity results in no-op.
      Parameters:
      identity -
      Throws:
      UnsupportedOperationException - If the scheduler was not started
      See Also:
    • isPaused

      boolean isPaused(String identity)
      Identity must not be null and false is returned for non-existent identity.

      Note that this method only returns true if the job was explicitly paused. I.e. it does not reflect a paused scheduler.

      Parameters:
      identity -
      Returns:
      true if the job with the given identity is paused, false otherwise
      Throws:
      UnsupportedOperationException - If the scheduler was not started
      See Also:
    • isRunning

      boolean isRunning()
      Returns:
      true if a scheduler is started the triggers are fired and jobs are executed, false otherwise
      See Also:
    • getScheduledJobs

      List<Trigger> getScheduledJobs()
      Returns:
      an immutable list of scheduled jobs represented by their trigger
      Throws:
      UnsupportedOperationException - If the scheduler was not started
    • getScheduledJob

      Trigger getScheduledJob(String identity)
      Returns:
      the trigger of a specific job or null for non-existent identity
      Throws:
      UnsupportedOperationException - If the scheduler was not started
    • newJob

      Scheduler.JobDefinition<?> newJob(String identity)
      Creates a new job definition. The job is not scheduled until the Scheduler.JobDefinition.schedule() method is called.

      The properties of the job definition have the same semantics as their equivalents in the Scheduled annotation.

      Parameters:
      identity - The identity must be unique for the scheduler
      Returns:
      a new job definition
      Throws:
      UnsupportedOperationException - If the scheduler was not started
      See Also:
    • unscheduleJob

      Trigger unscheduleJob(String identity)
      Removes the job previously added via newJob(String).

      It is a no-op if the identified job was not added programmatically.

      Parameters:
      identity -
      Returns:
      the trigger or null if no such job exists
      Throws:
      UnsupportedOperationException - If the scheduler was not started
    • implementation

      String implementation()
      Returns:
      the implementation
      See Also: