|
||||||||||
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<JobKey> |
blockedJobs
|
protected java.util.HashMap<java.lang.String,Calendar> |
calendarsByName
|
protected java.util.HashMap<java.lang.String,java.util.HashMap<JobKey,org.quartz.simpl.JobWrapper>> |
jobsByGroup
|
protected java.util.HashMap<JobKey,org.quartz.simpl.JobWrapper> |
jobsByKey
|
protected java.lang.Object |
lock
|
protected long |
misfireThreshold
|
protected java.util.HashSet<java.lang.String> |
pausedJobGroups
|
protected java.util.HashSet<java.lang.String> |
pausedTriggerGroups
|
protected SchedulerSignaler |
signaler
|
protected java.util.TreeSet<org.quartz.simpl.TriggerWrapper> |
timeTriggers
|
protected java.util.ArrayList<org.quartz.simpl.TriggerWrapper> |
triggers
|
protected java.util.HashMap<java.lang.String,java.util.HashMap<TriggerKey,org.quartz.simpl.TriggerWrapper>> |
triggersByGroup
|
protected java.util.HashMap<TriggerKey,org.quartz.simpl.TriggerWrapper> |
triggersByKey
|
Constructor Summary | |
---|---|
RAMJobStore()
Create a new RAMJobStore . |
Method Summary | |
---|---|
java.util.List<OperableTrigger> |
acquireNextTriggers(long noLaterThan,
int maxCount,
long timeWindow)
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)
|
boolean |
checkExists(JobKey jobKey)
Determine whether a Job with the given identifier already
exists within the scheduler. |
boolean |
checkExists(TriggerKey triggerKey)
Determine whether a Trigger with the given identifier already
exists within the scheduler. |
void |
clearAllSchedulingData()
Clear (delete!) all scheduling data - all Job s, Trigger s
Calendar s. |
java.util.List<java.lang.String> |
getCalendarNames()
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.util.List<java.lang.String> |
getJobGroupNames()
Get the names of all of the
groups. |
java.util.Set<JobKey> |
getJobKeys(GroupMatcher<JobKey> matcher)
Get the names of all of the s that
match the given groupMatcher. |
protected org.slf4j.Logger |
getLog()
|
long |
getMisfireThreshold()
|
int |
getNumberOfCalendars()
Get the number of s that are
stored in the JobsStore . |
int |
getNumberOfJobs()
Get the number of s that are
stored in the JobsStore . |
int |
getNumberOfTriggers()
Get the number of s that are
stored in the JobsStore . |
java.util.Set |
getPausedTriggerGroups()
|
java.util.List<java.lang.String> |
getTriggerGroupNames()
Get the names of all of the
groups. |
java.util.Set<TriggerKey> |
getTriggerKeys(GroupMatcher<TriggerKey> matcher)
Get the names of all of the s
that match the given groupMatcher. |
java.util.List<OperableTrigger> |
getTriggersForJob(JobKey jobKey)
Get all of the Triggers that are associated to the given Job. |
Trigger.TriggerState |
getTriggerState(TriggerKey triggerKey)
Get the current state of the identified . |
protected java.util.ArrayList<org.quartz.simpl.TriggerWrapper> |
getTriggerWrappersForCalendar(java.lang.String calName)
|
protected java.util.ArrayList<org.quartz.simpl.TriggerWrapper> |
getTriggerWrappersForJob(JobKey jobKey)
|
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()
Pause all triggers - equivalent of calling pauseTriggerGroup(group)
on every group. |
void |
pauseJob(JobKey jobKey)
Pause the with the given
name - by pausing all of its current Trigger s. |
java.util.List<java.lang.String> |
pauseJobs(GroupMatcher<JobKey> matcher)
Pause all of the in the
given group - by pausing all of their Trigger s. |
void |
pauseTrigger(TriggerKey triggerKey)
Pause the with the given name. |
java.util.List<java.lang.String> |
pauseTriggers(GroupMatcher<TriggerKey> matcher)
Pause all of the known matching. |
protected java.lang.String |
peekTriggers()
|
void |
releaseAcquiredTrigger(OperableTrigger trigger)
Inform the JobStore that the scheduler no longer plans to
fire the given Trigger , that it had previously acquired
(reserved). |
boolean |
removeCalendar(java.lang.String calName)
Remove (delete) the with the
given name. |
boolean |
removeJob(JobKey jobKey)
Remove (delete) the with the given
name, and any s that reference
it. |
boolean |
removeJobs(java.util.List<JobKey> jobKeys)
|
boolean |
removeTrigger(TriggerKey triggerKey)
Remove (delete) the with the
given name. |
boolean |
removeTriggers(java.util.List<TriggerKey> triggerKeys)
|
boolean |
replaceTrigger(TriggerKey triggerKey,
OperableTrigger newTrigger)
Remove (delete) the with the
given key, and store the new given one - which must be associated
with the same job. |
void |
resumeAll()
Resume (un-pause) all triggers - equivalent of calling resumeTriggerGroup(group)
on every group. |
void |
resumeJob(JobKey jobKey)
Resume (un-pause) the with
the given name. |
java.util.Collection<java.lang.String> |
resumeJobs(GroupMatcher<JobKey> matcher)
Resume (un-pause) all of the
in the given group. |
void |
resumeTrigger(TriggerKey triggerKey)
Resume (un-pause) the with the given
key. |
java.util.List<java.lang.String> |
resumeTriggers(GroupMatcher<TriggerKey> matcher)
Resume (un-pause) all of the in the
given group. |
Calendar |
retrieveCalendar(java.lang.String calName)
Retrieve the given . |
JobDetail |
retrieveJob(JobKey jobKey)
Retrieve the for the given
. |
OperableTrigger |
retrieveTrigger(TriggerKey triggerKey)
Retrieve the given . |
void |
schedulerStarted()
Called by the QuartzScheduler to inform the JobStore that
the scheduler has started. |
protected void |
setAllTriggersOfJobToState(JobKey jobKey,
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 |
setThreadPoolSize(int poolSize)
Tells the JobStore the pool size used to execute jobs |
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(java.lang.String name,
Calendar calendar,
boolean replaceExisting,
boolean updateTriggers)
Store the given . |
void |
storeJob(JobDetail newJob,
boolean replaceExisting)
Store the given . |
void |
storeJobAndTrigger(JobDetail newJob,
OperableTrigger newTrigger)
Store the given and . |
void |
storeJobsAndTriggers(java.util.Map<JobDetail,java.util.List<Trigger>> triggersAndJobs,
boolean replace)
|
void |
storeTrigger(OperableTrigger newTrigger,
boolean replaceExisting)
Store the given . |
boolean |
supportsPersistence()
|
void |
triggeredJobComplete(OperableTrigger trigger,
JobDetail jobDetail,
Trigger.CompletedExecutionInstruction 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. |
java.util.List<TriggerFiredResult> |
triggersFired(java.util.List<OperableTrigger> triggers)
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<JobKey,org.quartz.simpl.JobWrapper> jobsByKey
protected java.util.HashMap<TriggerKey,org.quartz.simpl.TriggerWrapper> triggersByKey
protected java.util.HashMap<java.lang.String,java.util.HashMap<JobKey,org.quartz.simpl.JobWrapper>> jobsByGroup
protected java.util.HashMap<java.lang.String,java.util.HashMap<TriggerKey,org.quartz.simpl.TriggerWrapper>> triggersByGroup
protected java.util.TreeSet<org.quartz.simpl.TriggerWrapper> timeTriggers
protected java.util.HashMap<java.lang.String,Calendar> calendarsByName
protected java.util.ArrayList<org.quartz.simpl.TriggerWrapper> triggers
protected final java.lang.Object lock
protected java.util.HashSet<java.lang.String> pausedTriggerGroups
protected java.util.HashSet<java.lang.String> pausedJobGroups
protected java.util.HashSet<JobKey> 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
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 clearAllSchedulingData() throws JobPersistenceException
Job
s, Trigger
s
Calendar
s.
clearAllSchedulingData
in interface JobStore
JobPersistenceException
public void storeJobAndTrigger(JobDetail newJob, OperableTrigger 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(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(JobKey jobKey)
Remove (delete) the
with the given
name, and any Job
s that reference
it.
Trigger
removeJob
in interface JobStore
true
if a Job
with the given name &
group was found and removed from the store.public boolean removeJobs(java.util.List<JobKey> jobKeys) throws JobPersistenceException
removeJobs
in interface JobStore
JobPersistenceException
public boolean removeTriggers(java.util.List<TriggerKey> triggerKeys) throws JobPersistenceException
removeTriggers
in interface JobStore
JobPersistenceException
public void storeJobsAndTriggers(java.util.Map<JobDetail,java.util.List<Trigger>> triggersAndJobs, boolean replace) throws ObjectAlreadyExistsException, JobPersistenceException
storeJobsAndTriggers
in interface JobStore
ObjectAlreadyExistsException
JobPersistenceException
public void storeTrigger(OperableTrigger 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(TriggerKey triggerKey)
Remove (delete) the
with the
given name.
Trigger
removeTrigger
in interface JobStore
true
if a Trigger
with the given
name & group was found and removed from the store.public boolean replaceTrigger(TriggerKey triggerKey, OperableTrigger newTrigger) throws JobPersistenceException
JobStore
Trigger
with the
given key, and store the new given one - which must be associated
with the same job.
replaceTrigger
in interface JobStore
newTrigger
- The new Trigger
to be stored.
true
if a Trigger
with the given
name & group was found and removed from the store.
JobPersistenceException
org.quartz.spi.JobStore#replaceTrigger(org.quartz.core.SchedulingContext, java.lang.String, java.lang.String, org.quartz.Trigger)
public JobDetail retrieveJob(JobKey jobKey)
Retrieve the
for the given
JobDetail
.
Job
retrieveJob
in interface JobStore
Job
, or null if there is no match.public OperableTrigger retrieveTrigger(TriggerKey triggerKey)
Retrieve the given
.
Trigger
retrieveTrigger
in interface JobStore
Trigger
, or null if there is no
match.public boolean checkExists(JobKey jobKey)
Job
with the given identifier already
exists within the scheduler.
checkExists
in interface JobStore
jobKey
- the identifier to check for
SchedulerException
public boolean checkExists(TriggerKey triggerKey)
Trigger
with the given identifier already
exists within the scheduler.
checkExists
in interface JobStore
triggerKey
- the identifier to check for
SchedulerException
public Trigger.TriggerState getTriggerState(TriggerKey triggerKey) throws JobPersistenceException
Get the current state of the identified
.
Trigger
getTriggerState
in interface JobStore
JobPersistenceException
Trigger#NORMAL
,
Trigger#PAUSED
,
Trigger#COMPLETE
,
Trigger#ERROR
,
Trigger#BLOCKED
,
Trigger#NONE
public void storeCalendar(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(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(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()
Get the number of
s that are
stored in the JobDetail
JobsStore
.
getNumberOfJobs
in interface JobStore
public int getNumberOfTriggers()
Get the number of
s that are
stored in the Trigger
JobsStore
.
getNumberOfTriggers
in interface JobStore
public int getNumberOfCalendars()
Get the number of
s that are
stored in the Calendar
JobsStore
.
getNumberOfCalendars
in interface JobStore
public java.util.Set<JobKey> getJobKeys(GroupMatcher<JobKey> matcher)
Get the names of all of the
s that
match the given groupMatcher.
Job
getJobKeys
in interface JobStore
public java.util.List<java.lang.String> getCalendarNames()
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.util.Set<TriggerKey> getTriggerKeys(GroupMatcher<TriggerKey> matcher)
Get the names of all of the
s
that match the given groupMatcher.
Trigger
getTriggerKeys
in interface JobStore
public java.util.List<java.lang.String> getJobGroupNames()
Get the names of all of the
groups.
Job
getJobGroupNames
in interface JobStore
public java.util.List<java.lang.String> getTriggerGroupNames()
Get the names of all of the
groups.
Trigger
getTriggerGroupNames
in interface JobStore
public java.util.List<OperableTrigger> getTriggersForJob(JobKey jobKey)
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<org.quartz.simpl.TriggerWrapper> getTriggerWrappersForJob(JobKey jobKey)
protected java.util.ArrayList<org.quartz.simpl.TriggerWrapper> getTriggerWrappersForCalendar(java.lang.String calName)
public void pauseTrigger(TriggerKey triggerKey)
Pause the
with the given name.
Trigger
pauseTrigger
in interface JobStore
JobStore.resumeTrigger(TriggerKey)
public java.util.List<java.lang.String> pauseTriggers(GroupMatcher<TriggerKey> matcher)
Pause all of the known
matching.
Trigger
s
The JobStore should "remember" the groups paused, and impose the pause on any new triggers that are added to one of these groups while the group is paused.
pauseTriggers
in interface JobStore
#resumeTriggerGroup(String)
public void pauseJob(JobKey jobKey)
Pause the
with the given
name - by pausing all of its current JobDetail
Trigger
s.
pauseJob
in interface JobStore
JobStore.resumeJob(JobKey)
public java.util.List<java.lang.String> pauseJobs(GroupMatcher<JobKey> matcher)
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.
pauseJobs
in interface JobStore
#resumeJobGroup(String)
public void resumeTrigger(TriggerKey triggerKey)
Resume (un-pause) the
with the given
key.
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(TriggerKey)
public java.util.List<java.lang.String> resumeTriggers(GroupMatcher<TriggerKey> matcher)
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.
resumeTriggers
in interface JobStore
#pauseTriggers(String)
public void resumeJob(JobKey jobKey)
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(JobKey)
public java.util.Collection<java.lang.String> resumeJobs(GroupMatcher<JobKey> matcher)
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.
resumeJobs
in interface JobStore
#pauseJobGroup(String)
public void pauseAll()
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()
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 java.util.List<OperableTrigger> acquireNextTriggers(long noLaterThan, int maxCount, long timeWindow)
Get a handle to the next trigger to be fired, and mark it as 'reserved' by the calling scheduler.
acquireNextTriggers
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(OperableTrigger 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 java.util.List<TriggerFiredResult> triggersFired(java.util.List<OperableTrigger> triggers)
Inform the JobStore
that the scheduler is now firing the
given Trigger
(executing its associated Job
),
that it had previously acquired (reserved).
triggersFired
in interface JobStore
public void triggeredJobComplete(OperableTrigger trigger, JobDetail jobDetail, Trigger.CompletedExecutionInstruction 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(JobKey jobKey, int state)
protected java.lang.String peekTriggers()
public java.util.Set getPausedTriggerGroups() throws JobPersistenceException
getPausedTriggerGroups
in interface JobStore
JobPersistenceException
org.quartz.spi.JobStore#getPausedTriggerGroups(org.quartz.core.SchedulingContext)
public void setInstanceId(java.lang.String schedInstId)
JobStore
JobStore
of the Scheduler instance's Id,
prior to initialize being invoked.
setInstanceId
in interface JobStore
public void setInstanceName(java.lang.String schedName)
JobStore
JobStore
of the Scheduler instance's name,
prior to initialize being invoked.
setInstanceName
in interface JobStore
public void setThreadPoolSize(int poolSize)
JobStore
setThreadPoolSize
in interface JobStore
poolSize
- amount of threads allocated for job executionpublic 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 |