|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
org.quartz.impl.jdbcjobstore Class JobStoreSupport
java.lang.Object org.quartz.impl.jdbcjobstore.JobStoreSupport
- All Implemented Interfaces:
- Constants, org.quartz.spi.JobStore
- Direct Known Subclasses:
- JobStoreCMT, JobStoreTX
Contains base functionality for JDBC-based JobStore implementations.
- Author:
- Jeffrey Wescott, James House
Nested Class Summary | |
---|---|
protected static class |
JobStoreSupport.RecoverMisfiredJobsResult
Helper class for returning the composite result of trying to recover misfired jobs. |
protected static interface |
JobStoreSupport.TransactionCallback
Implement this interface to provide the code to execute within the a transaction template. |
protected static interface |
JobStoreSupport.VoidTransactionCallback
Implement this interface to provide the code to execute within the a transaction template that has no return value. |
Field Summary | |
---|---|
protected HashMap<String,Calendar> |
calendarCache
|
protected Class<? extends DriverDelegate> |
delegateClass
|
protected String |
delegateClassName
|
protected String |
delegateInitString
|
protected String |
dsName
|
protected boolean |
firstCheckIn
|
protected String |
instanceId
|
protected String |
instanceName
|
protected long |
lastCheckin
|
protected static String |
LOCK_CALENDAR_ACCESS
|
protected static String |
LOCK_JOB_ACCESS
|
protected static String |
LOCK_MISFIRE_ACCESS
|
protected static String |
LOCK_STATE_ACCESS
|
protected static String |
LOCK_TRIGGER_ACCESS
|
protected int |
maxToRecoverAtATime
|
protected ThreadLocal<Long> |
sigChangeForTxCompletion
|
protected String |
tablePrefix
|
protected boolean |
useProperties
|
Constructor Summary | |
---|---|
JobStoreSupport()
|
Method Summary | |
---|---|
protected List<org.quartz.spi.OperableTrigger> |
acquireNextTrigger(Connection conn,
long noLaterThan,
int maxCount,
long timeWindow)
|
List<org.quartz.spi.OperableTrigger> |
acquireNextTriggers(long noLaterThan,
int maxCount,
long timeWindow)
Get a handle to the next N triggers to be fired, and mark them as 'reserved' by the calling scheduler. |
protected long |
calcFailedIfAfter(SchedulerStateRecord rec)
|
protected boolean |
calendarExists(Connection conn,
String calName)
|
boolean |
canUseProperties()
Get whether String-only properties will be handled in JobDataMaps. |
protected String |
checkBlockedState(Connection conn,
JobKey jobKey,
String currentState)
Determines if a Trigger for the given job should be blocked. |
protected boolean |
checkExists(Connection conn,
JobKey jobKey)
|
protected boolean |
checkExists(Connection conn,
TriggerKey triggerKey)
|
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. |
protected void |
cleanupConnection(Connection conn)
Cleanup the given database connection. |
void |
clearAllSchedulingData()
Clear (delete!) all scheduling data - all Job s, Trigger s
Calendar s. |
protected void |
clearAllSchedulingData(Connection conn)
|
protected Long |
clearAndGetSignalSchedulingChangeOnTxCompletion()
|
protected void |
closeConnection(Connection conn)
Closes the supplied Connection . |
protected List<SchedulerStateRecord> |
clusterCheckIn(Connection conn)
|
protected void |
clusterRecover(Connection conn,
List<SchedulerStateRecord> failedInstances)
|
protected void |
commitConnection(Connection conn)
Commit the supplied connection |
protected boolean |
doCheckin()
|
protected JobStoreSupport.RecoverMisfiredJobsResult |
doRecoverMisfires()
|
protected abstract Object |
executeInLock(String lockName,
JobStoreSupport.TransactionCallback txCallback)
Execute the given callback having aquired the given lock. |
protected void |
executeInLock(String lockName,
JobStoreSupport.VoidTransactionCallback txCallback)
Execute the given callback having aquired the given lock. |
protected Object |
executeInNonManagedTXLock(String lockName,
JobStoreSupport.TransactionCallback txCallback)
Execute the given callback having optionally aquired the given lock. |
protected void |
executeInNonManagedTXLock(String lockName,
JobStoreSupport.VoidTransactionCallback txCallback)
Execute the given callback having optionally aquired the given lock. |
Object |
executeWithoutLock(JobStoreSupport.TransactionCallback txCallback)
Execute the given callback in a transaction. |
protected List<SchedulerStateRecord> |
findFailedInstances(Connection conn)
Get a list of all scheduler instances in the cluster that may have failed. |
protected Connection |
getAttributeRestoringConnection(Connection conn)
Wrap the given Connection in a Proxy such that attributes
that might be set will be restored before the connection is closed
(and potentially restored to a pool). |
List<String> |
getCalendarNames()
Get the names of all of the
Calendar s
in the JobStore . |
protected List<String> |
getCalendarNames(Connection conn)
|
protected org.quartz.spi.ClassLoadHelper |
getClassLoadHelper()
|
long |
getClusterCheckinInterval()
Get the frequency (in milliseconds) at which this instance "checks-in" with the other instances of the cluster. |
protected Connection |
getConnection()
|
String |
getDataSource()
Get the name of the DataSource that should be used for
performing database functions. |
long |
getDbRetryInterval()
|
protected DriverDelegate |
getDelegate()
Get the driver delegate for DB operations. |
boolean |
getDoubleCheckLockMisfireHandler()
Get whether to check to see if there are Triggers that have misfired before actually acquiring the lock to recover them. |
String |
getDriverDelegateClass()
Get the JDBC driver delegate class name. |
String |
getDriverDelegateInitString()
Get the JDBC driver delegate's initialization string. |
long |
getEstimatedTimeToReleaseAndAcquireTrigger()
|
protected String |
getFiredTriggerRecordId()
|
String |
getInstanceId()
Get the instance Id of the Scheduler (must be unique within a cluster). |
String |
getInstanceName()
Get the instance name of the Scheduler (must be unique within this server instance). |
List<String> |
getJobGroupNames()
Get the names of all of the
Job
groups. |
protected List<String> |
getJobGroupNames(Connection conn)
|
Set<JobKey> |
getJobKeys(GroupMatcher<JobKey> matcher)
Get the names of all of the
Job s that
matcher the given groupMatcher. |
protected Set<JobKey> |
getJobNames(Connection conn,
GroupMatcher<JobKey> matcher)
|
protected Semaphore |
getLockHandler()
|
protected org.slf4j.Logger |
getLog()
|
boolean |
getMakeThreadsDaemons()
Get whether the threads spawned by this JobStore should be marked as daemon. |
int |
getMaxMisfiresToHandleAtATime()
Get the maximum number of misfired triggers that the misfire handling thread will try to recover at one time (within one transaction). |
long |
getMisfireThreshold()
|
protected long |
getMisfireTime()
|
protected abstract Connection |
getNonManagedTXConnection()
|
int |
getNumberOfCalendars()
Get the number of
Calendar s that are
stored in the JobsStore . |
protected int |
getNumberOfCalendars(Connection conn)
|
int |
getNumberOfJobs()
Get the number of
Job s that are
stored in the JobStore . |
protected int |
getNumberOfJobs(Connection conn)
|
int |
getNumberOfTriggers()
Get the number of
Trigger s that are
stored in the JobsStore . |
protected int |
getNumberOfTriggers(Connection conn)
|
Set<String> |
getPausedTriggerGroups()
|
Set<String> |
getPausedTriggerGroups(Connection conn)
Pause all of the
Trigger s in the
given group. |
String |
getSelectWithLockSQL()
|
String |
getTablePrefix()
Get the prefix that should be pre-pended to all table names. |
List<String> |
getTriggerGroupNames()
Get the names of all of the
Trigger
groups. |
protected List<String> |
getTriggerGroupNames(Connection conn)
|
Set<TriggerKey> |
getTriggerKeys(GroupMatcher<TriggerKey> matcher)
Get the names of all of the
Trigger s
that match the given group Matcher. |
protected Set<TriggerKey> |
getTriggerNames(Connection conn,
GroupMatcher<TriggerKey> matcher)
|
protected List<org.quartz.spi.OperableTrigger> |
getTriggersForJob(Connection conn,
JobKey key)
|
List<org.quartz.spi.OperableTrigger> |
getTriggersForJob(JobKey jobKey)
Get all of the Triggers that are associated to the given Job. |
Trigger.TriggerState |
getTriggerState(Connection conn,
TriggerKey key)
|
Trigger.TriggerState |
getTriggerState(TriggerKey triggerKey)
Get the current state of the identified
Trigger . |
boolean |
getUseDBLocks()
Get whether this instance should use database-based thread synchronization. |
void |
initialize(org.quartz.spi.ClassLoadHelper loadHelper,
org.quartz.spi.SchedulerSignaler signaler)
Called by the QuartzScheduler before the JobStore is
used, in order to give it a chance to initialize. |
boolean |
isAcquireTriggersWithinLock()
Whether or not the query and update to acquire a Trigger for firing should be performed after obtaining an explicit DB lock (to avoid possible race conditions on the trigger's db row). |
boolean |
isClustered()
Get whether this instance is part of a cluster. |
boolean |
isDontSetAutoCommitFalse()
|
boolean |
isLockOnInsert()
|
boolean |
isThreadsInheritInitializersClassLoadContext()
Get whether to set the class load context of spawned threads to that of the initializing thread. |
boolean |
isTxIsolationLevelSerializable()
|
protected boolean |
jobExists(Connection conn,
JobKey jobKey)
Check existence of a given job. |
protected void |
logWarnIfNonZero(int val,
String warning)
|
void |
pauseAll()
Pause all triggers - equivalent of calling pauseTriggerGroup(group)
on every group. |
void |
pauseAll(Connection conn)
Pause all triggers - equivalent of calling pauseTriggerGroup(group)
on every group. |
void |
pauseJob(JobKey jobKey)
Pause the
Job with the given name - by
pausing all of its current Trigger s. |
Set<String> |
pauseJobs(GroupMatcher<JobKey> matcher)
Pause all of the
Job s matching the given
groupMatcher - by pausing all of their Trigger s. |
void |
pauseTrigger(Connection conn,
TriggerKey triggerKey)
Pause the
Trigger with the given name. |
void |
pauseTrigger(TriggerKey triggerKey)
Pause the
Trigger with the given name. |
Set<String> |
pauseTriggerGroup(Connection conn,
GroupMatcher<TriggerKey> matcher)
Pause all of the
Trigger s matching the
given groupMatcher. |
Set<String> |
pauseTriggers(GroupMatcher<TriggerKey> matcher)
Pause all of the
Trigger s matching the
given groupMatcher. |
protected void |
recoverJobs()
Recover any failed or misfired jobs and clean up the data store as appropriate. |
protected void |
recoverJobs(Connection conn)
Will recover any failed or misfired jobs and clean up the data store as appropriate. |
protected JobStoreSupport.RecoverMisfiredJobsResult |
recoverMisfiredJobs(Connection conn,
boolean recovering)
|
protected void |
releaseAcquiredTrigger(Connection conn,
org.quartz.spi.OperableTrigger trigger)
|
void |
releaseAcquiredTrigger(org.quartz.spi.OperableTrigger trigger)
Inform the JobStore that the scheduler no longer plans to
fire the given Trigger , that it had previously acquired
(reserved). |
protected void |
releaseLock(Connection conn,
String lockName,
boolean doIt)
|
protected boolean |
removeCalendar(Connection conn,
String calName)
|
boolean |
removeCalendar(String calName)
Remove (delete) the
Calendar with the
given name. |
protected boolean |
removeJob(Connection conn,
JobKey jobKey,
boolean activeDeleteSafe)
|
boolean |
removeJob(JobKey jobKey)
Remove (delete) the
Job with the given
name, and any
Trigger s that reference
it. |
boolean |
removeJobs(List<JobKey> jobKeys)
|
protected boolean |
removeTrigger(Connection conn,
TriggerKey key)
|
boolean |
removeTrigger(TriggerKey triggerKey)
Remove (delete) the
Trigger with the
given name. |
boolean |
removeTriggers(List<TriggerKey> triggerKeys)
|
protected boolean |
replaceTrigger(Connection conn,
TriggerKey key,
org.quartz.spi.OperableTrigger newTrigger)
|
boolean |
replaceTrigger(TriggerKey triggerKey,
org.quartz.spi.OperableTrigger newTrigger)
|
void |
resumeAll()
Resume (un-pause) all triggers - equivalent of calling resumeTriggerGroup(group)
on every group. |
void |
resumeAll(Connection conn)
protected |
void |
resumeJob(JobKey jobKey)
Resume (un-pause) the
Job with the
given name. |
Set<String> |
resumeJobs(GroupMatcher<JobKey> matcher)
Resume (un-pause) all of the
Job s in
the given group. |
void |
resumeTrigger(Connection conn,
TriggerKey key)
Resume (un-pause) the
Trigger with the
given name. |
void |
resumeTrigger(TriggerKey triggerKey)
Resume (un-pause) the
Trigger with the
given name. |
Set<String> |
resumeTriggerGroup(Connection conn,
GroupMatcher<TriggerKey> matcher)
Resume (un-pause) all of the
Trigger s
matching the given groupMatcher. |
Set<String> |
resumeTriggers(GroupMatcher<TriggerKey> matcher)
Resume (un-pause) all of the
Trigger s
matching the given groupMatcher. |
protected Calendar |
retrieveCalendar(Connection conn,
String calName)
|
Calendar |
retrieveCalendar(String calName)
Retrieve the given
Trigger . |
protected JobDetail |
retrieveJob(Connection conn,
JobKey key)
|
JobDetail |
retrieveJob(JobKey jobKey)
Retrieve the
JobDetail for the given
Job . |
protected org.quartz.spi.OperableTrigger |
retrieveTrigger(Connection conn,
TriggerKey key)
|
org.quartz.spi.OperableTrigger |
retrieveTrigger(TriggerKey triggerKey)
Retrieve the given
Trigger . |
protected void |
rollbackConnection(Connection conn)
Rollback the supplied connection. |
void |
schedulerStarted()
|
void |
setAcquireTriggersWithinLock(boolean acquireTriggersWithinLock)
Whether or not the query and update to acquire a Trigger for firing should be performed after obtaining an explicit DB lock. |
void |
setClusterCheckinInterval(long l)
Set the frequency (in milliseconds) at which this instance "checks-in" with the other instances of the cluster. |
void |
setDataSource(String dsName)
Set the name of the DataSource that should be used for
performing database functions. |
void |
setDbRetryInterval(long dbRetryInterval)
|
void |
setDontSetAutoCommitFalse(boolean b)
Don't call set autocommit(false) on connections obtained from the DataSource. |
void |
setDoubleCheckLockMisfireHandler(boolean doubleCheckLockMisfireHandler)
Set whether to check to see if there are Triggers that have misfired before actually acquiring the lock to recover them. |
void |
setDriverDelegateClass(String delegateClassName)
Set the JDBC driver delegate class. |
void |
setDriverDelegateInitString(String delegateInitString)
Set the JDBC driver delegate's initialization string. |
void |
setInstanceId(String instanceId)
Set the instance Id of the Scheduler (must be unique within a cluster). |
void |
setInstanceName(String instanceName)
Set the instance name of the Scheduler (must be unique within this server instance). |
void |
setIsClustered(boolean isClustered)
Set whether this instance is part of a cluster. |
void |
setLockHandler(Semaphore lockHandler)
|
void |
setLockOnInsert(boolean lockOnInsert)
Whether or not to obtain locks when inserting new jobs/triggers. |
void |
setMakeThreadsDaemons(boolean makeThreadsDaemons)
Set whether the threads spawned by this JobStore should be marked as daemon. |
void |
setMaxMisfiresToHandleAtATime(int maxToRecoverAtATime)
Set the maximum number of misfired triggers that the misfire handling thread will try to recover at one time (within one transaction). |
void |
setMisfireThreshold(long misfireThreshold)
The 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 |
setSelectWithLockSQL(String string)
set the SQL statement to use to select and lock a row in the "locks" table. |
void |
setTablePrefix(String prefix)
Set the prefix that should be pre-pended to all table names. |
void |
setThreadPoolSize(int poolSize)
|
void |
setThreadsInheritInitializersClassLoadContext(boolean threadsInheritInitializersClassLoadContext)
Set whether to set the class load context of spawned threads to that of the initializing thread. |
void |
setTxIsolationLevelSerializable(boolean b)
Set the transaction isolation level of DB connections to sequential. |
void |
setUseDBLocks(boolean useDBLocks)
Set whether this instance should use database-based thread synchronization. |
void |
setUseProperties(String useProp)
Set whether String-only properties will be handled in JobDataMaps. |
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. |
protected void |
signalSchedulingChangeImmediately(long candidateNewNextFireTime)
|
protected void |
signalSchedulingChangeOnTxCompletion(long candidateNewNextFireTime)
|
protected void |
storeCalendar(Connection conn,
String calName,
Calendar calendar,
boolean replaceExisting,
boolean updateTriggers)
|
void |
storeCalendar(String calName,
Calendar calendar,
boolean replaceExisting,
boolean updateTriggers)
Store the given
Calendar . |
protected void |
storeJob(Connection conn,
JobDetail newJob,
boolean replaceExisting)
Insert or update a job. |
void |
storeJob(JobDetail newJob,
boolean replaceExisting)
Store the given
JobDetail . |
void |
storeJobAndTrigger(JobDetail newJob,
org.quartz.spi.OperableTrigger newTrigger)
Store the given
JobDetail and
Trigger . |
void |
storeJobsAndTriggers(Map<JobDetail,List<Trigger>> triggersAndJobs,
boolean replace)
|
protected void |
storeTrigger(Connection conn,
org.quartz.spi.OperableTrigger newTrigger,
JobDetail job,
boolean replaceExisting,
String state,
boolean forceState,
boolean recovering)
Insert or update a trigger. |
void |
storeTrigger(org.quartz.spi.OperableTrigger newTrigger,
boolean replaceExisting)
Store the given
Trigger . |
boolean |
supportsPersistence()
|
protected void |
triggeredJobComplete(Connection conn,
org.quartz.spi.OperableTrigger trigger,
JobDetail jobDetail,
Trigger.CompletedExecutionInstruction triggerInstCode)
|
void |
triggeredJobComplete(org.quartz.spi.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
JobDataMap
in the given JobDetail should be updated if the Job
is stateful. |
protected boolean |
triggerExists(Connection conn,
TriggerKey key)
Check existence of a given trigger. |
protected org.quartz.spi.TriggerFiredBundle |
triggerFired(Connection conn,
org.quartz.spi.OperableTrigger trigger)
|
List<org.quartz.spi.TriggerFiredResult> |
triggersFired(List<org.quartz.spi.OperableTrigger> triggers)
Inform the JobStore that the scheduler is now firing the
given Trigger (executing its associated Job ),
that it had previously acquired (reserved). |
protected boolean |
updateMisfiredTrigger(Connection conn,
TriggerKey triggerKey,
String newStateIfNotComplete,
boolean forceState)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
LOCK_TRIGGER_ACCESS
protected static final String LOCK_TRIGGER_ACCESS
- See Also:
- Constant Field Values
LOCK_JOB_ACCESS
protected static final String LOCK_JOB_ACCESS
- See Also:
- Constant Field Values
LOCK_CALENDAR_ACCESS
protected static final String LOCK_CALENDAR_ACCESS
- See Also:
- Constant Field Values
LOCK_STATE_ACCESS
protected static final String LOCK_STATE_ACCESS
- See Also:
- Constant Field Values
LOCK_MISFIRE_ACCESS
protected static final String LOCK_MISFIRE_ACCESS
- See Also:
- Constant Field Values
dsName
protected String dsName
tablePrefix
protected String tablePrefix
useProperties
protected boolean useProperties
instanceId
protected String instanceId
instanceName
protected String instanceName
delegateClassName
protected String delegateClassName
delegateInitString
protected String delegateInitString
delegateClass
protected Class<? extends DriverDelegate> delegateClass
calendarCache
protected HashMap<String,Calendar> calendarCache
maxToRecoverAtATime
protected int maxToRecoverAtATime
sigChangeForTxCompletion
protected ThreadLocal<Long> sigChangeForTxCompletion
firstCheckIn
protected boolean firstCheckIn
lastCheckin
protected long lastCheckin
Constructor Detail |
---|
JobStoreSupport
public JobStoreSupport()
Method Detail |
---|
setDataSource
public void setDataSource(String dsName)
Set the name of the
DataSource
that should be used for performing database functions.
getDataSource
public String getDataSource()
Get the name of the
DataSource
that should be used for performing database functions.
setTablePrefix
public void setTablePrefix(String prefix)
Set the prefix that should be pre-pended to all table names.
getTablePrefix
public String getTablePrefix()
Get the prefix that should be pre-pended to all table names.
setUseProperties
public void setUseProperties(String useProp)
Set whether String-only properties will be handled in JobDataMaps.
canUseProperties
public boolean canUseProperties()
Get whether String-only properties will be handled in JobDataMaps.
setInstanceId
public void setInstanceId(String instanceId)
Set the instance Id of the Scheduler (must be unique within a cluster).
- Specified by:
setInstanceId
in interfaceorg.quartz.spi.JobStore
getInstanceId
public String getInstanceId()
Get the instance Id of the Scheduler (must be unique within a cluster).
setInstanceName
public void setInstanceName(String instanceName)
- Set the instance name of the Scheduler (must be unique within this server instance).
- Specified by:
setInstanceName
in interfaceorg.quartz.spi.JobStore
setThreadPoolSize
public void setThreadPoolSize(int poolSize)
- Specified by:
setThreadPoolSize
in interfaceorg.quartz.spi.JobStore
getInstanceName
public String getInstanceName()
- Get the instance name of the Scheduler (must be unique within this server instance).
getEstimatedTimeToReleaseAndAcquireTrigger
public long getEstimatedTimeToReleaseAndAcquireTrigger()
- Specified by:
getEstimatedTimeToReleaseAndAcquireTrigger
in interfaceorg.quartz.spi.JobStore
setIsClustered
public void setIsClustered(boolean isClustered)
Set whether this instance is part of a cluster.
isClustered
public boolean isClustered()
Get whether this instance is part of a cluster.
- Specified by:
isClustered
in interfaceorg.quartz.spi.JobStore
getClusterCheckinInterval
public long getClusterCheckinInterval()
Get the frequency (in milliseconds) at which this instance "checks-in" with the other instances of the cluster. -- Affects the rate of detecting failed instances.
setClusterCheckinInterval
public void setClusterCheckinInterval(long l)
Set the frequency (in milliseconds) at which this instance "checks-in" with the other instances of the cluster. -- Affects the rate of detecting failed instances.
getMaxMisfiresToHandleAtATime
public int getMaxMisfiresToHandleAtATime()
Get the maximum number of misfired triggers that the misfire handling thread will try to recover at one time (within one transaction). The default is 20.
setMaxMisfiresToHandleAtATime
public void setMaxMisfiresToHandleAtATime(int maxToRecoverAtATime)
Set the maximum number of misfired triggers that the misfire handling thread will try to recover at one time (within one transaction). The default is 20.
getDbRetryInterval
public long getDbRetryInterval()
- Returns:
- Returns the dbRetryInterval.
setDbRetryInterval
public void setDbRetryInterval(long dbRetryInterval)
- Parameters:
dbRetryInterval
- The dbRetryInterval to set.
setUseDBLocks
public void setUseDBLocks(boolean useDBLocks)
Set whether this instance should use database-based thread synchronization.
getUseDBLocks
public boolean getUseDBLocks()
Get whether this instance should use database-based thread synchronization.
isLockOnInsert
public boolean isLockOnInsert()
setLockOnInsert
public void setLockOnInsert(boolean lockOnInsert)
- Whether or not to obtain locks when inserting new jobs/triggers.
Defaults to
true
, which is safest - some db's (such as MS SQLServer) seem to require this to avoid deadlocks under high load, while others seem to do fine without.Setting this property to
false
will provide a significant performance increase during the addition of new jobs and triggers. - Parameters:
lockOnInsert
-
getMisfireThreshold
public long getMisfireThreshold()
setMisfireThreshold
public void setMisfireThreshold(long misfireThreshold)
- The 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
-
isDontSetAutoCommitFalse
public boolean isDontSetAutoCommitFalse()
setDontSetAutoCommitFalse
public void setDontSetAutoCommitFalse(boolean b)
- Don't call set autocommit(false) on connections obtained from the
DataSource. This can be helpfull in a few situations, such as if you
have a driver that complains if it is called when it is already off.
- Parameters:
b
-
isTxIsolationLevelSerializable
public boolean isTxIsolationLevelSerializable()
setTxIsolationLevelSerializable
public void setTxIsolationLevelSerializable(boolean b)
- Set the transaction isolation level of DB connections to sequential.
- Parameters:
b
-
isAcquireTriggersWithinLock
public boolean isAcquireTriggersWithinLock()
- Whether or not the query and update to acquire a Trigger for firing
should be performed after obtaining an explicit DB lock (to avoid
possible race conditions on the trigger's db row). This is the
behavior prior to Quartz 1.6.3, but is considered unnecessary for most
databases (due to the nature of the SQL update that is performed),
and therefore a superfluous performance hit.
setAcquireTriggersWithinLock
public void setAcquireTriggersWithinLock(boolean acquireTriggersWithinLock)
- Whether or not the query and update to acquire a Trigger for firing
should be performed after obtaining an explicit DB lock. This is the
behavior prior to Quartz 1.6.3, but is considered unnecessary for most
databases, and therefore a superfluous performance hit.
setDriverDelegateClass
public void setDriverDelegateClass(String delegateClassName) throws InvalidConfigurationException
Set the JDBC driver delegate class.
- Parameters:
delegateClassName
- the delegate class name- Throws:
InvalidConfigurationException
getDriverDelegateClass
public String getDriverDelegateClass()
Get the JDBC driver delegate class name.
- Returns:
- the delegate class name
setDriverDelegateInitString
public void setDriverDelegateInitString(String delegateInitString) throws InvalidConfigurationException
Set the JDBC driver delegate's initialization string.
- Parameters:
delegateClassName
- the delegate init string- Throws:
InvalidConfigurationException
getDriverDelegateInitString
public String getDriverDelegateInitString()
Get the JDBC driver delegate's initialization string.
- Returns:
- the delegate init string
getSelectWithLockSQL
public String getSelectWithLockSQL()
setSelectWithLockSQL
public void setSelectWithLockSQL(String string)
set the SQL statement to use to select and lock a row in the "locks" table.
- See Also:
StdRowLockSemaphore
getClassLoadHelper
protected org.quartz.spi.ClassLoadHelper getClassLoadHelper()
getMakeThreadsDaemons
public boolean getMakeThreadsDaemons()
- Get whether the threads spawned by this JobStore should be
marked as daemon. Possible threads include the
MisfireHandler
and theClusterManager
. - See Also:
Thread.setDaemon(boolean)
setMakeThreadsDaemons
public void setMakeThreadsDaemons(boolean makeThreadsDaemons)
- Set whether the threads spawned by this JobStore should be
marked as daemon. Possible threads include the
MisfireHandler
and theClusterManager
. - See Also:
Thread.setDaemon(boolean)
isThreadsInheritInitializersClassLoadContext
public boolean isThreadsInheritInitializersClassLoadContext()
- Get whether to set the class load context of spawned threads to that
of the initializing thread.
setThreadsInheritInitializersClassLoadContext
public void setThreadsInheritInitializersClassLoadContext(boolean threadsInheritInitializersClassLoadContext)
- Set whether to set the class load context of spawned threads to that
of the initializing thread.
getDoubleCheckLockMisfireHandler
public boolean getDoubleCheckLockMisfireHandler()
- Get whether to check to see if there are Triggers that have misfired
before actually acquiring the lock to recover them. This should be
set to false if the majority of the time, there are are misfired
Triggers.
setDoubleCheckLockMisfireHandler
public void setDoubleCheckLockMisfireHandler(boolean doubleCheckLockMisfireHandler)
- Set whether to check to see if there are Triggers that have misfired
before actually acquiring the lock to recover them. This should be
set to false if the majority of the time, there are are misfired
Triggers.
getLog
protected org.slf4j.Logger getLog()
initialize
public void initialize(org.quartz.spi.ClassLoadHelper loadHelper, org.quartz.spi.SchedulerSignaler signaler) throws SchedulerConfigException
Called by the QuartzScheduler before the
JobStore
is used, in order to give it a chance to initialize.- Specified by:
initialize
in interfaceorg.quartz.spi.JobStore
- Throws:
SchedulerConfigException
schedulerStarted
public void schedulerStarted() throws SchedulerException
- Specified by:
schedulerStarted
in interfaceorg.quartz.spi.JobStore
- Throws:
SchedulerException
- See Also:
JobStore.schedulerStarted()
shutdown
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.- Specified by:
shutdown
in interfaceorg.quartz.spi.JobStore
supportsPersistence
public boolean supportsPersistence()
- Specified by:
supportsPersistence
in interfaceorg.quartz.spi.JobStore
getNonManagedTXConnection
protected abstract Connection getNonManagedTXConnection() throws JobPersistenceException
- Throws:
JobPersistenceException
getAttributeRestoringConnection
protected Connection getAttributeRestoringConnection(Connection conn)
- Wrap the given
Connection
in a Proxy such that attributes that might be set will be restored before the connection is closed (and potentially restored to a pool).
getConnection
protected Connection getConnection() throws JobPersistenceException
- Throws:
JobPersistenceException
releaseLock
protected void releaseLock(Connection conn, String lockName, boolean doIt)
recoverJobs
protected void recoverJobs() throws JobPersistenceException
- Recover any failed or misfired jobs and clean up the data store as
appropriate.
- Throws:
JobPersistenceException
- if jobs could not be recovered
recoverJobs
protected void recoverJobs(Connection conn) throws JobPersistenceException
Will recover any failed or misfired jobs and clean up the data store as appropriate.
- Throws:
JobPersistenceException
- if jobs could not be recovered
getMisfireTime
protected long getMisfireTime()
recoverMisfiredJobs
protected JobStoreSupport.RecoverMisfiredJobsResult recoverMisfiredJobs(Connection conn, boolean recovering) throws JobPersistenceException, SQLException
- Throws:
JobPersistenceException
SQLException
updateMisfiredTrigger
protected boolean updateMisfiredTrigger(Connection conn, TriggerKey triggerKey, String newStateIfNotComplete, boolean forceState) throws JobPersistenceException
- Throws:
JobPersistenceException
storeJobAndTrigger
public void storeJobAndTrigger(JobDetail newJob, org.quartz.spi.OperableTrigger newTrigger) throws ObjectAlreadyExistsException, JobPersistenceException
Store the given
JobDetail
andTrigger
.- Specified by:
storeJobAndTrigger
in interfaceorg.quartz.spi.JobStore
- Parameters:
newJob
- TheJobDetail
to be stored.newTrigger
- TheTrigger
to be stored.- Throws:
ObjectAlreadyExistsException
- if aJob
with the same name/group already exists.JobPersistenceException
storeJob
public void storeJob(JobDetail newJob, boolean replaceExisting) throws ObjectAlreadyExistsException, JobPersistenceException
Store the given
JobDetail
.- Specified by:
storeJob
in interfaceorg.quartz.spi.JobStore
- Parameters:
newJob
- TheJobDetail
to be stored.replaceExisting
- Iftrue
, anyJob
existing in theJobStore
with the same name & group should be over-written.- Throws:
ObjectAlreadyExistsException
- if aJob
with the same name/group already exists, and replaceExisting is set to false.JobPersistenceException
storeJob
protected void storeJob(Connection conn, JobDetail newJob, boolean replaceExisting) throws ObjectAlreadyExistsException, JobPersistenceException
Insert or update a job.
jobExists
protected boolean jobExists(Connection conn, JobKey jobKey) throws JobPersistenceException
Check existence of a given job.
- Throws:
JobPersistenceException
storeTrigger
public void storeTrigger(org.quartz.spi.OperableTrigger newTrigger, boolean replaceExisting) throws ObjectAlreadyExistsException, JobPersistenceException
Store the given
Trigger
.- Specified by:
storeTrigger
in interfaceorg.quartz.spi.JobStore
- Parameters:
newTrigger
- TheTrigger
to be stored.replaceExisting
- Iftrue
, anyTrigger
existing in theJobStore
with the same name & group should be over-written.- Throws:
ObjectAlreadyExistsException
- if aTrigger
with the same name/group already exists, and replaceExisting is set to false.JobPersistenceException
storeTrigger
protected void storeTrigger(Connection conn, org.quartz.spi.OperableTrigger newTrigger, JobDetail job, boolean replaceExisting, String state, boolean forceState, boolean recovering) throws ObjectAlreadyExistsException, JobPersistenceException
Insert or update a trigger.
triggerExists
protected boolean triggerExists(Connection conn, TriggerKey key) throws JobPersistenceException
Check existence of a given trigger.
- Throws:
JobPersistenceException
removeJob
public boolean removeJob(JobKey jobKey) throws JobPersistenceException
Remove (delete) the
Job
with the given name, and anyTrigger
s that reference it.If removal of the
Job
results in an empty group, the group should be removed from theJobStore
's list of known group names.- Specified by:
removeJob
in interfaceorg.quartz.spi.JobStore
- Returns:
true
if aJob
with the given name & group was found and removed from the store.- Throws:
JobPersistenceException
removeJob
protected boolean removeJob(Connection conn, JobKey jobKey, boolean activeDeleteSafe) throws JobPersistenceException
- Throws:
JobPersistenceException
removeJobs
public boolean removeJobs(List<JobKey> jobKeys) throws JobPersistenceException
- Specified by:
removeJobs
in interfaceorg.quartz.spi.JobStore
- Throws:
JobPersistenceException
removeTriggers
public boolean removeTriggers(List<TriggerKey> triggerKeys) throws JobPersistenceException
- Specified by:
removeTriggers
in interfaceorg.quartz.spi.JobStore
- Throws:
JobPersistenceException
storeJobsAndTriggers
public void storeJobsAndTriggers(Map<JobDetail,List<Trigger>> triggersAndJobs, boolean replace) throws ObjectAlreadyExistsException, JobPersistenceException
- Specified by:
storeJobsAndTriggers
in interfaceorg.quartz.spi.JobStore
retrieveJob
public JobDetail retrieveJob(JobKey jobKey) throws JobPersistenceException
Retrieve the
JobDetail
for the givenJob
.- Specified by:
retrieveJob
in interfaceorg.quartz.spi.JobStore
- Returns:
- The desired
Job
, or null if there is no match. - Throws:
JobPersistenceException
retrieveJob
protected JobDetail retrieveJob(Connection conn, JobKey key) throws JobPersistenceException
- Throws:
JobPersistenceException
removeTrigger
public boolean removeTrigger(TriggerKey triggerKey) throws JobPersistenceException
Remove (delete) the
Trigger
with the given name.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 interfaceorg.quartz.spi.JobStore
- Returns:
true
if aTrigger
with the given name & group was found and removed from the store.- Throws:
JobPersistenceException
removeTrigger
protected boolean removeTrigger(Connection conn, TriggerKey key) throws JobPersistenceException
- Throws:
JobPersistenceException
replaceTrigger
public boolean replaceTrigger(TriggerKey triggerKey, org.quartz.spi.OperableTrigger newTrigger) throws JobPersistenceException
- Specified by:
replaceTrigger
in interfaceorg.quartz.spi.JobStore
- Throws:
JobPersistenceException
- See Also:
org.quartz.spi.JobStore#replaceTrigger(org.quartz.core.SchedulingContext, java.lang.String, java.lang.String, org.quartz.Trigger)
replaceTrigger
protected boolean replaceTrigger(Connection conn, TriggerKey key, org.quartz.spi.OperableTrigger newTrigger) throws JobPersistenceException
- Throws:
JobPersistenceException
retrieveTrigger
public org.quartz.spi.OperableTrigger retrieveTrigger(TriggerKey triggerKey) throws JobPersistenceException
Retrieve the given
Trigger
.- Specified by:
retrieveTrigger
in interfaceorg.quartz.spi.JobStore
- Returns:
- The desired
Trigger
, or null if there is no match. - Throws:
JobPersistenceException
retrieveTrigger
protected org.quartz.spi.OperableTrigger retrieveTrigger(Connection conn, TriggerKey key) throws JobPersistenceException
- Throws:
JobPersistenceException
getTriggerState
public Trigger.TriggerState getTriggerState(TriggerKey triggerKey) throws JobPersistenceException
Get the current state of the identified
Trigger
.- Specified by:
getTriggerState
in interfaceorg.quartz.spi.JobStore
- Throws:
JobPersistenceException
- See Also:
Trigger#NORMAL
,Trigger#PAUSED
,Trigger#COMPLETE
,Trigger#ERROR
,Trigger#NONE
getTriggerState
public Trigger.TriggerState getTriggerState(Connection conn, TriggerKey key) throws JobPersistenceException
- Throws:
JobPersistenceException
storeCalendar
public void storeCalendar(String calName, Calendar calendar, boolean replaceExisting, boolean updateTriggers) throws ObjectAlreadyExistsException, JobPersistenceException
Store the given
Calendar
.- Specified by:
storeCalendar
in interfaceorg.quartz.spi.JobStore
- Parameters:
calName
- The name of the calendar.calendar
- TheCalendar
to be stored.replaceExisting
- Iftrue
, anyCalendar
existing in theJobStore
with the same name & group should be over-written.- Throws:
ObjectAlreadyExistsException
- if aCalendar
with the same name already exists, and replaceExisting is set to false.JobPersistenceException
storeCalendar
protected void storeCalendar(Connection conn, String calName, Calendar calendar, boolean replaceExisting, boolean updateTriggers) throws ObjectAlreadyExistsException, JobPersistenceException
calendarExists
protected boolean calendarExists(Connection conn, String calName) throws JobPersistenceException
- Throws:
JobPersistenceException
removeCalendar
public boolean removeCalendar(String calName) throws JobPersistenceException
Remove (delete) the
Calendar
with the given name.If removal of the
*Calendar
would result inTrigger
s pointing to non-existent calendars, then aJobPersistenceException
will be thrown.- Specified by:
removeCalendar
in interfaceorg.quartz.spi.JobStore
- Parameters:
calName
- The name of theCalendar
to be removed.- Returns:
true
if aCalendar
with the given name was found and removed from the store.- Throws:
JobPersistenceException
removeCalendar
protected boolean removeCalendar(Connection conn, String calName) throws JobPersistenceException
- Throws:
JobPersistenceException
retrieveCalendar
public Calendar retrieveCalendar(String calName) throws JobPersistenceException
Retrieve the given
Trigger
.- Specified by:
retrieveCalendar
in interfaceorg.quartz.spi.JobStore
- Parameters:
calName
- The name of theCalendar
to be retrieved.- Returns:
- The desired
Calendar
, or null if there is no match. - Throws:
JobPersistenceException
retrieveCalendar
protected Calendar retrieveCalendar(Connection conn, String calName) throws JobPersistenceException
- Throws:
JobPersistenceException
getNumberOfJobs
public int getNumberOfJobs() throws JobPersistenceException
Get the number of
Job
s that are stored in theJobStore
.- Specified by:
getNumberOfJobs
in interfaceorg.quartz.spi.JobStore
- Throws:
JobPersistenceException
getNumberOfJobs
protected int getNumberOfJobs(Connection conn) throws JobPersistenceException
- Throws:
JobPersistenceException
getNumberOfTriggers
public int getNumberOfTriggers() throws JobPersistenceException
Get the number of
Trigger
s that are stored in theJobsStore
.- Specified by:
getNumberOfTriggers
in interfaceorg.quartz.spi.JobStore
- Throws:
JobPersistenceException
getNumberOfTriggers
protected int getNumberOfTriggers(Connection conn) throws JobPersistenceException
- Throws:
JobPersistenceException
getNumberOfCalendars
public int getNumberOfCalendars() throws JobPersistenceException
Get the number of
Calendar
s that are stored in theJobsStore
.- Specified by:
getNumberOfCalendars
in interfaceorg.quartz.spi.JobStore
- Throws:
JobPersistenceException
getNumberOfCalendars
protected int getNumberOfCalendars(Connection conn) throws JobPersistenceException
- Throws:
JobPersistenceException
getJobKeys
public Set<JobKey> getJobKeys(GroupMatcher<JobKey> matcher) throws JobPersistenceException
Get the names of all of the
Job
s that matcher the given groupMatcher.If there are no jobs in the given group name, the result should be an empty Set
- Specified by:
getJobKeys
in interfaceorg.quartz.spi.JobStore
- Throws:
JobPersistenceException
getJobNames
protected Set<JobKey> getJobNames(Connection conn, GroupMatcher<JobKey> matcher) throws JobPersistenceException
- Throws:
JobPersistenceException
checkExists
public boolean checkExists(JobKey jobKey) throws JobPersistenceException
- Determine whether a
Job
with the given identifier already exists within the scheduler. - Specified by:
checkExists
in interfaceorg.quartz.spi.JobStore
- Parameters:
jobKey
- the identifier to check for- Returns:
- true if a Job exists with the given identifier
- Throws:
SchedulerException
JobPersistenceException
checkExists
protected boolean checkExists(Connection conn, JobKey jobKey) throws JobPersistenceException
- Throws:
JobPersistenceException
checkExists
public boolean checkExists(TriggerKey triggerKey) throws JobPersistenceException
- Determine whether a
Trigger
with the given identifier already exists within the scheduler. - Specified by:
checkExists
in interfaceorg.quartz.spi.JobStore
- Parameters:
triggerKey
- the identifier to check for- Returns:
- true if a Trigger exists with the given identifier
- Throws:
SchedulerException
JobPersistenceException
checkExists
protected boolean checkExists(Connection conn, TriggerKey triggerKey) throws JobPersistenceException
- Throws:
JobPersistenceException
clearAllSchedulingData
public void clearAllSchedulingData() throws JobPersistenceException
- Clear (delete!) all scheduling data - all
Job
s,Trigger
sCalendar
s. - Specified by:
clearAllSchedulingData
in interfaceorg.quartz.spi.JobStore
- Throws:
JobPersistenceException
clearAllSchedulingData
protected void clearAllSchedulingData(Connection conn) throws JobPersistenceException
- Throws:
JobPersistenceException
getTriggerKeys
public Set<TriggerKey> getTriggerKeys(GroupMatcher<TriggerKey> matcher) throws JobPersistenceException
Get the names of all of the
Trigger
s that match the given group Matcher.If there are no triggers in the given group name, the result should be a an empty Set (not
null
).- Specified by:
getTriggerKeys
in interfaceorg.quartz.spi.JobStore
- Throws:
JobPersistenceException
getTriggerNames
protected Set<TriggerKey> getTriggerNames(Connection conn, GroupMatcher<TriggerKey> matcher) throws JobPersistenceException
- Throws:
JobPersistenceException
getJobGroupNames
public List<String> getJobGroupNames() throws JobPersistenceException
Get the names of all of the
Job
groups.If there are no known group names, the result should be a zero-length array (not
null
).- Specified by:
getJobGroupNames
in interfaceorg.quartz.spi.JobStore
- Throws:
JobPersistenceException
getJobGroupNames
protected List<String> getJobGroupNames(Connection conn) throws JobPersistenceException
- Throws:
JobPersistenceException
getTriggerGroupNames
public List<String> getTriggerGroupNames() throws JobPersistenceException
Get the names of all of the
Trigger
groups.If there are no known group names, the result should be a zero-length array (not
null
).- Specified by:
getTriggerGroupNames
in interfaceorg.quartz.spi.JobStore
- Throws:
JobPersistenceException
getTriggerGroupNames
protected List<String> getTriggerGroupNames(Connection conn) throws JobPersistenceException
- Throws:
JobPersistenceException
getCalendarNames
public List<String> getCalendarNames() throws JobPersistenceException
Get the names of all of the
Calendar
s in theJobStore
.If there are no Calendars in the given group name, the result should be a zero-length array (not
null
).- Specified by:
getCalendarNames
in interfaceorg.quartz.spi.JobStore
- Throws:
JobPersistenceException
getCalendarNames
protected List<String> getCalendarNames(Connection conn) throws JobPersistenceException
- Throws:
JobPersistenceException
getTriggersForJob
public List<org.quartz.spi.OperableTrigger> getTriggersForJob(JobKey jobKey) throws JobPersistenceException
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 interfaceorg.quartz.spi.JobStore
- Throws:
JobPersistenceException
getTriggersForJob
protected List<org.quartz.spi.OperableTrigger> getTriggersForJob(Connection conn, JobKey key) throws JobPersistenceException
- Throws:
JobPersistenceException
pauseTrigger
public void pauseTrigger(TriggerKey triggerKey) throws JobPersistenceException
Pause the
Trigger
with the given name.- Specified by:
pauseTrigger
in interfaceorg.quartz.spi.JobStore
- Throws:
JobPersistenceException
- See Also:
#resumeTrigger(SchedulingContext, String, String)
pauseTrigger
public void pauseTrigger(Connection conn, TriggerKey triggerKey) throws JobPersistenceException
Pause the
Trigger
with the given name.- Throws:
JobPersistenceException
- See Also:
#resumeTrigger(Connection, SchedulingContext, String, String)
pauseJob
public void pauseJob(JobKey jobKey) throws JobPersistenceException
Pause the
Job
with the given name - by pausing all of its currentTrigger
s.- Specified by:
pauseJob
in interfaceorg.quartz.spi.JobStore
- Throws:
JobPersistenceException
- See Also:
#resumeJob(SchedulingContext, String, String)
pauseJobs
public Set<String> pauseJobs(GroupMatcher<JobKey> matcher) throws JobPersistenceException
Pause all of the
Job
s matching the given groupMatcher - by pausing all of theirTrigger
s.- Specified by:
pauseJobs
in interfaceorg.quartz.spi.JobStore
- Throws:
JobPersistenceException
- See Also:
#resumeJobGroup(SchedulingContext, String)
checkBlockedState
protected String checkBlockedState(Connection conn, JobKey jobKey, String currentState) throws JobPersistenceException
- Determines if a Trigger for the given job should be blocked.
State can only transition to STATE_PAUSED_BLOCKED/BLOCKED from
PAUSED/STATE_WAITING respectively.
- Returns:
- STATE_PAUSED_BLOCKED, BLOCKED, or the currentState.
- Throws:
JobPersistenceException
resumeTrigger
public void resumeTrigger(TriggerKey triggerKey) throws JobPersistenceException
Resume (un-pause) the
Trigger
with the given name.If the
Trigger
missed one or more fire-times, then theTrigger
's misfire instruction will be applied.- Specified by:
resumeTrigger
in interfaceorg.quartz.spi.JobStore
- Throws:
JobPersistenceException
- See Also:
#pauseTrigger(SchedulingContext, String, String)
resumeTrigger
public void resumeTrigger(Connection conn, TriggerKey key) throws JobPersistenceException
Resume (un-pause) the
Trigger
with the given name.If the
Trigger
missed one or more fire-times, then theTrigger
's misfire instruction will be applied.- Throws:
JobPersistenceException
- See Also:
#pauseTrigger(Connection, SchedulingContext, String, String)
resumeJob
public void resumeJob(JobKey jobKey) throws JobPersistenceException
Resume (un-pause) the
Job
with the given name.If any of the
Job
'sTrigger
s missed one or more fire-times, then theTrigger
's misfire instruction will be applied.- Specified by:
resumeJob
in interfaceorg.quartz.spi.JobStore
- Throws:
JobPersistenceException
- See Also:
#pauseJob(SchedulingContext, String, String)
resumeJobs
public Set<String> resumeJobs(GroupMatcher<JobKey> matcher) throws JobPersistenceException
Resume (un-pause) all of the
Job
s in the given group.If any of the
Job
s hadTrigger
s that missed one or more fire-times, then theTrigger
's misfire instruction will be applied.- Specified by:
resumeJobs
in interfaceorg.quartz.spi.JobStore
- Throws:
JobPersistenceException
- See Also:
#pauseJobGroup(SchedulingContext, String)
pauseTriggers
public Set<String> pauseTriggers(GroupMatcher<TriggerKey> matcher) throws JobPersistenceException
Pause all of the
Trigger
s matching the given groupMatcher.- Specified by:
pauseTriggers
in interfaceorg.quartz.spi.JobStore
- Throws:
JobPersistenceException
- See Also:
#resumeTriggerGroup(SchedulingContext, String)
pauseTriggerGroup
public Set<String> pauseTriggerGroup(Connection conn, GroupMatcher<TriggerKey> matcher) throws JobPersistenceException
Pause all of the
Trigger
s matching the given groupMatcher.- Throws:
JobPersistenceException
- See Also:
#resumeTriggerGroup(Connection, SchedulingContext, String)
getPausedTriggerGroups
public Set<String> getPausedTriggerGroups() throws JobPersistenceException
- Specified by:
getPausedTriggerGroups
in interfaceorg.quartz.spi.JobStore
- Throws:
JobPersistenceException
getPausedTriggerGroups
public Set<String> getPausedTriggerGroups(Connection conn) throws JobPersistenceException
Pause all of the
Trigger
s in the given group.
resumeTriggers
public Set<String> resumeTriggers(GroupMatcher<TriggerKey> matcher) throws JobPersistenceException
Resume (un-pause) all of the
Trigger
s matching the given groupMatcher.If any
Trigger
missed one or more fire-times, then theTrigger
's misfire instruction will be applied.- Specified by:
resumeTriggers
in interfaceorg.quartz.spi.JobStore
resumeTriggerGroup
public Set<String> resumeTriggerGroup(Connection conn, GroupMatcher<TriggerKey> matcher) throws JobPersistenceException
Resume (un-pause) all of the
Trigger
s matching the given groupMatcher.If any
Trigger
missed one or more fire-times, then theTrigger
's misfire instruction will be applied.
pauseAll
public void pauseAll() throws JobPersistenceException
Pause all triggers - equivalent of calling
pauseTriggerGroup(group)
on every group.When
resumeAll()
is called (to un-pause), trigger misfire instructions WILL be applied.- Specified by:
pauseAll
in interfaceorg.quartz.spi.JobStore
- Throws:
JobPersistenceException
- See Also:
#resumeAll(SchedulingContext)
,#pauseTriggerGroup(SchedulingContext, String)
pauseAll
public void pauseAll(Connection conn) throws JobPersistenceException
Pause all triggers - equivalent of calling
pauseTriggerGroup(group)
on every group.When
resumeAll()
is called (to un-pause), trigger misfire instructions WILL be applied.- Throws:
JobPersistenceException
- See Also:
#resumeAll(SchedulingContext)
,#pauseTriggerGroup(SchedulingContext, String)
resumeAll
public void resumeAll() throws JobPersistenceException
Resume (un-pause) all triggers - equivalent of calling
resumeTriggerGroup(group)
on every group.If any
Trigger
missed one or more fire-times, then theTrigger
's misfire instruction will be applied.- Specified by:
resumeAll
in interfaceorg.quartz.spi.JobStore
- Throws:
JobPersistenceException
- See Also:
#pauseAll(SchedulingContext)
resumeAll
public void resumeAll(Connection conn) throws JobPersistenceException
- protected
Resume (un-pause) all triggers - equivalent of calling
resumeTriggerGroup(group)
on every group.If any
Trigger
missed one or more fire-times, then theTrigger
's misfire instruction will be applied. - Throws:
JobPersistenceException
- See Also:
#pauseAll(SchedulingContext)
getFiredTriggerRecordId
protected String getFiredTriggerRecordId()
acquireNextTriggers
public List<org.quartz.spi.OperableTrigger> acquireNextTriggers(long noLaterThan, int maxCount, long timeWindow) throws JobPersistenceException
Get a handle to the next N triggers to be fired, and mark them as 'reserved' by the calling scheduler.
- Specified by:
acquireNextTriggers
in interfaceorg.quartz.spi.JobStore
- Throws:
JobPersistenceException
- See Also:
#releaseAcquiredTrigger(SchedulingContext, Trigger)
acquireNextTrigger
protected List<org.quartz.spi.OperableTrigger> acquireNextTrigger(Connection conn, long noLaterThan, int maxCount, long timeWindow) throws JobPersistenceException
- Throws:
JobPersistenceException
releaseAcquiredTrigger
public void releaseAcquiredTrigger(org.quartz.spi.OperableTrigger trigger) throws JobPersistenceException
Inform the
JobStore
that the scheduler no longer plans to fire the givenTrigger
, that it had previously acquired (reserved).- Specified by:
releaseAcquiredTrigger
in interfaceorg.quartz.spi.JobStore
- Throws:
JobPersistenceException
releaseAcquiredTrigger
protected void releaseAcquiredTrigger(Connection conn, org.quartz.spi.OperableTrigger trigger) throws JobPersistenceException
- Throws:
JobPersistenceException
triggersFired
public List<org.quartz.spi.TriggerFiredResult> triggersFired(List<org.quartz.spi.OperableTrigger> triggers) throws JobPersistenceException
Inform the
JobStore
that the scheduler is now firing the givenTrigger
(executing its associatedJob
), that it had previously acquired (reserved).- Specified by:
triggersFired
in interfaceorg.quartz.spi.JobStore
- Returns:
- null if the trigger or its job or calendar no longer exist, or if the trigger was not successfully put into the 'executing' state.
- Throws:
JobPersistenceException
triggerFired
protected org.quartz.spi.TriggerFiredBundle triggerFired(Connection conn, org.quartz.spi.OperableTrigger trigger) throws JobPersistenceException
- Throws:
JobPersistenceException
triggeredJobComplete
public void triggeredJobComplete(org.quartz.spi.OperableTrigger trigger, JobDetail jobDetail, Trigger.CompletedExecutionInstruction triggerInstCode) throws JobPersistenceException
Inform the
JobStore
that the scheduler has completed the firing of the givenTrigger
(and the execution its associatedJob
), and that theJobDataMap
in the givenJobDetail
should be updated if theJob
is stateful.- Specified by:
triggeredJobComplete
in interfaceorg.quartz.spi.JobStore
- Throws:
JobPersistenceException
triggeredJobComplete
protected void triggeredJobComplete(Connection conn, org.quartz.spi.OperableTrigger trigger, JobDetail jobDetail, Trigger.CompletedExecutionInstruction triggerInstCode) throws JobPersistenceException
- Throws:
JobPersistenceException
getDelegate
protected DriverDelegate getDelegate() throws NoSuchDelegateException
Get the driver delegate for DB operations.
- Throws:
NoSuchDelegateException
getLockHandler
protected Semaphore getLockHandler()
setLockHandler
public void setLockHandler(Semaphore lockHandler)
doRecoverMisfires
protected JobStoreSupport.RecoverMisfiredJobsResult doRecoverMisfires() throws JobPersistenceException
- Throws:
JobPersistenceException
signalSchedulingChangeOnTxCompletion
protected void signalSchedulingChangeOnTxCompletion(long candidateNewNextFireTime)
clearAndGetSignalSchedulingChangeOnTxCompletion
protected Long clearAndGetSignalSchedulingChangeOnTxCompletion()
signalSchedulingChangeImmediately
protected void signalSchedulingChangeImmediately(long candidateNewNextFireTime)
doCheckin
protected boolean doCheckin() throws JobPersistenceException
- Throws:
JobPersistenceException
findFailedInstances
protected List<SchedulerStateRecord> findFailedInstances(Connection conn) throws JobPersistenceException
- Get a list of all scheduler instances in the cluster that may have failed.
This includes this scheduler if it is checking in for the first time.
- Throws:
JobPersistenceException
calcFailedIfAfter
protected long calcFailedIfAfter(SchedulerStateRecord rec)
clusterCheckIn
protected List<SchedulerStateRecord> clusterCheckIn(Connection conn) throws JobPersistenceException
- Throws:
JobPersistenceException
clusterRecover
protected void clusterRecover(Connection conn, List<SchedulerStateRecord> failedInstances) throws JobPersistenceException
- Throws:
JobPersistenceException
logWarnIfNonZero
protected void logWarnIfNonZero(int val, String warning)
cleanupConnection
protected void cleanupConnection(Connection conn)
Cleanup the given database connection. This means restoring any modified auto commit or transaction isolation connection attributes, and then closing the underlying connection.
This is separate from closeConnection() because the Spring integration relies on being able to overload closeConnection() and expects the same connection back that it originally returned from the datasource.
- See Also:
closeConnection(Connection)
closeConnection
protected void closeConnection(Connection conn)
- Closes the supplied
Connection
.Ignores a
null Connection
. Any exception thrown trying to close theConnection
is logged and ignored. - Parameters:
conn
- TheConnection
to close (Optional).
rollbackConnection
protected void rollbackConnection(Connection conn)
- Rollback the supplied connection.
Logs any SQLException it gets trying to rollback, but will not propogate the exception lest it mask the exception that caused the caller to need to rollback in the first place.
- Parameters:
conn
- (Optional)
commitConnection
protected void commitConnection(Connection conn) throws JobPersistenceException
- Commit the supplied connection
- Parameters:
conn
- (Optional)- Throws:
JobPersistenceException
- thrown if a SQLException occurs when the connection is committed
executeWithoutLock
public Object executeWithoutLock(JobStoreSupport.TransactionCallback txCallback) throws JobPersistenceException
- Execute the given callback in a transaction. Depending on the JobStore,
the surrounding transaction may be assumed to be already present
(managed).
This method just forwards to executeInLock() with a null lockName.
- Throws:
JobPersistenceException
- See Also:
executeInLock(String, TransactionCallback)
executeInLock
protected void executeInLock(String lockName, JobStoreSupport.VoidTransactionCallback txCallback) throws JobPersistenceException
- Execute the given callback having aquired the given lock.
Depending on the JobStore, the surrounding transaction may be
assumed to be already present (managed). This version is just a
handy wrapper around executeInLock that doesn't require a return
value.
- Parameters:
lockName
- The name of the lock to aquire, for example "TRIGGER_ACCESS". If null, then no lock is aquired, but the lockCallback is still executed in a transaction.- Throws:
JobPersistenceException
- See Also:
executeInLock(String, TransactionCallback)
executeInLock
protected abstract Object executeInLock(String lockName, JobStoreSupport.TransactionCallback txCallback) throws JobPersistenceException
- Execute the given callback having aquired the given lock.
Depending on the JobStore, the surrounding transaction may be
assumed to be already present (managed).
- Parameters:
lockName
- The name of the lock to aquire, for example "TRIGGER_ACCESS". If null, then no lock is aquired, but the lockCallback is still executed in a transaction.- Throws:
JobPersistenceException
executeInNonManagedTXLock
protected void executeInNonManagedTXLock(String lockName, JobStoreSupport.VoidTransactionCallback txCallback) throws JobPersistenceException
- Execute the given callback having optionally aquired the given lock.
This uses the non-managed transaction connection. This version is just a
handy wrapper around executeInNonManagedTXLock that doesn't require a return
value.
- Parameters:
lockName
- The name of the lock to aquire, for example "TRIGGER_ACCESS". If null, then no lock is aquired, but the lockCallback is still executed in a non-managed transaction.- Throws:
JobPersistenceException
- See Also:
executeInNonManagedTXLock(String, TransactionCallback)
executeInNonManagedTXLock
protected Object executeInNonManagedTXLock(String lockName, JobStoreSupport.TransactionCallback txCallback) throws JobPersistenceException
- Execute the given callback having optionally aquired the given lock.
This uses the non-managed transaction connection.
- Parameters:
lockName
- The name of the lock to aquire, for example "TRIGGER_ACCESS". If null, then no lock is aquired, but the lockCallback is still executed in a non-managed transaction.- Throws:
JobPersistenceException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 2001-2011, Terracotta, Inc.