Interface JobScheduler

All Known Implementing Classes:
InMemoryJobScheduler, JobSchedulerFacade

public interface JobScheduler
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Add a Job listener which will receive events related to scheduled jobs.
    Get all the outstanding Jobs
    getAllJobs(long start, long finish)
    Get all outstanding jobs due to run between start and finish
     
    Get all the jobs scheduled to run next
    long
    Get the next time jobs will be fired
    void
    remove(long time)
    remove all jobs scheduled to run at this time
    void
    remove(String jobId)
    remove a job with the matching jobId
    void
    remove all the Jobs from the scheduler
    void
    removeAllJobs(long start, long finish)
    remove all the Jobs from the scheduler that are due between the start and finish times
    void
    remove a JobListener that was previously registered.
    void
    schedule(String jobId, org.apache.activemq.util.ByteSequence payload, long delay)
    Add a job to be scheduled
    void
    schedule(String jobId, org.apache.activemq.util.ByteSequence payload, String cronEntry)
    Add a job to be scheduled
    void
    schedule(String jobId, org.apache.activemq.util.ByteSequence payload, String cronEntry, long delay, long period, int repeat)
    Add a job to be scheduled
    void
    Starts dispatch of scheduled Jobs to registered listeners.
    void
    Stops dispatching of scheduled Jobs to registered listeners.
  • Method Details

    • getName

      String getName() throws Exception
      Returns:
      the name of the scheduler
      Throws:
      Exception
    • startDispatching

      void startDispatching() throws Exception
      Starts dispatch of scheduled Jobs to registered listeners. Any listener added after the start dispatch method can miss jobs so its important to register critical listeners before the start of job dispatching.
      Throws:
      Exception
    • stopDispatching

      void stopDispatching() throws Exception
      Stops dispatching of scheduled Jobs to registered listeners.
      Throws:
      Exception
    • addListener

      void addListener(JobListener listener) throws Exception
      Add a Job listener which will receive events related to scheduled jobs.
      Parameters:
      listener - The job listener to add.
      Throws:
      Exception
    • removeListener

      void removeListener(JobListener listener) throws Exception
      remove a JobListener that was previously registered. If the given listener is not in the registry this method has no effect.
      Parameters:
      listener - The listener that should be removed from the listener registry.
      Throws:
      Exception
    • schedule

      void schedule(String jobId, org.apache.activemq.util.ByteSequence payload, long delay) throws Exception
      Add a job to be scheduled
      Parameters:
      jobId - a unique identifier for the job
      payload - the message to be sent when the job is scheduled
      delay - the time in milliseconds before the job will be run
      Throws:
      Exception - if an error occurs while scheduling the Job.
    • schedule

      void schedule(String jobId, org.apache.activemq.util.ByteSequence payload, String cronEntry) throws Exception
      Add a job to be scheduled
      Parameters:
      jobId - a unique identifier for the job
      payload - the message to be sent when the job is scheduled
      cronEntry - The cron entry to use to schedule this job.
      Throws:
      Exception - if an error occurs while scheduling the Job.
    • schedule

      void schedule(String jobId, org.apache.activemq.util.ByteSequence payload, String cronEntry, long delay, long period, int repeat) throws Exception
      Add a job to be scheduled
      Parameters:
      jobId - a unique identifier for the job
      payload - the message to be sent when the job is scheduled
      cronEntry - cron entry
      delay - time in ms to wait before scheduling
      period - the time in milliseconds between successive executions of the Job
      repeat - the number of times to execute the job - less than 0 will be repeated forever
      Throws:
      Exception
    • remove

      void remove(long time) throws Exception
      remove all jobs scheduled to run at this time
      Parameters:
      time - The UTC time to use to remove a batch of scheduled Jobs.
      Throws:
      Exception
    • remove

      void remove(String jobId) throws Exception
      remove a job with the matching jobId
      Parameters:
      jobId - The unique Job Id to search for and remove from the scheduled set of jobs.
      Throws:
      Exception - if an error occurs while removing the Job.
    • removeAllJobs

      void removeAllJobs() throws Exception
      remove all the Jobs from the scheduler
      Throws:
      Exception
    • removeAllJobs

      void removeAllJobs(long start, long finish) throws Exception
      remove all the Jobs from the scheduler that are due between the start and finish times
      Parameters:
      start - time in milliseconds
      finish - time in milliseconds
      Throws:
      Exception
    • getNextScheduleTime

      long getNextScheduleTime() throws Exception
      Get the next time jobs will be fired
      Returns:
      the time in milliseconds
      Throws:
      Exception
    • getNextScheduleJobs

      List<Job> getNextScheduleJobs() throws Exception
      Get all the jobs scheduled to run next
      Returns:
      a list of jobs that will be scheduled next
      Throws:
      Exception
    • getAllJobs

      List<Job> getAllJobs() throws Exception
      Get all the outstanding Jobs
      Returns:
      a list of all jobs
      Throws:
      Exception
    • getAllJobs

      List<Job> getAllJobs(long start, long finish) throws Exception
      Get all outstanding jobs due to run between start and finish
      Parameters:
      start -
      finish -
      Returns:
      a list of jobs
      Throws:
      Exception