|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.quartz.simpl.RAMJobStore
public class RAMJobStore
This class implements a
that
utilizes RAM as its storage device.
JobStore
As you should know, the ramification of this is that access is extrememly
fast, but the data is completely volatile - therefore this JobStore
should not be used if true persistence between program shutdowns is
required.
Field Summary | |
---|---|
protected java.util.HashSet |
blockedJobs
|
protected java.util.HashMap |
calendarsByName
|
protected java.util.HashMap |
jobsByFQN
|
protected java.util.HashMap |
jobsByGroup
|
protected java.lang.Object |
lock
|
protected long |
misfireThreshold
|
protected java.util.HashSet |
pausedJobGroups
|
protected java.util.HashSet |
pausedTriggerGroups
|
protected SchedulerSignaler |
signaler
|
protected java.util.TreeSet |
timeTriggers
|
protected java.util.ArrayList |
triggers
|
protected java.util.HashMap |
triggersByFQN
|
protected java.util.HashMap |
triggersByGroup
|
Constructor Summary | |
---|---|
RAMJobStore()
Create a new RAMJobStore . |
Method Summary | |
---|---|
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. |
protected boolean |
applyMisfire(org.quartz.simpl.TriggerWrapper tw)
|
java.lang.String[] |
getCalendarNames(SchedulingContext ctxt)
Get the names of all of the s
in the JobStore . |
long |
getEstimatedTimeToReleaseAndAcquireTrigger()
How long (in milliseconds) the JobStore implementation
estimates that it will take to release a trigger and acquire a new one. |
protected java.lang.String |
getFiredTriggerRecordId()
|
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. |
protected org.slf4j.Logger |
getLog()
|
long |
getMisfireThreshold()
|
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 groupName)
Get the current state of the identified . |
protected java.util.ArrayList |
getTriggerWrappersForCalendar(java.lang.String calName)
|
protected java.util.ArrayList |
getTriggerWrappersForJob(java.lang.String jobName,
java.lang.String groupName)
|
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. |
boolean |
isClustered()
Whether or not the JobStore implementation is clustered. |
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. |
protected java.lang.String |
peekTriggers()
|
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)
Remove (delete) the with the given
name, and any s that reference
it. |
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)
Retrieve the for the given
. |
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. |
protected void |
setAllTriggersOfJobToState(java.lang.String jobName,
java.lang.String jobGroup,
int state)
|
void |
setInstanceId(java.lang.String schedInstId)
Inform the JobStore of the Scheduler instance's Id,
prior to initialize being invoked. |
void |
setInstanceName(java.lang.String schedName)
Inform the JobStore of the Scheduler instance's name,
prior to initialize being invoked. |
void |
setMisfireThreshold(long misfireThreshold)
The number of milliseconds by which a trigger must have missed its next-fire-time, in order for it to be considered "misfired" and thus have its misfire instruction applied. |
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)
Store the given and . |
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 its
associated Job ), 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). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.HashMap jobsByFQN
protected java.util.HashMap triggersByFQN
protected java.util.HashMap jobsByGroup
protected java.util.HashMap triggersByGroup
protected java.util.TreeSet timeTriggers
protected java.util.HashMap calendarsByName
protected java.util.ArrayList triggers
protected final java.lang.Object lock
protected java.util.HashSet pausedTriggerGroups
protected java.util.HashSet pausedJobGroups
protected java.util.HashSet blockedJobs
protected long misfireThreshold
protected SchedulerSignaler signaler
Constructor Detail |
---|
public RAMJobStore()
Create a new RAMJobStore
.
Method Detail |
---|
protected org.slf4j.Logger getLog()
public 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.
initialize
in interface JobStore
public void schedulerStarted() throws SchedulerException
JobStore
Called by the QuartzScheduler to inform the JobStore
that
the scheduler has started.
schedulerStarted
in interface JobStore
SchedulerException
public long getMisfireThreshold()
public void setMisfireThreshold(long misfireThreshold)
misfireThreshold
- public 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.
shutdown
in interface JobStore
public boolean supportsPersistence()
supportsPersistence
in interface JobStore
public void storeJobAndTrigger(SchedulingContext ctxt, JobDetail newJob, Trigger newTrigger) throws JobPersistenceException
Store the given
and JobDetail
.
Trigger
storeJobAndTrigger
in interface JobStore
newJob
- The JobDetail
to be stored.newTrigger
- The Trigger
to be stored.
ObjectAlreadyExistsException
- if a Job
with the same name/group already
exists.
JobPersistenceException
public void storeJob(SchedulingContext ctxt, JobDetail newJob, boolean replaceExisting) throws ObjectAlreadyExistsException
Store the given
.
Job
storeJob
in interface JobStore
newJob
- The Job
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.public boolean removeJob(SchedulingContext ctxt, java.lang.String jobName, java.lang.String groupName)
Remove (delete) the
with the given
name, and any Job
s that reference
it.
Trigger
removeJob
in interface JobStore
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.public void storeTrigger(SchedulingContext ctxt, Trigger newTrigger, boolean replaceExisting) throws JobPersistenceException
Store the given
.
Trigger
storeTrigger
in interface JobStore
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)
public boolean removeTrigger(SchedulingContext ctxt, java.lang.String triggerName, java.lang.String groupName)
Remove (delete) the
with the
given name.
Trigger
removeTrigger
in interface JobStore
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.public boolean replaceTrigger(SchedulingContext ctxt, java.lang.String triggerName, java.lang.String groupName, Trigger newTrigger) throws JobPersistenceException
JobStore
Remove (delete) the
with the
given name, and store the new given one - which must be associated
with the same job.
Trigger
replaceTrigger
in interface JobStore
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
JobStore.replaceTrigger(org.quartz.core.SchedulingContext, java.lang.String, java.lang.String, org.quartz.Trigger)
public JobDetail retrieveJob(SchedulingContext ctxt, java.lang.String jobName, java.lang.String groupName)
Retrieve the
for the given
JobDetail
.
Job
retrieveJob
in interface JobStore
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.public Trigger retrieveTrigger(SchedulingContext ctxt, java.lang.String triggerName, java.lang.String groupName)
Retrieve the given
.
Trigger
retrieveTrigger
in interface JobStore
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.public int getTriggerState(SchedulingContext ctxt, java.lang.String triggerName, java.lang.String groupName) throws JobPersistenceException
Get the current state of the identified
.
Trigger
getTriggerState
in interface JobStore
JobPersistenceException
Trigger.STATE_NORMAL
,
Trigger.STATE_PAUSED
,
Trigger.STATE_COMPLETE
,
Trigger.STATE_ERROR
,
Trigger.STATE_BLOCKED
,
Trigger.STATE_NONE
public void storeCalendar(SchedulingContext ctxt, java.lang.String name, Calendar calendar, boolean replaceExisting, boolean updateTriggers) throws ObjectAlreadyExistsException
Store the given
.
Calendar
storeCalendar
in interface JobStore
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.public 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
Trigger
s pointing to non-existent calendars, then a
JobPersistenceException
will be thrown.
removeCalendar
in interface JobStore
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
public Calendar retrieveCalendar(SchedulingContext ctxt, java.lang.String calName)
Retrieve the given
.
Trigger
retrieveCalendar
in interface JobStore
calName
- The name of the Calendar
to be retrieved.
Calendar
, or null if there is no
match.public int getNumberOfJobs(SchedulingContext ctxt)
Get the number of
s that are
stored in the JobDetail
JobsStore
.
getNumberOfJobs
in interface JobStore
public int getNumberOfTriggers(SchedulingContext ctxt)
Get the number of
s that are
stored in the Trigger
JobsStore
.
getNumberOfTriggers
in interface JobStore
public int getNumberOfCalendars(SchedulingContext ctxt)
Get the number of
s that are
stored in the Calendar
JobsStore
.
getNumberOfCalendars
in interface JobStore
public java.lang.String[] getJobNames(SchedulingContext ctxt, java.lang.String groupName)
Get the names of all of the
s that
have the given group name.
Job
getJobNames
in interface JobStore
public java.lang.String[] getCalendarNames(SchedulingContext ctxt)
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
).
getCalendarNames
in interface JobStore
public 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
getTriggerNames
in interface JobStore
public java.lang.String[] getJobGroupNames(SchedulingContext ctxt)
Get the names of all of the
groups.
Job
getJobGroupNames
in interface JobStore
public java.lang.String[] getTriggerGroupNames(SchedulingContext ctxt)
Get the names of all of the
groups.
Trigger
getTriggerGroupNames
in interface JobStore
public Trigger[] getTriggersForJob(SchedulingContext ctxt, java.lang.String jobName, java.lang.String groupName)
Get all of the Triggers that are associated to the given Job.
If there are no matches, a zero-length array should be returned.
getTriggersForJob
in interface JobStore
protected java.util.ArrayList getTriggerWrappersForJob(java.lang.String jobName, java.lang.String groupName)
protected java.util.ArrayList getTriggerWrappersForCalendar(java.lang.String calName)
public void pauseTrigger(SchedulingContext ctxt, java.lang.String triggerName, java.lang.String groupName)
Pause the
with the given name.
Trigger
pauseTrigger
in interface JobStore
JobStore.resumeTrigger(SchedulingContext, String, String)
public void pauseTriggerGroup(SchedulingContext ctxt, java.lang.String groupName)
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.
pauseTriggerGroup
in interface JobStore
JobStore.resumeTriggerGroup(SchedulingContext, String)
public void pauseJob(SchedulingContext ctxt, java.lang.String jobName, java.lang.String groupName)
Pause the
with the given
name - by pausing all of its current JobDetail
Trigger
s.
pauseJob
in interface JobStore
JobStore.resumeJob(SchedulingContext, String, String)
public void pauseJobGroup(SchedulingContext ctxt, java.lang.String groupName)
Pause all of the
in the
given group - by pausing all of their JobDetail
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.
pauseJobGroup
in interface JobStore
JobStore.resumeJobGroup(SchedulingContext, String)
public void resumeTrigger(SchedulingContext ctxt, java.lang.String triggerName, java.lang.String groupName)
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.
resumeTrigger
in interface JobStore
JobStore.pauseTrigger(SchedulingContext, String, String)
public void resumeTriggerGroup(SchedulingContext ctxt, java.lang.String groupName)
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.
resumeTriggerGroup
in interface JobStore
JobStore.pauseTriggerGroup(SchedulingContext, String)
public void resumeJob(SchedulingContext ctxt, java.lang.String jobName, java.lang.String groupName)
Resume (un-pause) the
with
the given name.
JobDetail
If any of the Job
'sTrigger
s missed one
or more fire-times, then the Trigger
's misfire
instruction will be applied.
resumeJob
in interface JobStore
JobStore.pauseJob(SchedulingContext, String, String)
public void resumeJobGroup(SchedulingContext ctxt, java.lang.String groupName)
Resume (un-pause) all of the
in the given group.
JobDetail
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.
resumeJobGroup
in interface JobStore
JobStore.pauseJobGroup(SchedulingContext, String)
public void pauseAll(SchedulingContext ctxt)
Pause all triggers - equivalent of calling pauseTriggerGroup(group)
on every group.
When resumeAll()
is called (to un-pause), trigger misfire
instructions WILL be applied.
pauseAll
in interface JobStore
resumeAll(SchedulingContext)
,
pauseTriggerGroup(SchedulingContext, String)
public void resumeAll(SchedulingContext ctxt)
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.
resumeAll
in interface JobStore
pauseAll(SchedulingContext)
protected boolean applyMisfire(org.quartz.simpl.TriggerWrapper tw)
protected java.lang.String getFiredTriggerRecordId()
public 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.
acquireNextTrigger
in interface JobStore
noLaterThan
- If > 0, the JobStore should only return a Trigger
that will fire no later than the time represented in this value as
milliseconds.releaseAcquiredTrigger(SchedulingContext, Trigger)
public 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).
releaseAcquiredTrigger
in interface JobStore
public 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).
triggerFired
in interface JobStore
public 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 its
associated Job
), and that the
in the given JobDataMap
JobDetail
should be updated if the Job
is stateful.
triggeredJobComplete
in interface JobStore
protected void setAllTriggersOfJobToState(java.lang.String jobName, java.lang.String jobGroup, int state)
protected java.lang.String peekTriggers()
public java.util.Set getPausedTriggerGroups(SchedulingContext ctxt) throws JobPersistenceException
getPausedTriggerGroups
in interface JobStore
JobPersistenceException
JobStore.getPausedTriggerGroups(org.quartz.core.SchedulingContext)
public void setInstanceId(java.lang.String schedInstId)
JobStore
Inform the JobStore
of the Scheduler instance's Id,
prior to initialize being invoked.
setInstanceId
in interface JobStore
public void setInstanceName(java.lang.String schedName)
JobStore
Inform the JobStore
of the Scheduler instance's name,
prior to initialize being invoked.
setInstanceName
in interface JobStore
public long getEstimatedTimeToReleaseAndAcquireTrigger()
JobStore
JobStore
implementation
estimates that it will take to release a trigger and acquire a new one.
getEstimatedTimeToReleaseAndAcquireTrigger
in interface JobStore
public boolean isClustered()
JobStore
JobStore
implementation is clustered.
isClustered
in interface JobStore
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |