Class AbstractJobScheduler

java.lang.Object
org.jobrunr.scheduling.AbstractJobScheduler
Direct Known Subclasses:
JobRequestScheduler, JobScheduler

public abstract class AbstractJobScheduler extends Object
  • Constructor Details

    • AbstractJobScheduler

      public AbstractJobScheduler(StorageProvider storageProvider)
      Creates a new AbstractJobScheduler using the provided storageProvider
      Parameters:
      storageProvider - the storageProvider to use
    • AbstractJobScheduler

      public AbstractJobScheduler(StorageProvider storageProvider, List<JobFilter> jobFilters)
      Creates a new AbstractJobScheduler using the provided storageProvider and the list of JobFilters that will be used for every background job
      Parameters:
      storageProvider - the storageProvider to use
      jobFilters - list of jobFilters that will be used for every job
  • Method Details

    • delete

      public void delete(JobId jobId)
      See Also:
    • delete

      public void delete(JobId jobId, String reason)
      See Also:
    • delete

      public void delete(UUID id)
      Deletes a job and sets its state to DELETED. If the job is being processed, it will be interrupted.
      Parameters:
      id - the id of the job
    • delete

      public void delete(UUID id, String reason)
      Deletes a job and sets its state to DELETED. If the job is being processed, it will be interrupted.
      Parameters:
      id - the id of the job
      reason - the reason why the job is deleted.
    • delete

      public void delete(String id)
      Deletes the recurring job based on the given id.
      An example:
      
            jobScheduler.delete("my-recurring-job"));
       
      Parameters:
      id - the id of the recurring job to delete
    • shutdown

      public void shutdown()
      Utility method to register the shutdown of JobRunr in various containers - it is even automatically called by Spring Framework. Note that this will stop the BackgroundJobServer, the Dashboard and the StorageProvider. JobProcessing will stop and enqueueing new jobs will fail.