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
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Interrupt a running job.void
cancelJob
(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).void
removeScheduledJob
(Entity taskExecution) Remove a scheduled job.void
rescheduleJob
(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
JobKey
if 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
JobKey
if 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 fromAbstractInterruptableJob
and 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 fromAbstractInterruptableJob
and 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
-