Class AbstractJobScheduler

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static int BATCH_SIZE  
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractJobScheduler​(StorageProvider storageProvider)
      Creates a new AbstractJobScheduler using the provided storageProvider
      AbstractJobScheduler​(StorageProvider storageProvider, java.util.List<JobFilter> jobFilters)
      Creates a new AbstractJobScheduler using the provided storageProvider and the list of JobFilters that will be used for every background job
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void delete​(java.lang.String id)
      Deletes the recurring job based on the given id.
      void delete​(java.util.UUID id)
      Deletes a job and sets its state to DELETED.
      void delete​(java.util.UUID id, java.lang.String reason)
      Deletes a job and sets its state to DELETED.
      void delete​(JobId jobId)  
      void delete​(JobId jobId, java.lang.String reason)  
      void shutdown()
      Utility method to register the shutdown of JobRunr in various containers - it is even automatically called by Spring Framework.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractJobScheduler

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

        public AbstractJobScheduler​(StorageProvider storageProvider,
                                    java.util.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 Detail

      • delete

        public void delete​(java.util.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​(java.util.UUID id,
                           java.lang.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​(java.lang.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.