Package org.quartz.core
Class RAMJobStore
java.lang.Object
org.quartz.core.RAMJobStore
- All Implemented Interfaces:
JobStore
This class implements a
JobStore
that utilizes RAM as its
storage device.
As you should know, the ramification of this is that access is extremely fast, but the data is
completely volatile - therefore this JobStore
should not be used if true persistence
between program shutdowns is required.
- Author:
- James House, Sharada Jambula, Eric Mueller
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionacquireNextTriggers
(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.Get the names of all of the
sJob
long
getTriggersForJob
(String jobKey) Get all of the Triggers that are associated to the given Job.void
initialize
(SchedulerSignaler signaler) Called by the QuartzScheduler before theJobStore
is used, in order to give the it a chance to initialize.void
releaseAcquiredTrigger
(OperableTrigger trigger) Inform theJobStore
that the scheduler no longer plans to fire the givenTrigger
, that it had previously acquired (reserved).boolean
boolean
removeTrigger
(String triggerName) Remove (delete) the
with the given key.Trigger
boolean
replaceTrigger
(String triggerKey, OperableTrigger newTrigger) Remove (delete) the
with the given key, and store the new given one - which must be associated with the same job.Trigger
retrieveCalendar
(String calName) Retrieve the given
.Trigger
retrieveJob
(String jobKey) retrieveTrigger
(String triggerKey) Retrieve the given
.Trigger
void
Called by the QuartzScheduler to inform theJobStore
that the scheduler has started.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 jobsvoid
Store the given
.Job
void
storeJobAndTrigger
(JobDetail newJob, OperableTrigger newTrigger) void
storeTrigger
(OperableTrigger newTrigger, boolean replaceExisting) Store the given
.Trigger
void
triggeredJobComplete
(OperableTrigger trigger, JobDetail jobDetail, Trigger.CompletedExecutionInstruction triggerInstCode) Inform theJobStore
that the scheduler has completed the firing of the givenTrigger
(and the execution its associatedJob
), and that theJobDataMap
JobDetail
should be updated if theJob
is stateful.triggersFired
(List<OperableTrigger> triggers) Inform theJobStore
that the scheduler is now firing the givenTrigger
(executing its associatedJob
), that it had previously acquired (reserved).
-
Constructor Details
-
RAMJobStore
public RAMJobStore()Create a newRAMJobStore
.
-
-
Method Details
-
initialize
Called by the QuartzScheduler before theJobStore
is used, in order to give the it a chance to initialize.- Specified by:
initialize
in interfaceJobStore
-
schedulerStarted
Description copied from interface:JobStore
Called by the QuartzScheduler to inform theJobStore
that the scheduler has started.- Specified by:
schedulerStarted
in interfaceJobStore
- Throws:
SchedulerException
-
getMisfireThreshold
public long getMisfireThreshold() -
setMisfireThreshold
public 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.- Parameters:
misfireThreshold
-
-
storeJobAndTrigger
public void storeJobAndTrigger(JobDetail newJob, OperableTrigger newTrigger) throws JobPersistenceException - Specified by:
storeJobAndTrigger
in interfaceJobStore
- Parameters:
newJob
- TheJobDetail
to be stored.newTrigger
- TheTrigger
to be stored.- Throws:
ObjectAlreadyExistsException
- if aJob
with the same name/group already exists.ObjectAlreadyExistsException
- if aJob
with the same name/group already exists.JobPersistenceException
-
storeJob
Store the given
.Job
- Specified by:
storeJob
in interfaceJobStore
- Parameters:
newJob
- TheJob
to be stored.replaceExisting
- Iftrue
, anyJob
existing in theJobStore
with the same name invalid input: '&' group should be over-written.- Throws:
ObjectAlreadyExistsException
- if aJob
with the same name/group already exists, and replaceExisting is set to false.
-
removeJob
-
storeTrigger
public void storeTrigger(OperableTrigger newTrigger, boolean replaceExisting) throws JobPersistenceException Store the given
.Trigger
- Specified by:
storeTrigger
in interfaceJobStore
- Parameters:
newTrigger
- TheTrigger
to be stored.replaceExisting
- Iftrue
, anyTrigger
existing in theJobStore
with the same name invalid input: '&' group should be over-written.- Throws:
ObjectAlreadyExistsException
- if aTrigger
with the same name/group already exists, and replaceExisting is set to false.ObjectAlreadyExistsException
- if aTrigger
with the same name/group already exists, and replaceExisting is set to false.JobPersistenceException
- See Also:
-
-
invalid @see
#pauseTriggerGroup(SchedulingContext, String)
-
-
removeTrigger
Description copied from interface:JobStore
Remove (delete) the
with the given key.Trigger
If removal of the
Trigger
results in an empty group, the group should be removed from theJobStore
's list of known group names.If removal of the
Trigger
results in an 'orphaned'Job
that is not 'durable', then theJob
should be deleted also.- Specified by:
removeTrigger
in interfaceJobStore
- Returns:
true
if aTrigger
with the given name was found and removed from the store.
-
replaceTrigger
public boolean replaceTrigger(String triggerKey, OperableTrigger newTrigger) throws JobPersistenceException Description copied from interface:JobStore
Remove (delete) the
with the given key, and store the new given one - which must be associated with the same job.Trigger
- Specified by:
replaceTrigger
in interfaceJobStore
- Parameters:
newTrigger
- The newTrigger
to be stored.- Returns:
true
if aTrigger
with the given name was found and removed from the store.- Throws:
JobPersistenceException
- See Also:
-
-
invalid @see
org.quartz.core.JobStore#replaceTrigger(org.quartz.core.SchedulingContext, java.lang.String, java.lang.String, org.quartz.triggers.Trigger)
-
-
retrieveJob
- Specified by:
retrieveJob
in interfaceJobStore
- Returns:
- The desired
Job
, or null if there is no match.
-
retrieveTrigger
Retrieve the given
.Trigger
- Specified by:
retrieveTrigger
in interfaceJobStore
- Returns:
- The desired
Trigger
, or null if there is no match.
-
retrieveCalendar
Retrieve the given
.Trigger
- Specified by:
retrieveCalendar
in interfaceJobStore
- Parameters:
calName
- The name of theCalendar
to be retrieved.- Returns:
- The desired
Calendar
, or null if there is no match.
-
getTriggersForJob
Get all of the Triggers that are associated to the given Job.If there are no matches, a zero-length array should be returned.
- Specified by:
getTriggersForJob
in interfaceJobStore
-
acquireNextTriggers
Get a handle to the next trigger to be fired, and mark it as 'reserved' by the calling scheduler.- Specified by:
acquireNextTriggers
in interfaceJobStore
- Parameters:
noLaterThan
- If > 0, the JobStore should only return a Trigger that will fire no later than the time represented in this value as milliseconds.- See Also:
-
-
invalid @see
#releaseAcquiredTrigger(SchedulingContext, Trigger)
-
-
releaseAcquiredTrigger
Inform theJobStore
that the scheduler no longer plans to fire the givenTrigger
, that it had previously acquired (reserved).- Specified by:
releaseAcquiredTrigger
in interfaceJobStore
-
triggersFired
Inform theJobStore
that the scheduler is now firing the givenTrigger
(executing its associatedJob
), that it had previously acquired (reserved).- Specified by:
triggersFired
in interfaceJobStore
- Returns:
- may return null if all the triggers or their calendars no longer exist, or if the trigger was not successfully put into the 'executing' state. Preference is to return an empty list if none of the triggers could be fired.
-
triggeredJobComplete
public void triggeredJobComplete(OperableTrigger trigger, JobDetail jobDetail, Trigger.CompletedExecutionInstruction triggerInstCode) Inform theJobStore
that the scheduler has completed the firing of the givenTrigger
(and the execution its associatedJob
), and that theJobDataMap
JobDetail
should be updated if theJob
is stateful.- Specified by:
triggeredJobComplete
in interfaceJobStore
-
setThreadPoolSize
public void setThreadPoolSize(int poolSize) Description copied from interface:JobStore
Tells the JobStore the pool size used to execute jobs- Specified by:
setThreadPoolSize
in interfaceJobStore
- Parameters:
poolSize
- amount of threads allocated for job execution
-
getJobKeys
Get the names of all of the
sJob
- Specified by:
getJobKeys
in interfaceJobStore
-