Package cn.boboweike.carrot.scheduling
Class AbstractTaskScheduler
- java.lang.Object
-
- cn.boboweike.carrot.scheduling.AbstractTaskScheduler
-
- Direct Known Subclasses:
TaskRequestScheduler,TaskScheduler
public class AbstractTaskScheduler extends Object
-
-
Constructor Summary
Constructors Constructor Description AbstractTaskScheduler(PartitionedStorageProvider storageProvider)Creates a new AbstractTaskScheduler using the provided storageProviderAbstractTaskScheduler(PartitionedStorageProvider storageProvider, List<TaskFilter> taskFilters)Creates a new AbstractTaskScheduler using the provided storageProvider and the list of TaskFilters that will be used for every background task
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddelete(TaskId taskId)voiddelete(TaskId taskId, String reason)voiddelete(String id)Deletes the recurring task based on the given id.voiddelete(UUID id)Deletes a task and sets its state to DELETED.voiddelete(UUID id, String reason)Deletes a task and sets its state to DELETED.voidshutdown()Utility method to register the shutdown of Carrot in various containers - it is even automatically called by Spring Framework.
-
-
-
Constructor Detail
-
AbstractTaskScheduler
public AbstractTaskScheduler(PartitionedStorageProvider storageProvider)
Creates a new AbstractTaskScheduler using the provided storageProvider- Parameters:
storageProvider- the storageProvider to use
-
AbstractTaskScheduler
public AbstractTaskScheduler(PartitionedStorageProvider storageProvider, List<TaskFilter> taskFilters)
Creates a new AbstractTaskScheduler using the provided storageProvider and the list of TaskFilters that will be used for every background task- Parameters:
storageProvider- the storageProvider to usetaskFilters- list of taskFilters that will be used for every task
-
-
Method Detail
-
delete
public void delete(TaskId taskId)
- Parameters:
taskId- the id of the task- See Also:
delete(UUID)
-
delete
public void delete(TaskId taskId, String reason)
- Parameters:
taskId- the id of the taskreason- the reason to delete- See Also:
delete(UUID, String)
-
delete
public void delete(UUID id)
Deletes a task and sets its state to DELETED. If the task is being processed, it will be interrupted.- Parameters:
id- the id of the task
-
delete
public void delete(UUID id, String reason)
Deletes a task and sets its state to DELETED. If the task is being processed, it will be interrupted.- Parameters:
id- the id of the taskreason- the reason why the task is deleted.
-
delete
public void delete(String id)
Deletes the recurring task based on the given id.An example:
taskScheduler.delete("my-recurring-task"));- Parameters:
id- the id of the recurring task to delete
-
shutdown
public void shutdown()
Utility method to register the shutdown of Carrot in various containers - it is even automatically called by Spring Framework. Note that this will stop the BackgroundTaskServer, the Dashboard and the StorageProvider. TaskProcessing will stop and enqueueing new tasks will fail.
-
-