public interface JobStore
The interface to be implemented by classes that want to provide a
and Job
storage mechanism for the
Trigger
's use.
QuartzScheduler
Storage of Job
s and Trigger
s should be keyed
on the combination of their name and group for uniqueness.
QuartzScheduler
,
Trigger
,
Job
,
JobDetail
,
JobDataMap
,
Calendar
Modifier and Type | Method and Description |
---|---|
Trigger |
acquireNextTrigger(SchedulingContext ctxt,
long noLaterThan)
Get a handle to the next trigger to be fired, and mark it as 'reserved'
by the calling scheduler.
|
java.lang.String[] |
getCalendarNames(SchedulingContext ctxt)
Get the names of all of the
s
in the JobStore . |
java.lang.String[] |
getJobGroupNames(SchedulingContext ctxt)
Get the names of all of the
groups. |
java.lang.String[] |
getJobNames(SchedulingContext ctxt,
java.lang.String groupName)
Get the names of all of the
s that
have the given group name. |
int |
getNumberOfCalendars(SchedulingContext ctxt)
Get the number of
s that are
stored in the JobsStore . |
int |
getNumberOfJobs(SchedulingContext ctxt)
Get the number of
s that are
stored in the JobsStore . |
int |
getNumberOfTriggers(SchedulingContext ctxt)
Get the number of
s that are
stored in the JobsStore . |
java.util.Set |
getPausedTriggerGroups(SchedulingContext ctxt) |
java.lang.String[] |
getTriggerGroupNames(SchedulingContext ctxt)
Get the names of all of the
groups. |
java.lang.String[] |
getTriggerNames(SchedulingContext ctxt,
java.lang.String groupName)
Get the names of all of the
s
that have the given group name. |
Trigger[] |
getTriggersForJob(SchedulingContext ctxt,
java.lang.String jobName,
java.lang.String groupName)
Get all of the Triggers that are associated to the given Job.
|
int |
getTriggerState(SchedulingContext ctxt,
java.lang.String triggerName,
java.lang.String triggerGroup)
Get the current state of the identified
. |
void |
initialize(ClassLoadHelper loadHelper,
SchedulerSignaler signaler)
Called by the QuartzScheduler before the
JobStore is
used, in order to give the it a chance to initialize. |
void |
pauseAll(SchedulingContext ctxt)
Pause all triggers - equivalent of calling
pauseTriggerGroup(group)
on every group. |
void |
pauseJob(SchedulingContext ctxt,
java.lang.String jobName,
java.lang.String groupName)
Pause the
with the given name - by
pausing all of its current Trigger s. |
void |
pauseJobGroup(SchedulingContext ctxt,
java.lang.String groupName)
Pause all of the
in the given
group - by pausing all of their Trigger s. |
void |
pauseTrigger(SchedulingContext ctxt,
java.lang.String triggerName,
java.lang.String groupName)
Pause the
with the given name. |
void |
pauseTriggerGroup(SchedulingContext ctxt,
java.lang.String groupName)
Pause all of the
in the
given group. |
void |
releaseAcquiredTrigger(SchedulingContext ctxt,
Trigger trigger)
Inform the
JobStore that the scheduler no longer plans to
fire the given Trigger , that it had previously acquired
(reserved). |
boolean |
removeCalendar(SchedulingContext ctxt,
java.lang.String calName)
Remove (delete) the
with the
given name. |
boolean |
removeJob(SchedulingContext ctxt,
java.lang.String jobName,
java.lang.String groupName)
|
boolean |
removeTrigger(SchedulingContext ctxt,
java.lang.String triggerName,
java.lang.String groupName)
Remove (delete) the
with the
given name. |
boolean |
replaceTrigger(SchedulingContext ctxt,
java.lang.String triggerName,
java.lang.String groupName,
Trigger newTrigger)
Remove (delete) the
with the
given name, and store the new given one - which must be associated
with the same job. |
void |
resumeAll(SchedulingContext ctxt)
Resume (un-pause) all triggers - equivalent of calling
resumeTriggerGroup(group)
on every group. |
void |
resumeJob(SchedulingContext ctxt,
java.lang.String jobName,
java.lang.String groupName)
Resume (un-pause) the
with the
given name. |
void |
resumeJobGroup(SchedulingContext ctxt,
java.lang.String groupName)
Resume (un-pause) all of the
in
the given group. |
void |
resumeTrigger(SchedulingContext ctxt,
java.lang.String triggerName,
java.lang.String groupName)
Resume (un-pause) the
with the
given name. |
void |
resumeTriggerGroup(SchedulingContext ctxt,
java.lang.String groupName)
Resume (un-pause) all of the
in the given group. |
Calendar |
retrieveCalendar(SchedulingContext ctxt,
java.lang.String calName)
Retrieve the given
. |
JobDetail |
retrieveJob(SchedulingContext ctxt,
java.lang.String jobName,
java.lang.String groupName)
|
Trigger |
retrieveTrigger(SchedulingContext ctxt,
java.lang.String triggerName,
java.lang.String groupName)
Retrieve the given
. |
void |
schedulerStarted()
Called by the QuartzScheduler to inform the
JobStore that
the scheduler has started. |
void |
shutdown()
Called by the QuartzScheduler to inform the
JobStore that
it should free up all of it's resources because the scheduler is
shutting down. |
void |
storeCalendar(SchedulingContext ctxt,
java.lang.String name,
Calendar calendar,
boolean replaceExisting,
boolean updateTriggers)
Store the given
. |
void |
storeJob(SchedulingContext ctxt,
JobDetail newJob,
boolean replaceExisting)
Store the given
. |
void |
storeJobAndTrigger(SchedulingContext ctxt,
JobDetail newJob,
Trigger newTrigger)
|
void |
storeTrigger(SchedulingContext ctxt,
Trigger newTrigger,
boolean replaceExisting)
Store the given
. |
boolean |
supportsPersistence() |
void |
triggeredJobComplete(SchedulingContext ctxt,
Trigger trigger,
JobDetail jobDetail,
int triggerInstCode)
Inform the
JobStore that the scheduler has completed the
firing of the given Trigger (and the execution of its
associated Job completed, threw an exception, or was vetoed),
and that the
in the given JobDetail should be updated if the Job
is stateful. |
TriggerFiredBundle |
triggerFired(SchedulingContext ctxt,
Trigger trigger)
Inform the
JobStore that the scheduler is now firing the
given Trigger (executing its associated Job ),
that it had previously acquired (reserved). |
void initialize(ClassLoadHelper loadHelper, SchedulerSignaler signaler) throws SchedulerConfigException
Called by the QuartzScheduler before the JobStore
is
used, in order to give the it a chance to initialize.
SchedulerConfigException
void schedulerStarted() throws SchedulerException
Called by the QuartzScheduler to inform the JobStore
that
the scheduler has started.
SchedulerException
void shutdown()
Called by the QuartzScheduler to inform the JobStore
that
it should free up all of it's resources because the scheduler is
shutting down.
boolean supportsPersistence()
void storeJobAndTrigger(SchedulingContext ctxt, JobDetail newJob, Trigger newTrigger) throws ObjectAlreadyExistsException, JobPersistenceException
newJob
- The JobDetail
to be stored.newTrigger
- The Trigger
to be stored.ObjectAlreadyExistsException
- if a Job
with the same name/group already
exists.JobPersistenceException
void storeJob(SchedulingContext ctxt, JobDetail newJob, boolean replaceExisting) throws ObjectAlreadyExistsException, JobPersistenceException
Store the given
.
JobDetail
newJob
- The JobDetail
to be stored.replaceExisting
- If true
, any Job
existing in the
JobStore
with the same name & group should be
over-written.ObjectAlreadyExistsException
- if a Job
with the same name/group already
exists, and replaceExisting is set to false.JobPersistenceException
boolean removeJob(SchedulingContext ctxt, java.lang.String jobName, java.lang.String groupName) throws JobPersistenceException
Remove (delete) the
with the given
name, and any Job
s that reference
it.
Trigger
If removal of the Job
results in an empty group, the
group should be removed from the JobStore
's list of
known group names.
jobName
- The name of the Job
to be removed.groupName
- The group name of the Job
to be removed.true
if a Job
with the given name &
group was found and removed from the store.JobPersistenceException
JobDetail retrieveJob(SchedulingContext ctxt, java.lang.String jobName, java.lang.String groupName) throws JobPersistenceException
jobName
- The name of the Job
to be retrieved.groupName
- The group name of the Job
to be retrieved.Job
, or null if there is no match.JobPersistenceException
void storeTrigger(SchedulingContext ctxt, Trigger newTrigger, boolean replaceExisting) throws ObjectAlreadyExistsException, JobPersistenceException
Store the given
.
Trigger
newTrigger
- The Trigger
to be stored.replaceExisting
- If true
, any Trigger
existing in
the JobStore
with the same name & group should
be over-written.ObjectAlreadyExistsException
- if a Trigger
with the same name/group already
exists, and replaceExisting is set to false.JobPersistenceException
pauseTriggerGroup(SchedulingContext, String)
boolean removeTrigger(SchedulingContext ctxt, java.lang.String triggerName, java.lang.String groupName) throws JobPersistenceException
Remove (delete) the
with the
given name.
Trigger
If removal of the Trigger
results in an empty group, the
group should be removed from the JobStore
's list of
known group names.
If removal of the Trigger
results in an 'orphaned' Job
that is not 'durable', then the Job
should be deleted
also.
triggerName
- The name of the Trigger
to be removed.groupName
- The group name of the Trigger
to be removed.true
if a Trigger
with the given
name & group was found and removed from the store.JobPersistenceException
boolean replaceTrigger(SchedulingContext ctxt, java.lang.String triggerName, java.lang.String groupName, Trigger newTrigger) throws JobPersistenceException
Remove (delete) the
with the
given name, and store the new given one - which must be associated
with the same job.
Trigger
triggerName
- The name of the Trigger
to be removed.groupName
- The group name of the Trigger
to be removed.newTrigger
- The new Trigger
to be stored.true
if a Trigger
with the given
name & group was found and removed from the store.JobPersistenceException
Trigger retrieveTrigger(SchedulingContext ctxt, java.lang.String triggerName, java.lang.String groupName) throws JobPersistenceException
Retrieve the given
.
Trigger
triggerName
- The name of the Trigger
to be retrieved.groupName
- The group name of the Trigger
to be retrieved.Trigger
, or null if there is no
match.JobPersistenceException
void storeCalendar(SchedulingContext ctxt, java.lang.String name, Calendar calendar, boolean replaceExisting, boolean updateTriggers) throws ObjectAlreadyExistsException, JobPersistenceException
Store the given
.
Calendar
calendar
- The Calendar
to be stored.replaceExisting
- If true
, any Calendar
existing
in the JobStore
with the same name & group
should be over-written.updateTriggers
- If true
, any Trigger
s existing
in the JobStore
that reference an existing
Calendar with the same name with have their next fire time
re-computed with the new Calendar
.ObjectAlreadyExistsException
- if a Calendar
with the same name already
exists, and replaceExisting is set to false.JobPersistenceException
boolean removeCalendar(SchedulingContext ctxt, java.lang.String calName) throws JobPersistenceException
Remove (delete) the
with the
given name.
Calendar
If removal of the Calendar
would result in
JobPersistenceException
will be thrown.
calName
- The name of the Calendar
to be removed.true
if a Calendar
with the given name
was found and removed from the store.JobPersistenceException
Calendar retrieveCalendar(SchedulingContext ctxt, java.lang.String calName) throws JobPersistenceException
Retrieve the given
.
Trigger
calName
- The name of the Calendar
to be retrieved.Calendar
, or null if there is no
match.JobPersistenceException
int getNumberOfJobs(SchedulingContext ctxt) throws JobPersistenceException
Get the number of
s that are
stored in the Job
JobsStore
.
JobPersistenceException
int getNumberOfTriggers(SchedulingContext ctxt) throws JobPersistenceException
Get the number of
s that are
stored in the Trigger
JobsStore
.
JobPersistenceException
int getNumberOfCalendars(SchedulingContext ctxt) throws JobPersistenceException
Get the number of
s that are
stored in the Calendar
JobsStore
.
JobPersistenceException
java.lang.String[] getJobNames(SchedulingContext ctxt, java.lang.String groupName) throws JobPersistenceException
Get the names of all of the
s that
have the given group name.
Job
If there are no jobs in the given group name, the result should be a
zero-length array (not null
).
JobPersistenceException
java.lang.String[] getTriggerNames(SchedulingContext ctxt, java.lang.String groupName) throws JobPersistenceException
Get the names of all of the
s
that have the given group name.
Trigger
If there are no triggers in the given group name, the result should be a
zero-length array (not null
).
JobPersistenceException
java.lang.String[] getJobGroupNames(SchedulingContext ctxt) throws JobPersistenceException
Get the names of all of the
groups.
Job
If there are no known group names, the result should be a zero-length
array (not null
).
JobPersistenceException
java.lang.String[] getTriggerGroupNames(SchedulingContext ctxt) throws JobPersistenceException
Get the names of all of the
groups.
Trigger
If there are no known group names, the result should be a zero-length
array (not null
).
JobPersistenceException
java.lang.String[] getCalendarNames(SchedulingContext ctxt) throws JobPersistenceException
Get the names of all of the
s
in the Calendar
JobStore
.
If there are no Calendars in the given group name, the result should be
a zero-length array (not null
).
JobPersistenceException
Trigger[] getTriggersForJob(SchedulingContext ctxt, java.lang.String jobName, java.lang.String groupName) throws JobPersistenceException
Get all of the Triggers that are associated to the given Job.
If there are no matches, a zero-length array should be returned.
JobPersistenceException
int getTriggerState(SchedulingContext ctxt, java.lang.String triggerName, java.lang.String triggerGroup) throws JobPersistenceException
Get the current state of the identified
.
Trigger
void pauseTrigger(SchedulingContext ctxt, java.lang.String triggerName, java.lang.String groupName) throws JobPersistenceException
Pause the
with the given name.
Trigger
void pauseTriggerGroup(SchedulingContext ctxt, java.lang.String groupName) throws JobPersistenceException
Pause all of the
in the
given group.
Trigger
s
The JobStore should "remember" that the group is paused, and impose the pause on any new triggers that are added to the group while the group is paused.
JobPersistenceException
resumeTriggerGroup(SchedulingContext, String)
void pauseJob(SchedulingContext ctxt, java.lang.String jobName, java.lang.String groupName) throws JobPersistenceException
Pause the
with the given name - by
pausing all of its current Job
Trigger
s.
JobPersistenceException
resumeJob(SchedulingContext, String, String)
void pauseJobGroup(SchedulingContext ctxt, java.lang.String groupName) throws JobPersistenceException
Pause all of the
in the given
group - by pausing all of their Job
sTrigger
s.
The JobStore should "remember" that the group is paused, and impose the pause on any new jobs that are added to the group while the group is paused.
JobPersistenceException
resumeJobGroup(SchedulingContext, String)
void resumeTrigger(SchedulingContext ctxt, java.lang.String triggerName, java.lang.String groupName) throws JobPersistenceException
Resume (un-pause) the
with the
given name.
Trigger
If the Trigger
missed one or more fire-times, then the
Trigger
's misfire instruction will be applied.
void resumeTriggerGroup(SchedulingContext ctxt, java.lang.String groupName) throws JobPersistenceException
Resume (un-pause) all of the
in the given group.
Trigger
s
If any Trigger
missed one or more fire-times, then the
Trigger
's misfire instruction will be applied.
JobPersistenceException
pauseTriggerGroup(SchedulingContext, String)
java.util.Set getPausedTriggerGroups(SchedulingContext ctxt) throws JobPersistenceException
JobPersistenceException
void resumeJob(SchedulingContext ctxt, java.lang.String jobName, java.lang.String groupName) throws JobPersistenceException
Resume (un-pause) the
with the
given name.
Job
If any of the Job
'sTrigger
s missed one
or more fire-times, then the Trigger
's misfire
instruction will be applied.
JobPersistenceException
pauseJob(SchedulingContext, String, String)
void resumeJobGroup(SchedulingContext ctxt, java.lang.String groupName) throws JobPersistenceException
Resume (un-pause) all of the
in
the given group.
Job
s
If any of the Job
s had Trigger
s that
missed one or more fire-times, then the Trigger
's
misfire instruction will be applied.
JobPersistenceException
pauseJobGroup(SchedulingContext, String)
void pauseAll(SchedulingContext ctxt) throws JobPersistenceException
Pause all triggers - equivalent of calling pauseTriggerGroup(group)
on every group.
When resumeAll()
is called (to un-pause), trigger misfire
instructions WILL be applied.
void resumeAll(SchedulingContext ctxt) throws JobPersistenceException
Resume (un-pause) all triggers - equivalent of calling resumeTriggerGroup(group)
on every group.
If any Trigger
missed one or more fire-times, then the
Trigger
's misfire instruction will be applied.
JobPersistenceException
pauseAll(SchedulingContext)
Trigger acquireNextTrigger(SchedulingContext ctxt, long noLaterThan) throws JobPersistenceException
Get a handle to the next trigger to be fired, and mark it as 'reserved' by the calling scheduler.
noLaterThan
- If > 0, the JobStore should only return a Trigger
that will fire no later than the time represented in this value as
milliseconds.JobPersistenceException
releaseAcquiredTrigger(SchedulingContext, Trigger)
void releaseAcquiredTrigger(SchedulingContext ctxt, Trigger trigger) throws JobPersistenceException
Inform the JobStore
that the scheduler no longer plans to
fire the given Trigger
, that it had previously acquired
(reserved).
JobPersistenceException
TriggerFiredBundle triggerFired(SchedulingContext ctxt, Trigger trigger) throws JobPersistenceException
Inform the JobStore
that the scheduler is now firing the
given Trigger
(executing its associated Job
),
that it had previously acquired (reserved).
JobPersistenceException
void triggeredJobComplete(SchedulingContext ctxt, Trigger trigger, JobDetail jobDetail, int triggerInstCode) throws JobPersistenceException
Inform the JobStore
that the scheduler has completed the
firing of the given Trigger
(and the execution of its
associated Job
completed, threw an exception, or was vetoed),
and that the
in the given JobDataMap
JobDetail
should be updated if the Job
is stateful.
JobPersistenceException