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
Constructors -
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 thesJoblonggetTriggersForJob(String jobKey) Get all of the Triggers that are associated to the given Job.voidinitialize(SchedulerSignaler signaler) Called by the QuartzScheduler before theJobStoreis used, in order to give the it a chance to initialize.voidreleaseAcquiredTrigger(OperableTrigger trigger) Inform theJobStorethat the scheduler no longer plans to fire the givenTrigger, that it had previously acquired (reserved).booleanbooleanremoveTrigger(String triggerName) Remove (delete) thewith the given key.TriggerbooleanreplaceTrigger(String triggerKey, OperableTrigger newTrigger) Remove (delete) thewith the given key, and store the new given one - which must be associated with the same job.TriggerretrieveCalendar(String calName) Retrieve the given.TriggerretrieveJob(String jobKey) retrieveTrigger(String triggerKey) Retrieve the given.TriggervoidCalled by the QuartzScheduler to inform theJobStorethat the scheduler has started.voidsetMisfireThreshold(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.voidsetThreadPoolSize(int poolSize) Tells the JobStore the pool size used to execute jobsvoidStore the given.JobvoidstoreJobAndTrigger(JobDetail newJob, OperableTrigger newTrigger) voidstoreTrigger(OperableTrigger newTrigger, boolean replaceExisting) Store the given.TriggervoidtriggeredJobComplete(OperableTrigger trigger, JobDetail jobDetail, Trigger.CompletedExecutionInstruction triggerInstCode) Inform theJobStorethat the scheduler has completed the firing of the givenTrigger(and the execution its associatedJob), and that thein the givenJobDataMapJobDetailshould be updated if theJobis stateful.triggersFired(List<OperableTrigger> triggers) Inform theJobStorethat 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 theJobStoreis used, in order to give the it a chance to initialize.- Specified by:
initializein interfaceJobStore
-
schedulerStarted
Description copied from interface:JobStoreCalled by the QuartzScheduler to inform theJobStorethat the scheduler has started.- Specified by:
schedulerStartedin 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:
storeJobAndTriggerin interfaceJobStore- Parameters:
newJob- TheJobDetailto be stored.newTrigger- TheTriggerto be stored.- Throws:
ObjectAlreadyExistsException- if aJobwith the same name/group already exists.ObjectAlreadyExistsException- if aJobwith the same name/group already exists.JobPersistenceException
-
storeJob
Store the given.Job- Specified by:
storeJobin interfaceJobStore- Parameters:
newJob- TheJobto be stored.replaceExisting- Iftrue, anyJobexisting in theJobStorewith the same name invalid input: '&' group should be over-written.- Throws:
ObjectAlreadyExistsException- if aJobwith 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:
storeTriggerin interfaceJobStore- Parameters:
newTrigger- TheTriggerto be stored.replaceExisting- Iftrue, anyTriggerexisting in theJobStorewith the same name invalid input: '&' group should be over-written.- Throws:
ObjectAlreadyExistsException- if aTriggerwith the same name/group already exists, and replaceExisting is set to false.ObjectAlreadyExistsException- if aTriggerwith 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:JobStoreRemove (delete) thewith the given key.TriggerIf removal of the
Triggerresults in an empty group, the group should be removed from theJobStore's list of known group names.If removal of the
Triggerresults in an 'orphaned'Jobthat is not 'durable', then theJobshould be deleted also.- Specified by:
removeTriggerin interfaceJobStore- Returns:
trueif aTriggerwith the given name was found and removed from the store.
-
replaceTrigger
public boolean replaceTrigger(String triggerKey, OperableTrigger newTrigger) throws JobPersistenceException Description copied from interface:JobStoreRemove (delete) thewith the given key, and store the new given one - which must be associated with the same job.Trigger- Specified by:
replaceTriggerin interfaceJobStore- Parameters:
newTrigger- The newTriggerto be stored.- Returns:
trueif aTriggerwith 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:
retrieveJobin interfaceJobStore- Returns:
- The desired
Job, or null if there is no match.
-
retrieveTrigger
Retrieve the given.Trigger- Specified by:
retrieveTriggerin interfaceJobStore- Returns:
- The desired
Trigger, or null if there is no match.
-
retrieveCalendar
Retrieve the given.Trigger- Specified by:
retrieveCalendarin interfaceJobStore- Parameters:
calName- The name of theCalendarto 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:
getTriggersForJobin interfaceJobStore
-
acquireNextTriggers
Get a handle to the next trigger to be fired, and mark it as 'reserved' by the calling scheduler.- Specified by:
acquireNextTriggersin 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 theJobStorethat the scheduler no longer plans to fire the givenTrigger, that it had previously acquired (reserved).- Specified by:
releaseAcquiredTriggerin interfaceJobStore
-
triggersFired
Inform theJobStorethat the scheduler is now firing the givenTrigger(executing its associatedJob), that it had previously acquired (reserved).- Specified by:
triggersFiredin 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 theJobStorethat the scheduler has completed the firing of the givenTrigger(and the execution its associatedJob), and that thein the givenJobDataMapJobDetailshould be updated if theJobis stateful.- Specified by:
triggeredJobCompletein interfaceJobStore
-
setThreadPoolSize
public void setThreadPoolSize(int poolSize) Description copied from interface:JobStoreTells the JobStore the pool size used to execute jobs- Specified by:
setThreadPoolSizein interfaceJobStore- Parameters:
poolSize- amount of threads allocated for job execution
-
getJobKeys
Get the names of all of thesJob- Specified by:
getJobKeysin interfaceJobStore
-