Package org.jobrunr.scheduling
Class AbstractJobScheduler
- java.lang.Object
-
- org.jobrunr.scheduling.AbstractJobScheduler
-
- Direct Known Subclasses:
JobRequestScheduler
,JobScheduler
public class AbstractJobScheduler extends java.lang.Object
-
-
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 storageProviderAbstractJobScheduler(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.
-
-
-
Field Detail
-
BATCH_SIZE
protected static final int BATCH_SIZE
- See Also:
- Constant Field Values
-
-
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 usejobFilters
- list of jobFilters that will be used for every job
-
-
Method Detail
-
delete
public void delete(JobId jobId)
- See Also:
delete(UUID)
-
delete
public void delete(JobId jobId, java.lang.String reason)
- See Also:
delete(UUID, String)
-
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 jobreason
- 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.
-
-