public class RAMJobStore extends Object implements JobStore
This class implements a that utilizes RAM as its storage device.
JobStore
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.
| Constructor and Description |
|---|
RAMJobStore()
Create a new
RAMJobStore. |
| Modifier and Type | Method and Description |
|---|---|
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.
|
Set<String> |
getJobKeys()
Get the names of all of the
s |
long |
getMisfireThreshold() |
List<Trigger> |
getTriggersForJob(String jobKey)
Get all of the Triggers that are associated to the given Job.
|
void |
initialize(SchedulerSignaler signaler)
Called by the QuartzScheduler before the
JobStore is used, in order to give the it a chance to initialize. |
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 |
removeJob(String jobKey)
|
boolean |
removeTrigger(String triggerName)
Remove (delete) the
with the given key. |
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. |
Calendar |
retrieveCalendar(String calName)
Retrieve the given
. |
JobDetail |
retrieveJob(String jobKey)
|
OperableTrigger |
retrieveTrigger(String triggerKey)
Retrieve the given
. |
void |
schedulerStarted()
Called by the QuartzScheduler to inform the
JobStore 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 jobs
|
void |
storeJob(JobDetail newJob,
boolean replaceExisting)
Store the given
. |
void |
storeJobAndTrigger(JobDetail newJob,
OperableTrigger newTrigger)
|
void |
storeTrigger(OperableTrigger newTrigger,
boolean replaceExisting)
Store the given
. |
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. |
List<TriggerFiredResult> |
triggersFired(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). |
public void initialize(SchedulerSignaler signaler)
Called by the QuartzScheduler before the JobStore is used, in order to give the it a chance to initialize.
initialize in interface JobStorepublic void schedulerStarted()
throws SchedulerException
JobStoreJobStore that the scheduler has started.schedulerStarted in interface JobStoreSchedulerExceptionpublic long getMisfireThreshold()
public void setMisfireThreshold(long misfireThreshold)
misfireThreshold - public void storeJobAndTrigger(JobDetail newJob, OperableTrigger newTrigger) throws JobPersistenceException
storeJobAndTrigger in interface JobStorenewJob - The JobDetail to be stored.newTrigger - The Trigger to be stored.ObjectAlreadyExistsException - if a Job with the same name/group already exists.JobPersistenceExceptionpublic void storeJob(JobDetail newJob, boolean replaceExisting) throws ObjectAlreadyExistsException
Store the given .
Job
storeJob in interface JobStorenewJob - 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(String jobKey)
public void storeTrigger(OperableTrigger newTrigger, boolean replaceExisting) throws JobPersistenceException
Store the given .
Trigger
storeTrigger in interface JobStorenewTrigger - 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(String triggerName)
JobStoreTrigger with the given key.
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.
removeTrigger in interface JobStoretrue if a Trigger with the given name was found and removed from the store.public boolean replaceTrigger(String triggerKey, OperableTrigger newTrigger) throws JobPersistenceException
JobStoreTrigger with the given key, and store the new given one - which must be associated
with the same job.replaceTrigger in interface JobStorenewTrigger - The new Trigger to be stored.true if a Trigger with the given name was found and removed from the store.JobPersistenceExceptionorg.quartz.core.JobStore#replaceTrigger(org.quartz.core.SchedulingContext, java.lang.String, java.lang.String, org.quartz.triggers.Trigger)public JobDetail retrieveJob(String jobKey)
retrieveJob in interface JobStoreJob, or null if there is no match.public OperableTrigger retrieveTrigger(String triggerKey)
Retrieve the given .
Trigger
retrieveTrigger in interface JobStoreTrigger, or null if there is no match.public Calendar retrieveCalendar(String calName)
Retrieve the given .
Trigger
retrieveCalendar in interface JobStorecalName - The name of the Calendar to be retrieved.Calendar, or null if there is no match.public List<Trigger> getTriggersForJob(String 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 JobStorepublic 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 JobStorenoLaterThan - 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 JobStorepublic List<TriggerFiredResult> triggersFired(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 JobStorepublic 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 JobDataMapJobDetail should be updated if the
Job is stateful.
triggeredJobComplete in interface JobStorepublic void setThreadPoolSize(int poolSize)
JobStoresetThreadPoolSize in interface JobStorepoolSize - amount of threads allocated for job executionpublic Set<String> getJobKeys()
Get the names of all of the s
Job
getJobKeys in interface JobStoreCopyright © 2011–2017 Knowm Inc.. All rights reserved.