Interface Scheduler
-
- All Known Implementing Classes:
JBoss4RMIRemoteMBeanScheduler,RemoteMBeanScheduler,RemoteScheduler,StdScheduler
public interface SchedulerThis is the main interface of a Quartz Scheduler.A
Schedulermaintains a registry ofs andJobDetails. Once registered, theTriggerScheduleris responsible for executingJobs when their associatedTriggers fire (when their scheduled time arrives).Schedulerinstances are produced by a. A scheduler that has already been created/initialized can be found and used through the same factory that produced it. After aSchedulerFactorySchedulerhas been created, it is in "stand-by" mode, and must have itsstart()method called before it will fire anyJobs.Jobs are to be created by the 'client program', by defining a class that implements theinterface.Jobobjects are then created (also by the client) to define a individual instances of theJobDetailJob.JobDetailinstances can then be registered with theSchedulervia thescheduleJob(JobDetail, Trigger)oraddJob(JobDetail, boolean)method.Triggers can then be defined to fire individualJobinstances based on given schedules.SimpleTriggers are most useful for one-time firings, or firing at an exact moment in time, with N repeats with a given delay between them.CronTriggers allow scheduling based on time of day, day of week, day of month, and month of year.Jobs andTriggers have a name and group associated with them, which should uniquely identify them within a single. The 'group' feature may be useful for creating logical groupings or categorizations ofSchedulerJobss andTriggerss. If you don't have need for assigning a group to a givenJobsofTriggers, then you can use theDEFAULT_GROUPconstant defined on this interface.Stored
Jobs can also be 'manually' triggered through the use of thetriggerJob(String jobName, String jobGroup)function.Client programs may also be interested in the 'listener' interfaces that are available from Quartz. The
interface provides notifications ofJobListenerJobexecutions. Theinterface provides notifications ofTriggerListenerTriggerfirings. Theinterface provides notifications ofSchedulerListenerSchedulerevents and errors. Listeners can be associated with local schedulers through theListenerManagerinterface.The setup/configuration of a
Schedulerinstance is very customizable. Please consult the documentation distributed with Quartz.- Author:
- James House, Sharada Jambula
- See Also:
Job,JobDetail,JobBuilder,Trigger,TriggerBuilder,JobListener,TriggerListener,SchedulerListener
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_FAIL_OVER_GROUPA constantTriggergroup name used internally by the scheduler - clients should not use the value of this constant ("FAILED_OVER_JOBS") for the name of aTrigger's group.static java.lang.StringDEFAULT_GROUPA (possibly) useful constant that can be used for specifying the group thatJobandTriggerinstances belong to.static java.lang.StringDEFAULT_RECOVERY_GROUPA constantTriggergroup name used internally by the scheduler - clients should not use the value of this constant ("RECOVERING_JOBS") for the name of aTrigger's group.static java.lang.StringFAILED_JOB_ORIGINAL_TRIGGER_FIRETIME_IN_MILLISECONDSA constantJobDataMapkey that can be used to retrieve the fire time of the originalTriggerfrom a recovery trigger's data map in the case of a job recovering after a failed scheduler instance.static java.lang.StringFAILED_JOB_ORIGINAL_TRIGGER_GROUPA constantJobDataMapkey that can be used to retrieve the group of the originalTriggerfrom a recovery trigger's data map in the case of a job recovering after a failed scheduler instance.static java.lang.StringFAILED_JOB_ORIGINAL_TRIGGER_NAMEA constantJobDataMapkey that can be used to retrieve the name of the originalTriggerfrom a recovery trigger's data map in the case of a job recovering after a failed scheduler instance.static java.lang.StringFAILED_JOB_ORIGINAL_TRIGGER_SCHEDULED_FIRETIME_IN_MILLISECONDSA constantJobDataMapkey that can be used to retrieve the scheduled fire time of the originalTriggerfrom a recovery trigger's data map in the case of a job recovering after a failed scheduler instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddCalendar(java.lang.String calName, Calendar calendar, boolean replace, boolean updateTriggers)Add (register) the givenCalendarto the Scheduler.voidaddJob(JobDetail jobDetail, boolean replace)Add the givenJobto the Scheduler - with no associatedTrigger.voidaddJob(JobDetail jobDetail, boolean replace, boolean storeNonDurableWhileAwaitingScheduling)Add the givenJobto the Scheduler - with no associatedTrigger.booleancheckExists(JobKey jobKey)Determine whether aJobwith the given identifier already exists within the scheduler.booleancheckExists(TriggerKey triggerKey)Determine whether aTriggerwith the given identifier already exists within the scheduler.voidclear()booleandeleteCalendar(java.lang.String calName)Delete the identifiedCalendarfrom the Scheduler.booleandeleteJob(JobKey jobKey)Delete the identifiedJobfrom the Scheduler - and any associatedTriggers.booleandeleteJobs(java.util.List<JobKey> jobKeys)Delete the identifiedJobs from the Scheduler - and any associatedTriggers.CalendargetCalendar(java.lang.String calName)Get theinstance with the given name.Calendarjava.util.List<java.lang.String>getCalendarNames()Get the names of all registered.CalendarsSchedulerContextgetContext()Returns theSchedulerContextof theScheduler.java.util.List<JobExecutionContext>getCurrentlyExecutingJobs()Return a list ofJobExecutionContextobjects that represent all currently executing Jobs in this Scheduler instance.JobDetailgetJobDetail(JobKey jobKey)Get thefor theJobDetailJobinstance with the given key.java.util.List<java.lang.String>getJobGroupNames()Get the names of all knowngroups.JobDetailjava.util.Set<JobKey>getJobKeys(GroupMatcher<JobKey> matcher)Get the keys of all thein the matching groups.JobDetailsListenerManagergetListenerManager()Get a reference to the scheduler'sListenerManager, through which listeners may be registered.SchedulerMetaDatagetMetaData()Get aSchedulerMetaDataobject describing the settings and capabilities of the scheduler instance.java.util.Set<java.lang.String>getPausedTriggerGroups()Get the names of allgroups that are paused.Triggerjava.lang.StringgetSchedulerInstanceId()Returns the instance Id of theScheduler.java.lang.StringgetSchedulerName()Returns the name of theScheduler.TriggergetTrigger(TriggerKey triggerKey)Get theinstance with the given key.Triggerjava.util.List<java.lang.String>getTriggerGroupNames()Get the names of all knowngroups.Triggerjava.util.Set<TriggerKey>getTriggerKeys(GroupMatcher<TriggerKey> matcher)Get the names of all thein the given group.Triggersjava.util.List<? extends Trigger>getTriggersOfJob(JobKey jobKey)Trigger.TriggerStategetTriggerState(TriggerKey triggerKey)Get the current state of the identified.Triggerbooleaninterrupt(java.lang.String fireInstanceId)Request the interruption, within this Scheduler instance, of the identified executingJobinstance, which must be an implementor of theInterruptableJobinterface.booleaninterrupt(JobKey jobKey)Request the interruption, within this Scheduler instance, of all currently executing instances of the identifiedJob, which must be an implementor of theInterruptableJobinterface.booleanisInStandbyMode()Reports whether theScheduleris in stand-by mode.booleanisShutdown()Reports whether theSchedulerhas been shutdown.booleanisStarted()Whether the scheduler has been started.voidpauseAll()Pause all triggers - similar to callingpauseTriggerGroup(group)on every group, however, after using this methodresumeAll()must be called to clear the scheduler's state of 'remembering' that all new triggers will be paused as they are added.voidpauseJob(JobKey jobKey)Pause thewith the given key - by pausing all of its currentJobDetailTriggers.voidpauseJobs(GroupMatcher<JobKey> matcher)Pause all of thein the matching groups - by pausing all of theirJobDetailsTriggers.voidpauseTrigger(TriggerKey triggerKey)Pause thewith the given key.TriggervoidpauseTriggers(GroupMatcher<TriggerKey> matcher)Pause all of thein the groups matching.Triggersjava.util.DaterescheduleJob(TriggerKey triggerKey, Trigger newTrigger)Remove (delete) thewith the given key, and store the new given one - which must be associated with the same job (the new trigger must have the job name and group specified) - however, the new trigger need not have the same name as the old trigger.TriggervoidresetTriggerFromErrorState(TriggerKey triggerKey)Reset the current state of the identifiedfromTriggerTrigger.TriggerState.ERRORtoTrigger.TriggerState.NORMALorTrigger.TriggerState.PAUSEDas appropriate.voidresumeAll()Resume (un-pause) all triggers - similar to callingresumeTriggerGroup(group)on every group.voidresumeJob(JobKey jobKey)Resume (un-pause) thewith the given key.JobDetailvoidresumeJobs(GroupMatcher<JobKey> matcher)Resume (un-pause) all of thein matching groups.JobDetailsvoidresumeTrigger(TriggerKey triggerKey)Resume (un-pause) thewith the given key.TriggervoidresumeTriggers(GroupMatcher<TriggerKey> matcher)Resume (un-pause) all of thein matching groups.TriggersvoidscheduleJob(JobDetail jobDetail, java.util.Set<? extends Trigger> triggersForJob, boolean replace)Schedule the given job with the related set of triggers.java.util.DatescheduleJob(JobDetail jobDetail, Trigger trigger)java.util.DatescheduleJob(Trigger trigger)voidscheduleJobs(java.util.Map<JobDetail,java.util.Set<? extends Trigger>> triggersAndJobs, boolean replace)Schedule all of the given jobs with the related set of triggers.voidsetJobFactory(JobFactory factory)Set theJobFactorythat will be responsible for producing instances ofJobclasses.voidshutdown()Halts theScheduler's firing of, and cleans up all resources associated with the Scheduler.Triggersvoidshutdown(boolean waitForJobsToComplete)Halts theScheduler's firing of, and cleans up all resources associated with the Scheduler.Triggersvoidstandby()Temporarily halts theScheduler's firing of.Triggersvoidstart()Starts theScheduler's threads that fire.TriggersvoidstartDelayed(int seconds)Calls {#start()} after the indicated number of seconds.voidtriggerJob(JobKey jobKey)Trigger the identified(execute it now).JobDetailvoidtriggerJob(JobKey jobKey, JobDataMap data)Trigger the identified(execute it now).JobDetailbooleanunscheduleJob(TriggerKey triggerKey)Remove the indicatedfrom the scheduler.TriggerbooleanunscheduleJobs(java.util.List<TriggerKey> triggerKeys)Remove all of the indicateds from the scheduler.Trigger
-
-
-
Field Detail
-
DEFAULT_GROUP
static final java.lang.String DEFAULT_GROUP
A (possibly) useful constant that can be used for specifying the group thatJobandTriggerinstances belong to.- See Also:
- Constant Field Values
-
DEFAULT_RECOVERY_GROUP
static final java.lang.String DEFAULT_RECOVERY_GROUP
A constantTriggergroup name used internally by the scheduler - clients should not use the value of this constant ("RECOVERING_JOBS") for the name of aTrigger's group.
-
DEFAULT_FAIL_OVER_GROUP
static final java.lang.String DEFAULT_FAIL_OVER_GROUP
A constantTriggergroup name used internally by the scheduler - clients should not use the value of this constant ("FAILED_OVER_JOBS") for the name of aTrigger's group.
-
FAILED_JOB_ORIGINAL_TRIGGER_NAME
static final java.lang.String FAILED_JOB_ORIGINAL_TRIGGER_NAME
A constantJobDataMapkey that can be used to retrieve the name of the originalTriggerfrom a recovery trigger's data map in the case of a job recovering after a failed scheduler instance.
-
FAILED_JOB_ORIGINAL_TRIGGER_GROUP
static final java.lang.String FAILED_JOB_ORIGINAL_TRIGGER_GROUP
A constantJobDataMapkey that can be used to retrieve the group of the originalTriggerfrom a recovery trigger's data map in the case of a job recovering after a failed scheduler instance.
-
FAILED_JOB_ORIGINAL_TRIGGER_FIRETIME_IN_MILLISECONDS
static final java.lang.String FAILED_JOB_ORIGINAL_TRIGGER_FIRETIME_IN_MILLISECONDS
A constantJobDataMapkey that can be used to retrieve the fire time of the originalTriggerfrom a recovery trigger's data map in the case of a job recovering after a failed scheduler instance.Note that this is the time the original firing actually occurred, which may be different from the scheduled fire time - as a trigger doesn't always fire exactly on time.
-
FAILED_JOB_ORIGINAL_TRIGGER_SCHEDULED_FIRETIME_IN_MILLISECONDS
static final java.lang.String FAILED_JOB_ORIGINAL_TRIGGER_SCHEDULED_FIRETIME_IN_MILLISECONDS
A constantJobDataMapkey that can be used to retrieve the scheduled fire time of the originalTriggerfrom a recovery trigger's data map in the case of a job recovering after a failed scheduler instance.Note that this is the time the original firing was scheduled for, which may be different from the actual firing time - as a trigger doesn't always fire exactly on time.
-
-
Method Detail
-
getSchedulerName
java.lang.String getSchedulerName() throws SchedulerExceptionReturns the name of theScheduler.- Throws:
SchedulerException
-
getSchedulerInstanceId
java.lang.String getSchedulerInstanceId() throws SchedulerExceptionReturns the instance Id of theScheduler.- Throws:
SchedulerException
-
getContext
SchedulerContext getContext() throws SchedulerException
Returns theSchedulerContextof theScheduler.- Throws:
SchedulerException
-
start
void start() throws SchedulerExceptionStarts theScheduler's threads that fire. When a scheduler is first created it is in "stand-by" mode, and will not fire triggers. The scheduler can also be put into stand-by mode by calling theTriggersstandby()method.The misfire/recovery process will be started, if it is the initial call to this method on this scheduler instance.
- Throws:
SchedulerException- ifshutdown()has been called, or there is an error within theScheduler.- See Also:
startDelayed(int),standby(),shutdown()
-
startDelayed
void startDelayed(int seconds) throws SchedulerExceptionCalls {#start()} after the indicated number of seconds. (This call does not block). This can be useful within applications that have initializers that create the scheduler immediately, before the resources needed by the executing jobs have been fully initialized.- Throws:
SchedulerException- ifshutdown()has been called, or there is an error within theScheduler.- See Also:
start(),standby(),shutdown()
-
isStarted
boolean isStarted() throws SchedulerExceptionWhether the scheduler has been started.Note: This only reflects whether
has ever been called on this Scheduler, so it will returnstart()trueeven if theScheduleris currently in standby mode or has been since shutdown.- Throws:
SchedulerException- See Also:
start(),isShutdown(),isInStandbyMode()
-
standby
void standby() throws SchedulerExceptionTemporarily halts theScheduler's firing of.TriggersWhen
start()is called (to bring the scheduler out of stand-by mode), trigger misfire instructions will NOT be applied during the execution of thestart()method - any misfires will be detected immediately afterward (by theJobStore's normal process).The scheduler is not destroyed, and can be re-started at any time.
- Throws:
SchedulerException- See Also:
start(),pauseAll()
-
isInStandbyMode
boolean isInStandbyMode() throws SchedulerExceptionReports whether theScheduleris in stand-by mode.- Throws:
SchedulerException- See Also:
standby(),start()
-
shutdown
void shutdown() throws SchedulerExceptionHalts theScheduler's firing of, and cleans up all resources associated with the Scheduler. Equivalent toTriggersshutdown(false).The scheduler cannot be re-started.
- Throws:
SchedulerException- See Also:
shutdown(boolean)
-
shutdown
void shutdown(boolean waitForJobsToComplete) throws SchedulerExceptionHalts theScheduler's firing of, and cleans up all resources associated with the Scheduler.TriggersThe scheduler cannot be re-started.
- Parameters:
waitForJobsToComplete- iftruethe scheduler will not allow this method to return until all currently executing jobs have completed.- Throws:
SchedulerException- See Also:
shutdown()
-
isShutdown
boolean isShutdown() throws SchedulerExceptionReports whether theSchedulerhas been shutdown.- Throws:
SchedulerException
-
getMetaData
SchedulerMetaData getMetaData() throws SchedulerException
Get aSchedulerMetaDataobject describing the settings and capabilities of the scheduler instance.Note that the data returned is an 'instantaneous' snap-shot, and that as soon as it's returned, the meta data values may be different.
- Throws:
SchedulerException
-
getCurrentlyExecutingJobs
java.util.List<JobExecutionContext> getCurrentlyExecutingJobs() throws SchedulerException
Return a list ofJobExecutionContextobjects that represent all currently executing Jobs in this Scheduler instance.This method is not cluster aware. That is, it will only return Jobs currently executing in this Scheduler instance, not across the entire cluster.
Note that the list returned is an 'instantaneous' snap-shot, and that as soon as it's returned, the true list of executing jobs may be different. Also please read the doc associated with
JobExecutionContext- especially if you're using RMI.- Throws:
SchedulerException- See Also:
JobExecutionContext
-
setJobFactory
void setJobFactory(JobFactory factory) throws SchedulerException
Set theJobFactorythat will be responsible for producing instances ofJobclasses.JobFactories may be of use to those wishing to have their application produce
Jobinstances via some special mechanism, such as to give the opportunity for dependency injection.- Throws:
SchedulerException- See Also:
JobFactory
-
getListenerManager
ListenerManager getListenerManager() throws SchedulerException
Get a reference to the scheduler'sListenerManager, through which listeners may be registered.- Returns:
- the scheduler's
ListenerManager - Throws:
SchedulerException- if the scheduler is not local- See Also:
ListenerManager,JobListener,TriggerListener,SchedulerListener
-
scheduleJob
java.util.Date scheduleJob(JobDetail jobDetail, Trigger trigger) throws SchedulerException
Add the givento the Scheduler, and associate the givenJobDetailwith it.TriggerIf the given Trigger does not reference any
Job, then it will be set to reference the Job passed with it into this method.- Throws:
SchedulerException- if the Job or Trigger cannot be added to the Scheduler, or there is an internal Scheduler error.
-
scheduleJob
java.util.Date scheduleJob(Trigger trigger) throws SchedulerException
- Throws:
SchedulerException- if the indicated Job does not exist, or the Trigger cannot be added to the Scheduler, or there is an internal Scheduler error.
-
scheduleJobs
void scheduleJobs(java.util.Map<JobDetail,java.util.Set<? extends Trigger>> triggersAndJobs, boolean replace) throws SchedulerException
Schedule all of the given jobs with the related set of triggers.If any of the given jobs or triggers already exist (or more specifically, if the keys are not unique) and the replace parameter is not set to true then an exception will be thrown.
- Throws:
ObjectAlreadyExistsException- if the job/trigger keys are not unique and the replace flag is not set to true.SchedulerException
-
scheduleJob
void scheduleJob(JobDetail jobDetail, java.util.Set<? extends Trigger> triggersForJob, boolean replace) throws SchedulerException
Schedule the given job with the related set of triggers.If any of the given job or triggers already exist (or more specifically, if the keys are not unique) and the replace parameter is not set to true then an exception will be thrown.
- Throws:
ObjectAlreadyExistsException- if the job/trigger keys are not unique and the replace flag is not set to true.SchedulerException
-
unscheduleJob
boolean unscheduleJob(TriggerKey triggerKey) throws SchedulerException
Remove the indicatedfrom the scheduler.TriggerIf the related job does not have any other triggers, and the job is not durable, then the job will also be deleted.
- Throws:
SchedulerException
-
unscheduleJobs
boolean unscheduleJobs(java.util.List<TriggerKey> triggerKeys) throws SchedulerException
Remove all of the indicateds from the scheduler.TriggerIf the related job does not have any other triggers, and the job is not durable, then the job will also be deleted.
Note that while this bulk operation is likely more efficient than invoking
unscheduleJob(TriggerKey triggerKey)several times, it may have the adverse affect of holding data locks for a single long duration of time (rather than lots of small durations of time).- Throws:
SchedulerException
-
rescheduleJob
java.util.Date rescheduleJob(TriggerKey triggerKey, Trigger newTrigger) throws SchedulerException
Remove (delete) thewith the given key, and store the new given one - which must be associated with the same job (the new trigger must have the job name and group specified) - however, the new trigger need not have the same name as the old trigger.Trigger- Parameters:
triggerKey- identity of the trigger to replacenewTrigger- The newTriggerto be stored.- Returns:
nullif aTriggerwith the given name and group was not found and removed from the store (and the new trigger is therefore not stored), otherwise the first fire time of the newly scheduled trigger is returned.- Throws:
SchedulerException
-
addJob
void addJob(JobDetail jobDetail, boolean replace) throws SchedulerException
Add the givenJobto the Scheduler - with no associatedTrigger. TheJobwill be 'dormant' until it is scheduled with aTrigger, orScheduler.triggerJob()is called for it.The
Jobmust by definition be 'durable', if it is not, SchedulerException will be thrown.- Throws:
SchedulerException- if there is an internal Scheduler error, or if the Job is not durable, or a Job with the same name already exists, andreplaceisfalse.- See Also:
addJob(JobDetail, boolean, boolean)
-
addJob
void addJob(JobDetail jobDetail, boolean replace, boolean storeNonDurableWhileAwaitingScheduling) throws SchedulerException
Add the givenJobto the Scheduler - with no associatedTrigger. TheJobwill be 'dormant' until it is scheduled with aTrigger, orScheduler.triggerJob()is called for it.With the
storeNonDurableWhileAwaitingSchedulingparameter set totrue, a non-durable job can be stored. Once it is scheduled, it will resume normal non-durable behavior (i.e. be deleted once there are no remaining associated triggers).- Throws:
SchedulerException- if there is an internal Scheduler error, or if the Job is not durable, or a Job with the same name already exists, andreplaceisfalse.
-
deleteJob
boolean deleteJob(JobKey jobKey) throws SchedulerException
Delete the identifiedJobfrom the Scheduler - and any associatedTriggers.- Returns:
- true if the Job was found and deleted.
- Throws:
SchedulerException- if there is an internal Scheduler error.
-
deleteJobs
boolean deleteJobs(java.util.List<JobKey> jobKeys) throws SchedulerException
Delete the identifiedJobs from the Scheduler - and any associatedTriggers.Note that while this bulk operation is likely more efficient than invoking
deleteJob(JobKey jobKey)several times, it may have the adverse affect of holding data locks for a single long duration of time (rather than lots of small durations of time).- Returns:
- true if all of the Jobs were found and deleted, false if one or more were not deleted.
- Throws:
SchedulerException- if there is an internal Scheduler error.
-
triggerJob
void triggerJob(JobKey jobKey) throws SchedulerException
Trigger the identified(execute it now).JobDetail- Throws:
SchedulerException
-
triggerJob
void triggerJob(JobKey jobKey, JobDataMap data) throws SchedulerException
Trigger the identified(execute it now).JobDetail- Parameters:
data- the (possiblynull) JobDataMap to be associated with the trigger that fires the job immediately.- Throws:
SchedulerException
-
pauseJob
void pauseJob(JobKey jobKey) throws SchedulerException
Pause thewith the given key - by pausing all of its currentJobDetailTriggers.- Throws:
SchedulerException- See Also:
resumeJob(JobKey)
-
pauseJobs
void pauseJobs(GroupMatcher<JobKey> matcher) throws SchedulerException
Pause all of thein the matching groups - by pausing all of theirJobDetailsTriggers.The Scheduler will "remember" the groups paused, and impose the pause on any new jobs that are added to any of those groups until it is resumed.
NOTE: There is a limitation that only exactly matched groups can be remembered as paused. For example, if there are preexisting job in groups "aaa" and "bbb" and a matcher is given to pause groups that start with "a" then the group "aaa" will be remembered as paused and any subsequently added jobs in group "aaa" will be paused, however if a job is added to group "axx" it will not be paused, as "axx" wasn't known at the time the "group starts with a" matcher was applied. HOWEVER, if there are preexisting groups "aaa" and "bbb" and a matcher is given to pause the group "axx" (with a group equals matcher) then no jobs will be paused, but it will be remembered that group "axx" is paused and later when a job is added in that group, it will become paused.
- Parameters:
matcher- The matcher to evaluate against know groups- Throws:
SchedulerException- On error- See Also:
resumeJobs(org.quartz.impl.matchers.GroupMatcher)
-
pauseTrigger
void pauseTrigger(TriggerKey triggerKey) throws SchedulerException
Pause thewith the given key.Trigger- Throws:
SchedulerException- See Also:
resumeTrigger(TriggerKey)
-
pauseTriggers
void pauseTriggers(GroupMatcher<TriggerKey> matcher) throws SchedulerException
Pause all of thein the groups matching.TriggersThe Scheduler will "remember" all the groups paused, and impose the pause on any new triggers that are added to any of those groups until it is resumed.
NOTE: There is a limitation that only exactly matched groups can be remembered as paused. For example, if there are preexisting triggers in groups "aaa" and "bbb" and a matcher is given to pause groups that start with "a" then the group "aaa" will be remembered as paused and any subsequently added triggers in that group be paused, however if a trigger is added to group "axx" it will not be paused, as "axx" wasn't known at the time the "group starts with a" matcher was applied. HOWEVER, if there are preexisting groups "aaa" and "bbb" and a matcher is given to pause the group "axx" (with a group equals matcher) then no triggers will be paused, but it will be remembered that group "axx" is paused and later when a trigger is added in that group, it will become paused.
- Parameters:
matcher- The matcher to evaluate against know groups- Throws:
SchedulerException- See Also:
resumeTriggers(org.quartz.impl.matchers.GroupMatcher)
-
resumeJob
void resumeJob(JobKey jobKey) throws SchedulerException
Resume (un-pause) thewith the given key.JobDetailIf any of the
Job'sTriggers missed one or more fire-times, then theTrigger's misfire instruction will be applied.- Throws:
SchedulerException- See Also:
pauseJob(JobKey)
-
resumeJobs
void resumeJobs(GroupMatcher<JobKey> matcher) throws SchedulerException
Resume (un-pause) all of thein matching groups.JobDetailsIf any of the
Jobs hadTriggers that missed one or more fire-times, then theTrigger's misfire instruction will be applied.- Parameters:
matcher- The matcher to evaluate against known paused groups- Throws:
SchedulerException- On error- See Also:
pauseJobs(GroupMatcher)
-
resumeTrigger
void resumeTrigger(TriggerKey triggerKey) throws SchedulerException
Resume (un-pause) thewith the given key.TriggerIf the
Triggermissed one or more fire-times, then theTrigger's misfire instruction will be applied.- Throws:
SchedulerException- See Also:
pauseTrigger(TriggerKey)
-
resumeTriggers
void resumeTriggers(GroupMatcher<TriggerKey> matcher) throws SchedulerException
Resume (un-pause) all of thein matching groups.TriggersIf any
Triggermissed one or more fire-times, then theTrigger's misfire instruction will be applied.- Parameters:
matcher- The matcher to evaluate against know paused groups- Throws:
SchedulerException- On error- See Also:
pauseTriggers(org.quartz.impl.matchers.GroupMatcher)
-
pauseAll
void pauseAll() throws SchedulerExceptionPause all triggers - similar to callingpauseTriggerGroup(group)on every group, however, after using this methodresumeAll()must be called to clear the scheduler's state of 'remembering' that all new triggers will be paused as they are added.When
resumeAll()is called (to un-pause), trigger misfire instructions WILL be applied.- Throws:
SchedulerException- See Also:
resumeAll(),pauseTriggers(org.quartz.impl.matchers.GroupMatcher),standby()
-
resumeAll
void resumeAll() throws SchedulerExceptionResume (un-pause) all triggers - similar to callingresumeTriggerGroup(group)on every group.If any
Triggermissed one or more fire-times, then theTrigger's misfire instruction will be applied.- Throws:
SchedulerException- See Also:
pauseAll()
-
getJobGroupNames
java.util.List<java.lang.String> getJobGroupNames() throws SchedulerExceptionGet the names of all knowngroups.JobDetail- Throws:
SchedulerException
-
getJobKeys
java.util.Set<JobKey> getJobKeys(GroupMatcher<JobKey> matcher) throws SchedulerException
Get the keys of all thein the matching groups.JobDetails- Parameters:
matcher- Matcher to evaluate against known groups- Returns:
- Set of all keys matching
- Throws:
SchedulerException- On error
-
getTriggersOfJob
java.util.List<? extends Trigger> getTriggersOfJob(JobKey jobKey) throws SchedulerException
Get alls that are associated with the identifiedTrigger.JobDetailThe returned Trigger objects will be snap-shots of the actual stored triggers. If you wish to modify a trigger, you must re-store the trigger afterward (e.g. see
rescheduleJob(TriggerKey, Trigger)).- Throws:
SchedulerException
-
getTriggerGroupNames
java.util.List<java.lang.String> getTriggerGroupNames() throws SchedulerExceptionGet the names of all knowngroups.Trigger- Throws:
SchedulerException
-
getTriggerKeys
java.util.Set<TriggerKey> getTriggerKeys(GroupMatcher<TriggerKey> matcher) throws SchedulerException
Get the names of all thein the given group.Triggers- Parameters:
matcher- Matcher to evaluate against known groups- Returns:
- List of all keys matching
- Throws:
SchedulerException- On error
-
getPausedTriggerGroups
java.util.Set<java.lang.String> getPausedTriggerGroups() throws SchedulerExceptionGet the names of allgroups that are paused.Trigger- Throws:
SchedulerException
-
getJobDetail
JobDetail getJobDetail(JobKey jobKey) throws SchedulerException
Get thefor theJobDetailJobinstance with the given key.The returned JobDetail object will be a snap-shot of the actual stored JobDetail. If you wish to modify the JobDetail, you must re-store the JobDetail afterward (e.g. see
addJob(JobDetail, boolean)).- Throws:
SchedulerException
-
getTrigger
Trigger getTrigger(TriggerKey triggerKey) throws SchedulerException
Get theinstance with the given key.TriggerThe returned Trigger object will be a snap-shot of the actual stored trigger. If you wish to modify the trigger, you must re-store the trigger afterward (e.g. see
rescheduleJob(TriggerKey, Trigger)).- Throws:
SchedulerException
-
getTriggerState
Trigger.TriggerState getTriggerState(TriggerKey triggerKey) throws SchedulerException
Get the current state of the identified.Trigger- Throws:
SchedulerException- See Also:
Trigger.TriggerState
-
resetTriggerFromErrorState
void resetTriggerFromErrorState(TriggerKey triggerKey) throws SchedulerException
Reset the current state of the identifiedfromTriggerTrigger.TriggerState.ERRORtoTrigger.TriggerState.NORMALorTrigger.TriggerState.PAUSEDas appropriate.Only affects triggers that are in ERROR state - if identified trigger is not in that state then the result is a no-op.
The result will be the trigger returning to the normal, waiting to be fired state, unless the trigger's group has been paused, in which case it will go into the PAUSED state.
- Throws:
SchedulerException- See Also:
Trigger.TriggerState
-
addCalendar
void addCalendar(java.lang.String calName, Calendar calendar, boolean replace, boolean updateTriggers) throws SchedulerExceptionAdd (register) the givenCalendarto the Scheduler.- Parameters:
updateTriggers- whether or not to update existing triggers that referenced the already existing calendar so that they are 'correct' based on the new trigger.- Throws:
SchedulerException- if there is an internal Scheduler error, or a Calendar with the same name already exists, andreplaceisfalse.
-
deleteCalendar
boolean deleteCalendar(java.lang.String calName) throws SchedulerExceptionDelete the identifiedCalendarfrom the Scheduler.If removal of the
Calendarwould result inTriggers pointing to nonexistent calendars, then aSchedulerExceptionwill be thrown.- Returns:
- true if the Calendar was found and deleted.
- Throws:
SchedulerException- if there is an internal Scheduler error, or one or more triggers reference the calendar
-
getCalendar
Calendar getCalendar(java.lang.String calName) throws SchedulerException
Get theinstance with the given name.Calendar- Throws:
SchedulerException
-
getCalendarNames
java.util.List<java.lang.String> getCalendarNames() throws SchedulerExceptionGet the names of all registered.Calendars- Throws:
SchedulerException
-
interrupt
boolean interrupt(JobKey jobKey) throws UnableToInterruptJobException
Request the interruption, within this Scheduler instance, of all currently executing instances of the identifiedJob, which must be an implementor of theInterruptableJobinterface.If more than one instance of the identified job is currently executing, the
InterruptableJob#interrupt()method will be called on each instance. However, there is a limitation that in the case thatinterrupt()on one instances throws an exception, all remaining instances (that have not yet been interrupted) will not have theirinterrupt()method called.This method is not cluster aware. That is, it will only interrupt instances of the identified InterruptableJob currently executing in this Scheduler instance, not across the entire cluster.
- Returns:
- true if at least one instance of the identified job was found and interrupted.
- Throws:
UnableToInterruptJobException- if the job does not implementInterruptableJob, or there is an exception while interrupting the job.- See Also:
InterruptableJob.interrupt(),getCurrentlyExecutingJobs(),interrupt(String)
-
interrupt
boolean interrupt(java.lang.String fireInstanceId) throws UnableToInterruptJobExceptionRequest the interruption, within this Scheduler instance, of the identified executingJobinstance, which must be an implementor of theInterruptableJobinterface.This method is not cluster aware. That is, it will only interrupt instances of the identified InterruptableJob currently executing in this Scheduler instance, not across the entire cluster.
- Parameters:
fireInstanceId- the unique identifier of the job instance to be interrupted (seeJobExecutionContext.getFireInstanceId()- Returns:
- true if the identified job instance was found and interrupted.
- Throws:
UnableToInterruptJobException- if the job does not implementInterruptableJob, or there is an exception while interrupting the job.- See Also:
InterruptableJob.interrupt(),getCurrentlyExecutingJobs(),JobExecutionContext.getFireInstanceId(),interrupt(JobKey)
-
checkExists
boolean checkExists(JobKey jobKey) throws SchedulerException
Determine whether aJobwith the given identifier already exists within the scheduler.- Parameters:
jobKey- the identifier to check for- Returns:
- true if a Job exists with the given identifier
- Throws:
SchedulerException
-
checkExists
boolean checkExists(TriggerKey triggerKey) throws SchedulerException
Determine whether aTriggerwith the given identifier already exists within the scheduler.- Parameters:
triggerKey- the identifier to check for- Returns:
- true if a Trigger exists with the given identifier
- Throws:
SchedulerException
-
clear
void clear() throws SchedulerException- Throws:
SchedulerException
-
-