public class StdScheduler extends Object implements Scheduler
An implementation of the Scheduler interface that directly
proxies all method calls to the equivalent call on a given QuartzScheduler
instance.
Scheduler,
QuartzSchedulerDEFAULT_FAIL_OVER_GROUP, DEFAULT_GROUP, DEFAULT_RECOVERY_GROUP, FAILED_JOB_ORIGINAL_TRIGGER_FIRETIME_IN_MILLISECONDS, FAILED_JOB_ORIGINAL_TRIGGER_GROUP, FAILED_JOB_ORIGINAL_TRIGGER_NAME, FAILED_JOB_ORIGINAL_TRIGGER_SCHEDULED_FIRETIME_IN_MILLISECONDS| Constructor and Description |
|---|
StdScheduler(QuartzScheduler sched)
Construct a
StdScheduler instance to proxy the given
QuartzScheduler instance, and with the given SchedulingContext. |
| Modifier and Type | Method and Description |
|---|---|
void |
addCalendar(String calName,
Calendar calendar,
boolean replace,
boolean updateTriggers)
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
void |
addJob(JobDetail jobDetail,
boolean replace)
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
void |
addJob(JobDetail jobDetail,
boolean replace,
boolean storeNonDurableWhileAwaitingScheduling)
Add the given
Job to the Scheduler - with no associated
Trigger. |
boolean |
checkExists(JobKey jobKey)
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
boolean |
checkExists(TriggerKey triggerKey)
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
void |
clear()
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
boolean |
deleteCalendar(String calName)
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
boolean |
deleteJob(JobKey jobKey)
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
boolean |
deleteJobs(List<JobKey> jobKeys)
Delete the identified
Jobs from the Scheduler - and any
associated Triggers. |
Calendar |
getCalendar(String calName)
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
List<String> |
getCalendarNames()
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
SchedulerContext |
getContext()
Returns the
SchedulerContext of the Scheduler. |
List<JobExecutionContext> |
getCurrentlyExecutingJobs()
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
JobDetail |
getJobDetail(JobKey jobKey)
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
List<String> |
getJobGroupNames()
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
Set<JobKey> |
getJobKeys(GroupMatcher<JobKey> matcher)
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
ListenerManager |
getListenerManager()
Get a reference to the scheduler's
ListenerManager,
through which listeners may be registered. |
SchedulerMetaData |
getMetaData()
Get a
SchedulerMetaData object describing the settings
and capabilities of the scheduler instance. |
Set<String> |
getPausedTriggerGroups()
Get the names of all
groups that are paused. |
String |
getSchedulerInstanceId()
Returns the instance Id of the
Scheduler. |
String |
getSchedulerName()
Returns the name of the
Scheduler. |
Trigger |
getTrigger(TriggerKey triggerKey)
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
List<String> |
getTriggerGroupNames()
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
Set<TriggerKey> |
getTriggerKeys(GroupMatcher<TriggerKey> matcher)
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
List<? extends Trigger> |
getTriggersOfJob(JobKey jobKey)
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
Trigger.TriggerState |
getTriggerState(TriggerKey triggerKey)
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
boolean |
interrupt(JobKey jobKey)
Request the interruption, within this Scheduler instance, of all
currently executing instances of the identified
Job, which
must be an implementor of the InterruptableJob interface. |
boolean |
interrupt(String fireInstanceId)
Request the interruption, within this Scheduler instance, of the
identified executing
Job instance, which
must be an implementor of the InterruptableJob interface. |
boolean |
isInStandbyMode()
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
boolean |
isShutdown()
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
boolean |
isStarted()
Whether the scheduler has been started.
|
void |
pauseAll()
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
void |
pauseJob(JobKey jobKey)
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
void |
pauseJobs(GroupMatcher<JobKey> matcher)
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
void |
pauseTrigger(TriggerKey triggerKey)
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
void |
pauseTriggers(GroupMatcher<TriggerKey> matcher)
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
Date |
rescheduleJob(TriggerKey triggerKey,
Trigger newTrigger)
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
void |
resetTriggerFromErrorState(TriggerKey triggerKey)
Reset the current state of the identified
from Trigger.TriggerState.ERROR to Trigger.TriggerState.NORMAL or
Trigger.TriggerState.PAUSED as appropriate. |
void |
resumeAll()
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
void |
resumeJob(JobKey jobKey)
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
void |
resumeJobs(GroupMatcher<JobKey> matcher)
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
void |
resumeTrigger(TriggerKey triggerKey)
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
void |
resumeTriggers(GroupMatcher<TriggerKey> matcher)
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
void |
scheduleJob(JobDetail jobDetail,
Set<? extends Trigger> triggersForJob,
boolean replace)
Schedule the given job with the related set of triggers.
|
Date |
scheduleJob(JobDetail jobDetail,
Trigger trigger)
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
Date |
scheduleJob(Trigger trigger)
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
void |
scheduleJobs(Map<JobDetail,Set<? extends Trigger>> triggersAndJobs,
boolean replace)
Schedule all of the given jobs with the related set of triggers.
|
void |
setJobFactory(JobFactory factory)
Set the
JobFactory that will be responsible for producing
instances of Job classes. |
void |
shutdown()
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
void |
shutdown(boolean waitForJobsToComplete)
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
void |
standby()
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
void |
start()
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
void |
startDelayed(int seconds)
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
void |
triggerJob(JobKey jobKey)
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
void |
triggerJob(JobKey jobKey,
JobDataMap data)
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
boolean |
unscheduleJob(TriggerKey triggerKey)
Calls the equivalent method on the 'proxied'
QuartzScheduler. |
boolean |
unscheduleJobs(List<TriggerKey> triggerKeys)
Remove all of the indicated
s from the scheduler. |
public StdScheduler(QuartzScheduler sched)
Construct a StdScheduler instance to proxy the given
QuartzScheduler instance, and with the given SchedulingContext.
public String getSchedulerName()
Returns the name of the Scheduler.
getSchedulerName in interface Schedulerpublic String getSchedulerInstanceId()
Returns the instance Id of the Scheduler.
getSchedulerInstanceId in interface Schedulerpublic SchedulerMetaData getMetaData()
SchedulerSchedulerMetaData object 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.
getMetaData in interface Schedulerpublic SchedulerContext getContext() throws SchedulerException
Returns the SchedulerContext of the Scheduler.
getContext in interface SchedulerSchedulerExceptionpublic void start()
throws SchedulerException
Calls the equivalent method on the 'proxied' QuartzScheduler.
start in interface SchedulerSchedulerException - if shutdown() has been called, or there is an
error within the Scheduler.Scheduler.startDelayed(int),
Scheduler.standby(),
Scheduler.shutdown()public void startDelayed(int seconds)
throws SchedulerException
Calls the equivalent method on the 'proxied' QuartzScheduler.
startDelayed in interface SchedulerSchedulerException - if shutdown() has been called, or there is an
error within the Scheduler.Scheduler.start(),
Scheduler.standby(),
Scheduler.shutdown()public void standby()
Calls the equivalent method on the 'proxied' QuartzScheduler.
standby in interface SchedulerScheduler.start(),
Scheduler.pauseAll()public boolean isStarted()
Note: This only reflects whether has ever
been called on this Scheduler, so it will return start()true even
if the Scheduler is currently in standby mode or has been
since shutdown.
isStarted in interface Schedulerstart(),
isShutdown(),
isInStandbyMode()public boolean isInStandbyMode()
Calls the equivalent method on the 'proxied' QuartzScheduler.
isInStandbyMode in interface SchedulerScheduler.standby(),
Scheduler.start()public void shutdown()
Calls the equivalent method on the 'proxied' QuartzScheduler.
shutdown in interface SchedulerScheduler.shutdown(boolean)public void shutdown(boolean waitForJobsToComplete)
Calls the equivalent method on the 'proxied' QuartzScheduler.
shutdown in interface SchedulerwaitForJobsToComplete - if true the scheduler will not allow this method
to return until all currently executing jobs have completed.Scheduler.shutdown()public boolean isShutdown()
Calls the equivalent method on the 'proxied' QuartzScheduler.
isShutdown in interface Schedulerpublic List<JobExecutionContext> getCurrentlyExecutingJobs()
Calls the equivalent method on the 'proxied' QuartzScheduler.
getCurrentlyExecutingJobs in interface SchedulerJobExecutionContextpublic void clear()
throws SchedulerException
Calls the equivalent method on the 'proxied' QuartzScheduler.
clear in interface SchedulerSchedulerExceptionpublic Date scheduleJob(JobDetail jobDetail, Trigger trigger) throws SchedulerException
Calls the equivalent method on the 'proxied' QuartzScheduler.
scheduleJob in interface SchedulerSchedulerException - if the Job or Trigger cannot be added to the Scheduler, or
there is an internal Scheduler error.public Date scheduleJob(Trigger trigger) throws SchedulerException
Calls the equivalent method on the 'proxied' QuartzScheduler.
scheduleJob in interface SchedulerSchedulerException - if the indicated Job does not exist, or the Trigger cannot be
added to the Scheduler, or there is an internal Scheduler
error.public void addJob(JobDetail jobDetail, boolean replace) throws SchedulerException
Calls the equivalent method on the 'proxied' QuartzScheduler.
addJob in interface SchedulerSchedulerException - if there is an internal Scheduler error, or if the Job is not
durable, or a Job with the same name already exists, and
replace is false.Scheduler.addJob(JobDetail, boolean, boolean)public void addJob(JobDetail jobDetail, boolean replace, boolean storeNonDurableWhileAwaitingScheduling) throws SchedulerException
SchedulerJob to the Scheduler - with no associated
Trigger. The Job will be 'dormant' until
it is scheduled with a Trigger, or Scheduler.triggerJob()
is called for it.
With the storeNonDurableWhileAwaitingScheduling parameter
set to true, 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).
addJob in interface SchedulerSchedulerException - if there is an internal Scheduler error, or if the Job is not
durable, or a Job with the same name already exists, and
replace is false.public boolean deleteJobs(List<JobKey> jobKeys) throws SchedulerException
SchedulerJobs from the Scheduler - and any
associated Triggers.
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).
deleteJobs in interface SchedulerSchedulerException - if there is an internal Scheduler error.public void scheduleJobs(Map<JobDetail,Set<? extends Trigger>> triggersAndJobs, boolean replace) throws SchedulerException
SchedulerIf 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.
scheduleJobs in interface SchedulerObjectAlreadyExistsException - if the job/trigger keys
are not unique and the replace flag is not set to true.SchedulerExceptionpublic void scheduleJob(JobDetail jobDetail, Set<? extends Trigger> triggersForJob, boolean replace) throws SchedulerException
SchedulerIf 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.
scheduleJob in interface SchedulerObjectAlreadyExistsException - if the job/trigger keys
are not unique and the replace flag is not set to true.SchedulerExceptionpublic boolean unscheduleJobs(List<TriggerKey> triggerKeys) throws SchedulerException
SchedulerTriggers from the scheduler.
If 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).
unscheduleJobs in interface SchedulerSchedulerExceptionpublic boolean deleteJob(JobKey jobKey) throws SchedulerException
Calls the equivalent method on the 'proxied' QuartzScheduler.
deleteJob in interface SchedulerSchedulerException - if there is an internal Scheduler error.public boolean unscheduleJob(TriggerKey triggerKey) throws SchedulerException
Calls the equivalent method on the 'proxied' QuartzScheduler.
unscheduleJob in interface SchedulerSchedulerExceptionpublic Date rescheduleJob(TriggerKey triggerKey, Trigger newTrigger) throws SchedulerException
Calls the equivalent method on the 'proxied' QuartzScheduler.
rescheduleJob in interface SchedulertriggerKey - identity of the trigger to replacenewTrigger - The new Trigger to be stored.null if a Trigger with the given
name & 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.SchedulerExceptionpublic void triggerJob(JobKey jobKey) throws SchedulerException
Calls the equivalent method on the 'proxied' QuartzScheduler.
triggerJob in interface SchedulerSchedulerExceptionpublic void triggerJob(JobKey jobKey, JobDataMap data) throws SchedulerException
Calls the equivalent method on the 'proxied' QuartzScheduler.
triggerJob in interface Schedulerdata - the (possibly null) JobDataMap to be
associated with the trigger that fires the job immediately.SchedulerExceptionpublic void pauseTrigger(TriggerKey triggerKey) throws SchedulerException
Calls the equivalent method on the 'proxied' QuartzScheduler.
pauseTrigger in interface SchedulerSchedulerExceptionScheduler.resumeTrigger(TriggerKey)public void pauseTriggers(GroupMatcher<TriggerKey> matcher) throws SchedulerException
Calls the equivalent method on the 'proxied' QuartzScheduler.
pauseTriggers in interface Schedulermatcher - The matcher to evaluate against know groupsSchedulerExceptionScheduler.resumeTriggers(org.quartz.impl.matchers.GroupMatcher)public void pauseJob(JobKey jobKey) throws SchedulerException
Calls the equivalent method on the 'proxied' QuartzScheduler.
pauseJob in interface SchedulerSchedulerExceptionScheduler.resumeJob(JobKey)public Set<String> getPausedTriggerGroups() throws SchedulerException
SchedulerTrigger groups that are paused.getPausedTriggerGroups in interface SchedulerSchedulerExceptionScheduler.getPausedTriggerGroups()public void pauseJobs(GroupMatcher<JobKey> matcher) throws SchedulerException
Calls the equivalent method on the 'proxied' QuartzScheduler.
pauseJobs in interface Schedulermatcher - The matcher to evaluate against know groupsSchedulerException - On errorScheduler.resumeJobs(org.quartz.impl.matchers.GroupMatcher)public void resumeTrigger(TriggerKey triggerKey) throws SchedulerException
Calls the equivalent method on the 'proxied' QuartzScheduler.
resumeTrigger in interface SchedulerSchedulerExceptionScheduler.pauseTrigger(TriggerKey)public void resumeTriggers(GroupMatcher<TriggerKey> matcher) throws SchedulerException
Calls the equivalent method on the 'proxied' QuartzScheduler.
resumeTriggers in interface Schedulermatcher - The matcher to evaluate against know paused groupsSchedulerException - On errorScheduler.pauseTriggers(org.quartz.impl.matchers.GroupMatcher)public void resumeJob(JobKey jobKey) throws SchedulerException
Calls the equivalent method on the 'proxied' QuartzScheduler.
resumeJob in interface SchedulerSchedulerExceptionScheduler.pauseJob(JobKey)public void resumeJobs(GroupMatcher<JobKey> matcher) throws SchedulerException
Calls the equivalent method on the 'proxied' QuartzScheduler.
resumeJobs in interface Schedulermatcher - The matcher to evaluate against known paused groupsSchedulerException - On errorScheduler.pauseJobs(GroupMatcher)public void pauseAll()
throws SchedulerException
Calls the equivalent method on the 'proxied' QuartzScheduler.
pauseAll in interface SchedulerSchedulerExceptionScheduler.resumeAll(),
Scheduler.pauseTriggers(org.quartz.impl.matchers.GroupMatcher),
Scheduler.standby()public void resumeAll()
throws SchedulerException
Calls the equivalent method on the 'proxied' QuartzScheduler.
resumeAll in interface SchedulerSchedulerExceptionScheduler.pauseAll()public List<String> getJobGroupNames() throws SchedulerException
Calls the equivalent method on the 'proxied' QuartzScheduler.
getJobGroupNames in interface SchedulerSchedulerExceptionpublic List<? extends Trigger> getTriggersOfJob(JobKey jobKey) throws SchedulerException
Calls the equivalent method on the 'proxied' QuartzScheduler.
getTriggersOfJob in interface SchedulerSchedulerExceptionpublic Set<JobKey> getJobKeys(GroupMatcher<JobKey> matcher) throws SchedulerException
Calls the equivalent method on the 'proxied' QuartzScheduler.
getJobKeys in interface Schedulermatcher - Matcher to evaluate against known groupsSchedulerException - On errorpublic List<String> getTriggerGroupNames() throws SchedulerException
Calls the equivalent method on the 'proxied' QuartzScheduler.
getTriggerGroupNames in interface SchedulerSchedulerExceptionpublic Set<TriggerKey> getTriggerKeys(GroupMatcher<TriggerKey> matcher) throws SchedulerException
Calls the equivalent method on the 'proxied' QuartzScheduler.
getTriggerKeys in interface Schedulermatcher - Matcher to evaluate against known groupsSchedulerException - On errorpublic JobDetail getJobDetail(JobKey jobKey) throws SchedulerException
Calls the equivalent method on the 'proxied' QuartzScheduler.
getJobDetail in interface SchedulerSchedulerExceptionpublic Trigger getTrigger(TriggerKey triggerKey) throws SchedulerException
Calls the equivalent method on the 'proxied' QuartzScheduler.
getTrigger in interface SchedulerSchedulerExceptionpublic Trigger.TriggerState getTriggerState(TriggerKey triggerKey) throws SchedulerException
Calls the equivalent method on the 'proxied' QuartzScheduler.
getTriggerState in interface SchedulerSchedulerExceptionTrigger.TriggerStatepublic void resetTriggerFromErrorState(TriggerKey triggerKey) throws SchedulerException
Trigger
from Trigger.TriggerState.ERROR to Trigger.TriggerState.NORMAL or
Trigger.TriggerState.PAUSED as 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.
resetTriggerFromErrorState in interface SchedulerSchedulerExceptionTrigger.TriggerStatepublic void addCalendar(String calName, Calendar calendar, boolean replace, boolean updateTriggers) throws SchedulerException
Calls the equivalent method on the 'proxied' QuartzScheduler.
addCalendar in interface SchedulerupdateTriggers - whether or not to update existing triggers that
referenced the already existing calendar so that they are 'correct'
based on the new trigger.SchedulerException - if there is an internal Scheduler error, or a Calendar with
the same name already exists, and replace is
false.public boolean deleteCalendar(String calName) throws SchedulerException
Calls the equivalent method on the 'proxied' QuartzScheduler.
deleteCalendar in interface SchedulerSchedulerException - if there is an internal Scheduler error, or one or more
triggers reference the calendarpublic Calendar getCalendar(String calName) throws SchedulerException
Calls the equivalent method on the 'proxied' QuartzScheduler.
getCalendar in interface SchedulerSchedulerExceptionpublic List<String> getCalendarNames() throws SchedulerException
Calls the equivalent method on the 'proxied' QuartzScheduler.
getCalendarNames in interface SchedulerSchedulerExceptionpublic boolean checkExists(JobKey jobKey) throws SchedulerException
Calls the equivalent method on the 'proxied' QuartzScheduler.
checkExists in interface SchedulerjobKey - the identifier to check forSchedulerExceptionpublic boolean checkExists(TriggerKey triggerKey) throws SchedulerException
Calls the equivalent method on the 'proxied' QuartzScheduler.
checkExists in interface SchedulertriggerKey - the identifier to check forSchedulerExceptionpublic void setJobFactory(JobFactory factory) throws SchedulerException
SchedulerJobFactory that will be responsible for producing
instances of Job classes.
JobFactories may be of use to those wishing to have their application
produce Job instances via some special mechanism, such as to
give the opportunity for dependency injection.
setJobFactory in interface SchedulerSchedulerExceptionScheduler.setJobFactory(org.quartz.spi.JobFactory)public ListenerManager getListenerManager() throws SchedulerException
SchedulerListenerManager,
through which listeners may be registered.getListenerManager in interface SchedulerListenerManagerSchedulerException - if the scheduler is not localScheduler.getListenerManager()public boolean interrupt(JobKey jobKey) throws UnableToInterruptJobException
SchedulerJob, which
must be an implementor of the InterruptableJob interface.
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 that
interrupt() on one instances throws an exception, all
remaining instances (that have not yet been interrupted) will not have
their interrupt() 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.
interrupt in interface SchedulerUnableToInterruptJobException - if the job does not implement
InterruptableJob, or there is an exception while
interrupting the job.InterruptableJob.interrupt(),
Scheduler.getCurrentlyExecutingJobs(),
Scheduler.interrupt(String)public boolean interrupt(String fireInstanceId) throws UnableToInterruptJobException
SchedulerJob instance, which
must be an implementor of the InterruptableJob interface.
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.
interrupt in interface SchedulerfireInstanceId - the unique identifier of the job instance to
be interrupted (see JobExecutionContext.getFireInstanceId()UnableToInterruptJobException - if the job does not implement
InterruptableJob, or there is an exception while
interrupting the job.InterruptableJob.interrupt(),
Scheduler.getCurrentlyExecutingJobs(),
JobExecutionContext.getFireInstanceId(),
Scheduler.interrupt(JobKey)Copyright 2001-2019, Terracotta, Inc.