Package ch.tocco.nice2.tasks.api.quartz
Interface TaskSchedulingService
- All Known Implementing Classes:
TaskSchedulingServiceImpl
public interface TaskSchedulingService
Service to manually schedule
AbstractJob tasks.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final int -
Method Summary
Modifier and TypeMethodDescriptionvoidInterrupt a running job.voidcancelJob(org.quartz.JobKey jobKey) Interrupt a running job.Optional<org.quartz.JobKey> executeJobImmediately(Class<? extends AbstractJob> jobClass, String taskName, CallableType taskType, JobDataMapBuilder jobData) Schedule a task which will be executed immediately (unless all threads are already occupied).voidremoveScheduledJob(Entity taskExecution) Remove a scheduled job.voidrescheduleJob(Entity taskExecution, org.joda.time.DateTime newDate) Change the scheduled start time of a given job.Optional<org.quartz.JobKey> scheduleJob(Class<? extends AbstractJob> jobClass, String taskName, CallableType taskType, JobDataMapBuilder jobData, org.joda.time.DateTime executionDate) Schedule a task to be executed at a specific date and time.
-
Field Details
-
HIGH_LISTENER_PRIORITY
static final int HIGH_LISTENER_PRIORITY- See Also:
-
NORMAL_LISTENER_PRIORITY
static final int NORMAL_LISTENER_PRIORITY- See Also:
-
LOW_LISTENER_PRIORITY
static final int LOW_LISTENER_PRIORITY- See Also:
-
-
Method Details
-
executeJobImmediately
Optional<org.quartz.JobKey> executeJobImmediately(Class<? extends AbstractJob> jobClass, String taskName, CallableType taskType, JobDataMapBuilder jobData) Schedule a task which will be executed immediately (unless all threads are already occupied).- Returns:
- the
JobKeyif new job was scheduled (no new job is created if multiple schedules are disabled by settingJobDataMapBuilder.putMultipleSchedulesEnabled(boolean)to `false` and a job with the given `taskName` already exists)
-
scheduleJob
Optional<org.quartz.JobKey> scheduleJob(Class<? extends AbstractJob> jobClass, String taskName, CallableType taskType, JobDataMapBuilder jobData, org.joda.time.DateTime executionDate) Schedule a task to be executed at a specific date and time.- Returns:
- the
JobKeyif new job was scheduled (no new job is created if multiple schedules are disabled by settingJobDataMapBuilder.putMultipleSchedulesEnabled(boolean)to `false` and a job with the given `taskName` already exists)
-
cancelJob
void cancelJob(org.quartz.JobKey jobKey) Interrupt a running job. The job must extend fromAbstractInterruptableJoband must properly implement the cancellation.- Parameters:
jobKey- the key of the job- Throws:
CancellationNotSupportedException- if the referenced task is not interruptableIllegalJobStateException- if no running job was found for that job keyJobAccessDeniedException- no permission to access the given job
-
cancelJob
Interrupt a running job. The job must extend fromAbstractInterruptableJoband must properly implement the cancellation.- Parameters:
taskExecution- the 'Task_execution' entity that represents the job to cancel- Throws:
CancellationNotSupportedException- if the referenced task is not interruptableIllegalJobStateException- if no running job was found for that job keyJobAccessDeniedException- no permission to access the given job
-
removeScheduledJob
Remove a scheduled job.- Parameters:
taskExecution- the 'Task_execution' entity that represents the job to delete- Throws:
IllegalJobStateException- if the job has already started or is not foundJobAccessDeniedException- no permission to access the given job
-
rescheduleJob
Change the scheduled start time of a given job.- Parameters:
taskExecution- the 'Task_execution' entity that represents the job to reschedule- Throws:
IllegalJobStateException- if the job has already started or is not foundJobAccessDeniedException- no permission to access the given job
-