Class BaseJobStore
- java.lang.Object
-
- com.helger.schedule.jobstore.BaseJobStore
-
- All Implemented Interfaces:
com.helger.quartz.spi.IJobStore
public class BaseJobStore extends Object implements com.helger.quartz.spi.IJobStore
IJobStoreimplementation based onRAMJobStore- Author:
- Philip Helger
-
-
Constructor Summary
Constructors Constructor Description BaseJobStore()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.helger.commons.collection.impl.ICommonsList<com.helger.quartz.spi.IOperableTrigger>acquireNextTriggers(long noLaterThan, int maxCount, long timeWindow)protected booleanapplyMisfire(com.helger.schedule.jobstore.TriggerWrapper tw)booleancheckExists(com.helger.quartz.JobKey jobKey)booleancheckExists(com.helger.quartz.TriggerKey aTriggerKey)voidclearAllSchedulingData()Clear (delete!)com.helger.commons.collection.impl.ICommonsList<String>getCalendarNames()longgetEstimatedTimeToReleaseAndAcquireTrigger()protected StringgetFiredTriggerRecordId()com.helger.commons.collection.impl.ICommonsList<String>getJobGroupNames()com.helger.commons.collection.impl.ICommonsSet<com.helger.quartz.JobKey>getJobKeys(com.helger.quartz.impl.matchers.GroupMatcher<com.helger.quartz.JobKey> matcher)longgetMisfireThreshold()intgetNumberOfCalendars()intgetNumberOfJobs()intgetNumberOfTriggers()com.helger.commons.collection.impl.ICommonsSet<String>getPausedTriggerGroups()com.helger.commons.collection.impl.ICommonsList<String>getTriggerGroupNames()com.helger.commons.collection.impl.ICommonsSet<com.helger.quartz.TriggerKey>getTriggerKeys(com.helger.quartz.impl.matchers.GroupMatcher<com.helger.quartz.TriggerKey> matcher)com.helger.commons.collection.impl.ICommonsList<com.helger.quartz.spi.IOperableTrigger>getTriggersForJob(com.helger.quartz.JobKey aJobKey)com.helger.quartz.ITrigger.ETriggerStategetTriggerState(com.helger.quartz.TriggerKey triggerKey)protected com.helger.commons.collection.impl.ICommonsList<com.helger.schedule.jobstore.TriggerWrapper>getTriggerWrappersForCalendar(String calName)protected com.helger.commons.collection.impl.ICommonsList<com.helger.schedule.jobstore.TriggerWrapper>getTriggerWrappersForJob(com.helger.quartz.JobKey aJobKey)voidinitialize(com.helger.quartz.spi.IClassLoadHelper loadHelper, com.helger.quartz.spi.ISchedulerSignaler aSignaler)booleanisClustered()voidpauseAll()voidpauseJob(com.helger.quartz.JobKey jobKey)Pause thewith the given name - by pausing all of its currentIJobDetailTriggers.com.helger.commons.collection.impl.ICommonsList<String>pauseJobs(com.helger.quartz.impl.matchers.GroupMatcher<com.helger.quartz.JobKey> matcher)Pause all of thein the given group - by pausing all of theirIJobDetailsTriggers.voidpauseTrigger(com.helger.quartz.TriggerKey triggerKey)Pause thewith the given name.ITriggercom.helger.commons.collection.impl.ICommonsList<String>pauseTriggers(com.helger.quartz.impl.matchers.GroupMatcher<com.helger.quartz.TriggerKey> matcher)protected StringpeekTriggers()voidreleaseAcquiredTrigger(com.helger.quartz.spi.IOperableTrigger trigger)Inform theJobStorethat the scheduler no longer plans to fire the givenTrigger, that it had previously acquired (reserved).booleanremoveCalendar(String calName)booleanremoveJob(com.helger.quartz.JobKey jobKey)booleanremoveJobs(List<com.helger.quartz.JobKey> jobKeys)booleanremoveTrigger(com.helger.quartz.TriggerKey triggerKey)Remove (delete) thewith the given name.ITriggerbooleanremoveTriggers(List<com.helger.quartz.TriggerKey> triggerKeys)booleanreplaceTrigger(com.helger.quartz.TriggerKey aTriggerKey, com.helger.quartz.spi.IOperableTrigger aNewTrigger)voidresumeAll()Resume (un-pause) all triggers - equivalent of callingresumeTriggerGroup(group)on every group.voidresumeJob(com.helger.quartz.JobKey jobKey)com.helger.commons.collection.impl.ICommonsCollection<String>resumeJobs(com.helger.quartz.impl.matchers.GroupMatcher<com.helger.quartz.JobKey> matcher)voidresumeTrigger(com.helger.quartz.TriggerKey triggerKey)Resume (un-pause) thewith the given key.ITriggercom.helger.commons.collection.impl.ICommonsList<String>resumeTriggers(com.helger.quartz.impl.matchers.GroupMatcher<com.helger.quartz.TriggerKey> matcher)com.helger.quartz.ICalendarretrieveCalendar(String calName)com.helger.quartz.IJobDetailretrieveJob(com.helger.quartz.JobKey jobKey)Retrieve thefor the givenIJobDetail.IJobcom.helger.quartz.spi.IOperableTriggerretrieveTrigger(com.helger.quartz.TriggerKey triggerKey)Retrieve the given.ITriggervoidschedulerPaused()voidschedulerResumed()voidschedulerStarted()protected voidsetAllTriggersOfJobToState(com.helger.quartz.JobKey jobKey, int state)voidsetInstanceId(String schedInstId)voidsetInstanceName(String schedName)voidsetMisfireThreshold(long nMisfireThreshold)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)voidshutdown()voidstoreCalendar(String name, com.helger.quartz.ICalendar aCalendar, boolean bReplaceExisting, boolean bUpdateTriggers)voidstoreJob(com.helger.quartz.IJobDetail aNewJob, boolean bReplaceExisting)voidstoreJobAndTrigger(com.helger.quartz.IJobDetail aNewJob, com.helger.quartz.spi.IOperableTrigger aNewTrigger)voidstoreJobsAndTriggers(Map<com.helger.quartz.IJobDetail,Set<? extends com.helger.quartz.ITrigger>> aTriggersAndJobs, boolean bReplace)voidstoreTrigger(com.helger.quartz.spi.IOperableTrigger aNewTrigger, boolean bReplaceExisting)booleansupportsPersistence()voidtriggeredJobComplete(com.helger.quartz.spi.IOperableTrigger trigger, com.helger.quartz.IJobDetail jobDetail, com.helger.quartz.ITrigger.ECompletedExecutionInstruction triggerInstCode)com.helger.commons.collection.impl.ICommonsList<com.helger.quartz.spi.TriggerFiredResult>triggersFired(List<com.helger.quartz.spi.IOperableTrigger> firedTriggers)Inform theJobStorethat the scheduler is now firing the givenTrigger(executing its associatedJob), that it had previously acquired (reserved).
-
-
-
Method Detail
-
initialize
public void initialize(com.helger.quartz.spi.IClassLoadHelper loadHelper, com.helger.quartz.spi.ISchedulerSignaler aSignaler)- Specified by:
initializein interfacecom.helger.quartz.spi.IJobStore
-
schedulerStarted
public void schedulerStarted()
- Specified by:
schedulerStartedin interfacecom.helger.quartz.spi.IJobStore
-
schedulerPaused
public void schedulerPaused()
- Specified by:
schedulerPausedin interfacecom.helger.quartz.spi.IJobStore
-
schedulerResumed
public void schedulerResumed()
- Specified by:
schedulerResumedin interfacecom.helger.quartz.spi.IJobStore
-
getMisfireThreshold
@Nonnegative public long getMisfireThreshold()
-
setMisfireThreshold
public void setMisfireThreshold(@Nonnegative long nMisfireThreshold)
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:
nMisfireThreshold- the new misfire threshold
-
shutdown
public void shutdown()
- Specified by:
shutdownin interfacecom.helger.quartz.spi.IJobStore
-
supportsPersistence
public boolean supportsPersistence()
- Specified by:
supportsPersistencein interfacecom.helger.quartz.spi.IJobStore
-
clearAllSchedulingData
public void clearAllSchedulingData() throws com.helger.quartz.JobPersistenceExceptionClear (delete!) all scheduling data - allIJobs,ITriggersICalendars.- Specified by:
clearAllSchedulingDatain interfacecom.helger.quartz.spi.IJobStore- Throws:
com.helger.quartz.JobPersistenceException- in case a nested call throws this
-
storeJobAndTrigger
public void storeJobAndTrigger(com.helger.quartz.IJobDetail aNewJob, com.helger.quartz.spi.IOperableTrigger aNewTrigger) throws com.helger.quartz.JobPersistenceException- Specified by:
storeJobAndTriggerin interfacecom.helger.quartz.spi.IJobStore- Throws:
com.helger.quartz.JobPersistenceException
-
storeJob
public void storeJob(com.helger.quartz.IJobDetail aNewJob, boolean bReplaceExisting) throws com.helger.quartz.ObjectAlreadyExistsException- Specified by:
storeJobin interfacecom.helger.quartz.spi.IJobStore- Throws:
com.helger.quartz.ObjectAlreadyExistsException
-
removeJob
public boolean removeJob(com.helger.quartz.JobKey jobKey)
- Specified by:
removeJobin interfacecom.helger.quartz.spi.IJobStore
-
removeJobs
public boolean removeJobs(@Nonnull List<com.helger.quartz.JobKey> jobKeys) throws com.helger.quartz.JobPersistenceException
- Specified by:
removeJobsin interfacecom.helger.quartz.spi.IJobStore- Throws:
com.helger.quartz.JobPersistenceException
-
removeTriggers
public boolean removeTriggers(@Nonnull List<com.helger.quartz.TriggerKey> triggerKeys) throws com.helger.quartz.JobPersistenceException
- Specified by:
removeTriggersin interfacecom.helger.quartz.spi.IJobStore- Throws:
com.helger.quartz.JobPersistenceException
-
storeJobsAndTriggers
public void storeJobsAndTriggers(Map<com.helger.quartz.IJobDetail,Set<? extends com.helger.quartz.ITrigger>> aTriggersAndJobs, boolean bReplace) throws com.helger.quartz.JobPersistenceException
- Specified by:
storeJobsAndTriggersin interfacecom.helger.quartz.spi.IJobStore- Throws:
com.helger.quartz.JobPersistenceException
-
storeTrigger
public void storeTrigger(@Nonnull com.helger.quartz.spi.IOperableTrigger aNewTrigger, boolean bReplaceExisting) throws com.helger.quartz.JobPersistenceException
- Specified by:
storeTriggerin interfacecom.helger.quartz.spi.IJobStore- Throws:
com.helger.quartz.JobPersistenceException
-
removeTrigger
public boolean removeTrigger(@Nonnull com.helger.quartz.TriggerKey triggerKey)
Remove (delete) the
with the given name.ITrigger- Specified by:
removeTriggerin interfacecom.helger.quartz.spi.IJobStore- Returns:
trueif aTriggerwith the given name and group was found and removed from the store.
-
replaceTrigger
public boolean replaceTrigger(com.helger.quartz.TriggerKey aTriggerKey, com.helger.quartz.spi.IOperableTrigger aNewTrigger) throws com.helger.quartz.JobPersistenceException- Specified by:
replaceTriggerin interfacecom.helger.quartz.spi.IJobStore- Throws:
com.helger.quartz.JobPersistenceException- See Also:
IJobStore.replaceTrigger(TriggerKey triggerKey, IOperableTrigger newTrigger)
-
retrieveJob
public com.helger.quartz.IJobDetail retrieveJob(com.helger.quartz.JobKey jobKey)
Retrieve the
for the givenIJobDetail.IJob- Specified by:
retrieveJobin interfacecom.helger.quartz.spi.IJobStore- Returns:
- The desired
Job, or null if there is no match.
-
retrieveTrigger
public com.helger.quartz.spi.IOperableTrigger retrieveTrigger(com.helger.quartz.TriggerKey triggerKey)
Retrieve the given
.ITrigger- Specified by:
retrieveTriggerin interfacecom.helger.quartz.spi.IJobStore- Returns:
- The desired
Trigger, or null if there is no match.
-
checkExists
public boolean checkExists(com.helger.quartz.JobKey jobKey) throws com.helger.quartz.JobPersistenceException- Specified by:
checkExistsin interfacecom.helger.quartz.spi.IJobStore- Throws:
com.helger.quartz.JobPersistenceException
-
checkExists
public boolean checkExists(com.helger.quartz.TriggerKey aTriggerKey) throws com.helger.quartz.JobPersistenceException- Specified by:
checkExistsin interfacecom.helger.quartz.spi.IJobStore- Throws:
com.helger.quartz.JobPersistenceException
-
getTriggerState
@Nonnull public com.helger.quartz.ITrigger.ETriggerState getTriggerState(com.helger.quartz.TriggerKey triggerKey) throws com.helger.quartz.JobPersistenceException
- Specified by:
getTriggerStatein interfacecom.helger.quartz.spi.IJobStore- Throws:
com.helger.quartz.JobPersistenceException
-
storeCalendar
public void storeCalendar(String name, com.helger.quartz.ICalendar aCalendar, boolean bReplaceExisting, boolean bUpdateTriggers) throws com.helger.quartz.ObjectAlreadyExistsException
- Specified by:
storeCalendarin interfacecom.helger.quartz.spi.IJobStore- Throws:
com.helger.quartz.ObjectAlreadyExistsException
-
removeCalendar
public boolean removeCalendar(String calName) throws com.helger.quartz.JobPersistenceException
- Specified by:
removeCalendarin interfacecom.helger.quartz.spi.IJobStore- Throws:
com.helger.quartz.JobPersistenceException
-
retrieveCalendar
public com.helger.quartz.ICalendar retrieveCalendar(String calName)
- Specified by:
retrieveCalendarin interfacecom.helger.quartz.spi.IJobStore
-
getNumberOfJobs
public int getNumberOfJobs()
- Specified by:
getNumberOfJobsin interfacecom.helger.quartz.spi.IJobStore
-
getNumberOfTriggers
public int getNumberOfTriggers()
- Specified by:
getNumberOfTriggersin interfacecom.helger.quartz.spi.IJobStore
-
getNumberOfCalendars
public int getNumberOfCalendars()
- Specified by:
getNumberOfCalendarsin interfacecom.helger.quartz.spi.IJobStore
-
getJobKeys
public com.helger.commons.collection.impl.ICommonsSet<com.helger.quartz.JobKey> getJobKeys(com.helger.quartz.impl.matchers.GroupMatcher<com.helger.quartz.JobKey> matcher)
- Specified by:
getJobKeysin interfacecom.helger.quartz.spi.IJobStore
-
getCalendarNames
@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<String> getCalendarNames()
- Specified by:
getCalendarNamesin interfacecom.helger.quartz.spi.IJobStore
-
getTriggerKeys
public com.helger.commons.collection.impl.ICommonsSet<com.helger.quartz.TriggerKey> getTriggerKeys(com.helger.quartz.impl.matchers.GroupMatcher<com.helger.quartz.TriggerKey> matcher)
- Specified by:
getTriggerKeysin interfacecom.helger.quartz.spi.IJobStore
-
getJobGroupNames
public com.helger.commons.collection.impl.ICommonsList<String> getJobGroupNames()
- Specified by:
getJobGroupNamesin interfacecom.helger.quartz.spi.IJobStore
-
getTriggerGroupNames
public com.helger.commons.collection.impl.ICommonsList<String> getTriggerGroupNames()
- Specified by:
getTriggerGroupNamesin interfacecom.helger.quartz.spi.IJobStore
-
getTriggersForJob
@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<com.helger.quartz.spi.IOperableTrigger> getTriggersForJob(com.helger.quartz.JobKey aJobKey)
- Specified by:
getTriggersForJobin interfacecom.helger.quartz.spi.IJobStore
-
getTriggerWrappersForJob
@Nonnull @ReturnsMutableCopy protected com.helger.commons.collection.impl.ICommonsList<com.helger.schedule.jobstore.TriggerWrapper> getTriggerWrappersForJob(com.helger.quartz.JobKey aJobKey)
-
getTriggerWrappersForCalendar
@Nonnull @ReturnsMutableCopy protected com.helger.commons.collection.impl.ICommonsList<com.helger.schedule.jobstore.TriggerWrapper> getTriggerWrappersForCalendar(String calName)
-
pauseTrigger
public void pauseTrigger(com.helger.quartz.TriggerKey triggerKey)
Pause the
with the given name.ITrigger- Specified by:
pauseTriggerin interfacecom.helger.quartz.spi.IJobStore
-
pauseTriggers
public com.helger.commons.collection.impl.ICommonsList<String> pauseTriggers(com.helger.quartz.impl.matchers.GroupMatcher<com.helger.quartz.TriggerKey> matcher)
- Specified by:
pauseTriggersin interfacecom.helger.quartz.spi.IJobStore
-
pauseJob
public void pauseJob(com.helger.quartz.JobKey jobKey)
Pause the
with the given name - by pausing all of its currentIJobDetailTriggers.- Specified by:
pauseJobin interfacecom.helger.quartz.spi.IJobStore
-
pauseJobs
public com.helger.commons.collection.impl.ICommonsList<String> pauseJobs(com.helger.quartz.impl.matchers.GroupMatcher<com.helger.quartz.JobKey> matcher)
Pause all of the
in the given group - by pausing all of theirIJobDetailsTriggers.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.
- Specified by:
pauseJobsin interfacecom.helger.quartz.spi.IJobStore
-
resumeTrigger
public void resumeTrigger(com.helger.quartz.TriggerKey triggerKey)
Resume (un-pause) the
with the given key.ITriggerIf the
Triggermissed one or more fire-times, then theTrigger's misfire instruction will be applied.- Specified by:
resumeTriggerin interfacecom.helger.quartz.spi.IJobStore
-
resumeTriggers
public com.helger.commons.collection.impl.ICommonsList<String> resumeTriggers(com.helger.quartz.impl.matchers.GroupMatcher<com.helger.quartz.TriggerKey> matcher)
- Specified by:
resumeTriggersin interfacecom.helger.quartz.spi.IJobStore
-
resumeJob
public void resumeJob(com.helger.quartz.JobKey jobKey)
- Specified by:
resumeJobin interfacecom.helger.quartz.spi.IJobStore
-
resumeJobs
public com.helger.commons.collection.impl.ICommonsCollection<String> resumeJobs(com.helger.quartz.impl.matchers.GroupMatcher<com.helger.quartz.JobKey> matcher)
- Specified by:
resumeJobsin interfacecom.helger.quartz.spi.IJobStore
-
pauseAll
public void pauseAll()
- Specified by:
pauseAllin interfacecom.helger.quartz.spi.IJobStore
-
resumeAll
public void resumeAll()
Resume (un-pause) all triggers - equivalent of calling
resumeTriggerGroup(group)on every group.If any
Triggermissed one or more fire-times, then theTrigger's misfire instruction will be applied.- Specified by:
resumeAllin interfacecom.helger.quartz.spi.IJobStore- See Also:
pauseAll()
-
applyMisfire
@MustBeLocked(WRITE) protected boolean applyMisfire(com.helger.schedule.jobstore.TriggerWrapper tw)
-
getFiredTriggerRecordId
protected String getFiredTriggerRecordId()
-
acquireNextTriggers
public com.helger.commons.collection.impl.ICommonsList<com.helger.quartz.spi.IOperableTrigger> acquireNextTriggers(long noLaterThan, int maxCount, long timeWindow)- Specified by:
acquireNextTriggersin interfacecom.helger.quartz.spi.IJobStore
-
releaseAcquiredTrigger
public void releaseAcquiredTrigger(com.helger.quartz.spi.IOperableTrigger trigger)
Inform the
JobStorethat the scheduler no longer plans to fire the givenTrigger, that it had previously acquired (reserved).- Specified by:
releaseAcquiredTriggerin interfacecom.helger.quartz.spi.IJobStore
-
triggersFired
public com.helger.commons.collection.impl.ICommonsList<com.helger.quartz.spi.TriggerFiredResult> triggersFired(List<com.helger.quartz.spi.IOperableTrigger> firedTriggers)
Inform the
JobStorethat the scheduler is now firing the givenTrigger(executing its associatedJob), that it had previously acquired (reserved).- Specified by:
triggersFiredin interfacecom.helger.quartz.spi.IJobStore
-
triggeredJobComplete
public void triggeredJobComplete(com.helger.quartz.spi.IOperableTrigger trigger, com.helger.quartz.IJobDetail jobDetail, com.helger.quartz.ITrigger.ECompletedExecutionInstruction triggerInstCode)- Specified by:
triggeredJobCompletein interfacecom.helger.quartz.spi.IJobStore
-
setAllTriggersOfJobToState
@MustBeLocked(WRITE) protected void setAllTriggersOfJobToState(com.helger.quartz.JobKey jobKey, int state)
-
peekTriggers
protected String peekTriggers()
-
getPausedTriggerGroups
public com.helger.commons.collection.impl.ICommonsSet<String> getPausedTriggerGroups() throws com.helger.quartz.JobPersistenceException
- Specified by:
getPausedTriggerGroupsin interfacecom.helger.quartz.spi.IJobStore- Throws:
com.helger.quartz.JobPersistenceException- See Also:
IJobStore.getPausedTriggerGroups()
-
setInstanceId
public void setInstanceId(String schedInstId)
- Specified by:
setInstanceIdin interfacecom.helger.quartz.spi.IJobStore
-
setInstanceName
public void setInstanceName(String schedName)
- Specified by:
setInstanceNamein interfacecom.helger.quartz.spi.IJobStore
-
setThreadPoolSize
public void setThreadPoolSize(int poolSize)
- Specified by:
setThreadPoolSizein interfacecom.helger.quartz.spi.IJobStore
-
getEstimatedTimeToReleaseAndAcquireTrigger
public long getEstimatedTimeToReleaseAndAcquireTrigger()
- Specified by:
getEstimatedTimeToReleaseAndAcquireTriggerin interfacecom.helger.quartz.spi.IJobStore
-
isClustered
public boolean isClustered()
- Specified by:
isClusteredin interfacecom.helger.quartz.spi.IJobStore
-
-