org.quartz.impl.jdbcjobstore
Class JobStoreSupport

java.lang.Object
  extended byorg.quartz.impl.jdbcjobstore.JobStoreSupport
All Implemented Interfaces:
Constants, JobStore
Direct Known Subclasses:
JobStoreCMT, JobStoreTX

public abstract class JobStoreSupport
extends java.lang.Object
implements JobStore, Constants

Contains base functionality for JDBC-based JobStore implementations.

Author:
Jeffrey Wescott, James House

Field Summary
protected  java.util.HashMap calendarCache
           
protected  java.lang.Class delegateClass
           
protected  java.lang.String dsName
           
protected  boolean firstCheckIn
           
protected  java.lang.String instanceId
           
protected  java.lang.String instanceName
           
protected  long lastCheckin
           
protected static java.lang.String LOCK_CALENDAR_ACCESS
           
protected static java.lang.String LOCK_JOB_ACCESS
           
protected static java.lang.String LOCK_MISFIRE_ACCESS
           
protected static java.lang.String LOCK_STATE_ACCESS
           
protected static java.lang.String LOCK_TRIGGER_ACCESS
           
protected  int maxToRecoverAtATime
           
protected  java.lang.String tablePrefix
           
protected  boolean useProperties
           
 
Fields inherited from interface org.quartz.impl.jdbcjobstore.Constants
ALIAS_COL_NEXT_FIRE_TIME, ALL_GROUPS_PAUSED, COL_BLOB, COL_CALENDAR, COL_CALENDAR_NAME, COL_CHECKIN_INTERVAL, COL_CRON_EXPRESSION, COL_DESCRIPTION, COL_END_TIME, COL_ENTRY_ID, COL_ENTRY_STATE, COL_FIRED_TIME, COL_INSTANCE_NAME, COL_IS_DURABLE, COL_IS_STATEFUL, COL_IS_VOLATILE, COL_JOB_CLASS, COL_JOB_DATAMAP, COL_JOB_GROUP, COL_JOB_LISTENER, COL_JOB_NAME, COL_LAST_CHECKIN_TIME, COL_LOCK_NAME, COL_MISFIRE_INSTRUCTION, COL_NEXT_FIRE_TIME, COL_PREV_FIRE_TIME, COL_RECOVERER, COL_REPEAT_COUNT, COL_REPEAT_INTERVAL, COL_REQUESTS_RECOVERY, COL_START_TIME, COL_TIME_ZONE_ID, COL_TIMES_TRIGGERED, COL_TRIGGER_GROUP, COL_TRIGGER_LISTENER, COL_TRIGGER_NAME, COL_TRIGGER_STATE, COL_TRIGGER_TYPE, DEFAULT_TABLE_PREFIX, STATE_ACQUIRED, STATE_BLOCKED, STATE_COMPLETE, STATE_DELETED, STATE_ERROR, STATE_EXECUTING, STATE_MISFIRED, STATE_PAUSED, STATE_WAITING, TABLE_BLOB_TRIGGERS, TABLE_CALENDARS, TABLE_CRON_TRIGGERS, TABLE_FIRED_TRIGGERS, TABLE_JOB_DETAILS, TABLE_JOB_LISTENERS, TABLE_LOCKS, TABLE_PAUSED_TRIGGERS, TABLE_SCHEDULER_STATE, TABLE_SIMPLE_TRIGGERS, TABLE_TRIGGER_LISTENERS, TABLE_TRIGGERS, TTYPE_BLOB, TTYPE_CRON, TTYPE_SIMPLE
 
Constructor Summary
JobStoreSupport()
           
 
Method Summary
protected  Trigger acquireNextTrigger(java.sql.Connection conn, SchedulingContext ctxt)
           
protected  boolean calendarExists(java.sql.Connection conn, java.lang.String calName)
           
 boolean canUseProperties()
           Get whether String-only properties will be handled in JobDataMaps.
protected abstract  void cleanVolatileTriggerAndJobs()
           Removes all volatile data
protected  void cleanVolatileTriggerAndJobs(java.sql.Connection conn)
           Removes all volatile data.
protected  void closeConnection(java.sql.Connection conn)
          Closes the supplied connection
protected  java.util.List clusterCheckIn(java.sql.Connection conn)
           
protected  void clusterRecover(java.sql.Connection conn, java.util.List failedInstances)
           
protected  void commitConnection(java.sql.Connection conn)
          Commit the supplied connection
protected abstract  boolean doCheckin()
           
protected abstract  boolean doRecoverMisfires()
           
protected  java.lang.String[] getCalendarNames(java.sql.Connection conn, SchedulingContext ctxt)
           
protected  ClassLoadHelper getClassLoadHelper()
           
 long getClusterCheckinInterval()
           Get the frequency (in milliseconds) at which this instance "checks-in" with the other instances of the cluster.
protected  java.sql.Connection getConnection()
           
 java.lang.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.
 java.lang.String getDriverDelegateClass()
           Get the JDBC driver delegate class name.
protected  java.lang.String getFiredTriggerRecordId()
           
 java.lang.String getInstanceId()
           Get the instance Id of the Scheduler (must be unique within a cluster).
 java.lang.String getInstanceName()
           Get the instance Id of the Scheduler (must be unique within a cluster).
protected  java.lang.String[] getJobGroupNames(java.sql.Connection conn, SchedulingContext ctxt)
           
protected  java.lang.String[] getJobNames(java.sql.Connection conn, SchedulingContext ctxt, java.lang.String groupName)
           
protected  Semaphore getLockHandler()
           
 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  java.lang.String getNewStatusForTrigger(java.sql.Connection conn, SchedulingContext ctxt, java.lang.String jobName, java.lang.String groupName)
           
protected  int getNumberOfCalendars(java.sql.Connection conn, SchedulingContext ctxt)
           
protected  int getNumberOfJobs(java.sql.Connection conn, SchedulingContext ctxt)
           
protected  int getNumberOfTriggers(java.sql.Connection conn, SchedulingContext ctxt)
           
 java.util.Set getPausedTriggerGroups(java.sql.Connection conn, SchedulingContext ctxt)
           Pause all of the Triggers in the given group.
 java.lang.String getSelectWithLockSQL()
           
protected  java.lang.String getStatusForResumedTrigger(java.sql.Connection conn, SchedulingContext ctxt, TriggerStatus status)
           
 java.lang.String getTablePrefix()
           Get the prefix that should be pre-pended to all table names.
protected  java.lang.String[] getTriggerGroupNames(java.sql.Connection conn, SchedulingContext ctxt)
           
protected  java.lang.String[] getTriggerNames(java.sql.Connection conn, SchedulingContext ctxt, java.lang.String groupName)
           
protected  Trigger[] getTriggersForJob(java.sql.Connection conn, SchedulingContext ctxt, java.lang.String jobName, java.lang.String groupName)
           
 int getTriggerState(java.sql.Connection conn, SchedulingContext ctxt, java.lang.String triggerName, java.lang.String groupName)
           
 boolean getUseDBLocks()
           Get whether this instance should use database-based thread synchronization.
 void initialize(ClassLoadHelper loadHelper, SchedulerSignaler signaler)
           Called by the QuartzScheduler before the JobStore is used, in order to give the it a chance to initialize.
 boolean isClustered()
           Get whether this instance is part of a cluster.
 boolean isDontSetAutoCommitFalse()
           
 boolean isLockOnInsert()
           
 boolean isTxIsolationLevelSerializable()
           
protected  boolean jobExists(java.sql.Connection conn, java.lang.String jobName, java.lang.String groupName)
           Check existence of a given job.
protected  void logWarnIfNonZero(int val, java.lang.String warning)
           
 void pauseAll(java.sql.Connection conn, SchedulingContext ctxt)
           Pause all triggers - equivalent of calling pauseTriggerGroup(group) on every group.
 void pauseTrigger(java.sql.Connection conn, SchedulingContext ctxt, java.lang.String triggerName, java.lang.String groupName)
           Pause the Trigger with the given name.
 void pauseTriggerGroup(java.sql.Connection conn, SchedulingContext ctxt, java.lang.String groupName)
           Pause all of the Triggers in the given group.
protected abstract  void recoverJobs()
           Will recover any failed or misfired jobs and clean up the data store as appropriate.
protected  void recoverJobs(java.sql.Connection conn)
           Will recover any failed or misfired jobs and clean up the data store as appropriate.
protected  boolean recoverMisfiredJobs(java.sql.Connection conn, boolean recovering)
           
protected  void releaseAcquiredTrigger(java.sql.Connection conn, SchedulingContext ctxt, Trigger trigger)
           
protected  void releaseLock(java.sql.Connection conn, java.lang.String lockName, boolean doIt)
           
protected  boolean removeCalendar(java.sql.Connection conn, SchedulingContext ctxt, java.lang.String calName)
           
protected  boolean removeJob(java.sql.Connection conn, SchedulingContext ctxt, java.lang.String jobName, java.lang.String groupName, boolean activeDeleteSafe)
           
protected  boolean removeTrigger(java.sql.Connection conn, SchedulingContext ctxt, java.lang.String triggerName, java.lang.String groupName)
           
protected  boolean replaceTrigger(java.sql.Connection conn, SchedulingContext ctxt, java.lang.String triggerName, java.lang.String groupName, Trigger newTrigger)
           
 void resumeAll(java.sql.Connection conn, SchedulingContext ctxt)
          protected
 void resumeTrigger(java.sql.Connection conn, SchedulingContext ctxt, java.lang.String triggerName, java.lang.String groupName)
           Resume (un-pause) the Trigger with the given name.
 void resumeTriggerGroup(java.sql.Connection conn, SchedulingContext ctxt, java.lang.String groupName)
           Resume (un-pause) all of the Triggers in the given group.
protected  Calendar retrieveCalendar(java.sql.Connection conn, SchedulingContext ctxt, java.lang.String calName)
           
protected  JobDetail retrieveJob(java.sql.Connection conn, SchedulingContext ctxt, java.lang.String jobName, java.lang.String groupName)
           
protected  Trigger retrieveTrigger(java.sql.Connection conn, SchedulingContext ctxt, java.lang.String triggerName, java.lang.String groupName)
           
protected  void rollbackConnection(java.sql.Connection conn)
          Rollback the supplied connection
 void setClusterCheckinInterval(long l)
           Set the frequency (in milliseconds) at which this instance "checks-in" with the other instances of the cluster.
 void setDataSource(java.lang.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 setDriverDelegateClass(java.lang.String delegateClassName)
           Set the JDBC driver delegate class.
 void setInstanceId(java.lang.String instanceId)
           Set the instance Id of the Scheduler (must be unique within a cluster).
 void setInstanceName(java.lang.String instanceName)
           Set the instance Id of the Scheduler (must be unique within a cluster).
 void setIsClustered(boolean isClustered)
           Set whether this instance is part of a cluster.
 void setLockOnInsert(boolean lockOnInsert)
          Whether or not to obtain locks when inserting new jobs/triggers.
 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(java.lang.String string)
           set the SQL statement to use to select and lock a row in the "locks" table.
 void setTablePrefix(java.lang.String prefix)
           Set the prefix that should be pre-pended to all table names.
 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(java.lang.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 signalSchedulingChange()
           
protected  void storeCalendar(java.sql.Connection conn, SchedulingContext ctxt, java.lang.String calName, Calendar calendar, boolean replaceExisting, boolean updateTriggers)
           
protected  void storeJob(java.sql.Connection conn, SchedulingContext ctxt, JobDetail newJob, boolean replaceExisting)
           Insert or update a job.
protected  void storeTrigger(java.sql.Connection conn, SchedulingContext ctxt, Trigger newTrigger, JobDetail job, boolean replaceExisting, java.lang.String state, boolean forceState, boolean recovering)
           Insert or update a trigger.
 boolean supportsPersistence()
           
protected  void triggeredJobComplete(java.sql.Connection conn, SchedulingContext ctxt, Trigger trigger, JobDetail jobDetail, int triggerInstCode)
           
protected  boolean triggerExists(java.sql.Connection conn, java.lang.String triggerName, java.lang.String groupName)
           Check existence of a given trigger.
protected  TriggerFiredBundle triggerFired(java.sql.Connection conn, SchedulingContext ctxt, Trigger trigger)
           
protected  boolean updateMisfiredTrigger(java.sql.Connection conn, SchedulingContext ctxt, java.lang.String triggerName, java.lang.String groupName, java.lang.String newStateIfNotComplete, boolean forceState)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.quartz.spi.JobStore
acquireNextTrigger, getCalendarNames, getJobGroupNames, getJobNames, getNumberOfCalendars, getNumberOfJobs, getNumberOfTriggers, getPausedTriggerGroups, getTriggerGroupNames, getTriggerNames, getTriggersForJob, getTriggerState, pauseAll, pauseJob, pauseJobGroup, pauseTrigger, pauseTriggerGroup, releaseAcquiredTrigger, removeCalendar, removeJob, removeTrigger, replaceTrigger, resumeAll, resumeJob, resumeJobGroup, resumeTrigger, resumeTriggerGroup, retrieveCalendar, retrieveJob, retrieveTrigger, storeCalendar, storeJob, storeJobAndTrigger, storeTrigger, triggeredJobComplete, triggerFired
 

Field Detail

LOCK_TRIGGER_ACCESS

protected static java.lang.String LOCK_TRIGGER_ACCESS

LOCK_JOB_ACCESS

protected static java.lang.String LOCK_JOB_ACCESS

LOCK_CALENDAR_ACCESS

protected static java.lang.String LOCK_CALENDAR_ACCESS

LOCK_STATE_ACCESS

protected static java.lang.String LOCK_STATE_ACCESS

LOCK_MISFIRE_ACCESS

protected static java.lang.String LOCK_MISFIRE_ACCESS

dsName

protected java.lang.String dsName

tablePrefix

protected java.lang.String tablePrefix

useProperties

protected boolean useProperties

instanceId

protected java.lang.String instanceId

instanceName

protected java.lang.String instanceName

delegateClass

protected java.lang.Class delegateClass

calendarCache

protected java.util.HashMap calendarCache

maxToRecoverAtATime

protected int maxToRecoverAtATime

firstCheckIn

protected boolean firstCheckIn

lastCheckin

protected long lastCheckin
Constructor Detail

JobStoreSupport

public JobStoreSupport()
Method Detail

setDataSource

public void setDataSource(java.lang.String dsName)

Set the name of the DataSource that should be used for performing database functions.


getDataSource

public java.lang.String getDataSource()

Get the name of the DataSource that should be used for performing database functions.


setTablePrefix

public void setTablePrefix(java.lang.String prefix)

Set the prefix that should be pre-pended to all table names.


getTablePrefix

public java.lang.String getTablePrefix()

Get the prefix that should be pre-pended to all table names.


setUseProperties

public void setUseProperties(java.lang.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(java.lang.String instanceId)

Set the instance Id of the Scheduler (must be unique within a cluster).


getInstanceId

public java.lang.String getInstanceId()

Get the instance Id of the Scheduler (must be unique within a cluster).


setInstanceName

public void setInstanceName(java.lang.String instanceName)

Set the instance Id of the Scheduler (must be unique within a cluster).


getInstanceName

public java.lang.String getInstanceName()

Get the instance Id of the Scheduler (must be unique within a cluster).


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.


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 -

setDriverDelegateClass

public void setDriverDelegateClass(java.lang.String delegateClassName)
                            throws InvalidConfigurationException

Set the JDBC driver delegate class.

Parameters:
delegateClassName - the delegate class name
Throws:
InvalidConfigurationException

getDriverDelegateClass

public java.lang.String getDriverDelegateClass()

Get the JDBC driver delegate class name.

Returns:
the delegate class name

getSelectWithLockSQL

public java.lang.String getSelectWithLockSQL()

setSelectWithLockSQL

public void setSelectWithLockSQL(java.lang.String string)

set the SQL statement to use to select and lock a row in the "locks" table.

See Also:
StdRowLockSemaphore

getClassLoadHelper

protected ClassLoadHelper getClassLoadHelper()

initialize

public void initialize(ClassLoadHelper loadHelper,
                       SchedulerSignaler signaler)
                throws SchedulerConfigException

Called by the QuartzScheduler before the JobStore is used, in order to give the it a chance to initialize.

Specified by:
initialize in interface JobStore
Throws:
SchedulerConfigException

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 interface JobStore

supportsPersistence

public boolean supportsPersistence()
Specified by:
supportsPersistence in interface JobStore

getConnection

protected java.sql.Connection getConnection()
                                     throws JobPersistenceException
Throws:
JobPersistenceException

releaseLock

protected void releaseLock(java.sql.Connection conn,
                           java.lang.String lockName,
                           boolean doIt)

cleanVolatileTriggerAndJobs

protected abstract void cleanVolatileTriggerAndJobs()
                                             throws JobPersistenceException

Removes all volatile data

Throws:
JobPersistenceException - if jobs could not be recovered

cleanVolatileTriggerAndJobs

protected void cleanVolatileTriggerAndJobs(java.sql.Connection conn)
                                    throws JobPersistenceException

Removes all volatile data.

Throws:
JobPersistenceException - if jobs could not be recovered

recoverJobs

protected abstract void recoverJobs()
                             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

recoverJobs

protected void recoverJobs(java.sql.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 boolean recoverMisfiredJobs(java.sql.Connection conn,
                                      boolean recovering)
                               throws JobPersistenceException,
                                      NoSuchDelegateException,
                                      java.sql.SQLException,
                                      java.lang.ClassNotFoundException,
                                      java.io.IOException
Throws:
JobPersistenceException
NoSuchDelegateException
java.sql.SQLException
java.lang.ClassNotFoundException
java.io.IOException

updateMisfiredTrigger

protected boolean updateMisfiredTrigger(java.sql.Connection conn,
                                        SchedulingContext ctxt,
                                        java.lang.String triggerName,
                                        java.lang.String groupName,
                                        java.lang.String newStateIfNotComplete,
                                        boolean forceState)
                                 throws JobPersistenceException
Throws:
JobPersistenceException

storeJob

protected void storeJob(java.sql.Connection conn,
                        SchedulingContext ctxt,
                        JobDetail newJob,
                        boolean replaceExisting)
                 throws ObjectAlreadyExistsException,
                        JobPersistenceException

Insert or update a job.

Throws:
ObjectAlreadyExistsException
JobPersistenceException

jobExists

protected boolean jobExists(java.sql.Connection conn,
                            java.lang.String jobName,
                            java.lang.String groupName)
                     throws JobPersistenceException

Check existence of a given job.

Throws:
JobPersistenceException

storeTrigger

protected void storeTrigger(java.sql.Connection conn,
                            SchedulingContext ctxt,
                            Trigger newTrigger,
                            JobDetail job,
                            boolean replaceExisting,
                            java.lang.String state,
                            boolean forceState,
                            boolean recovering)
                     throws ObjectAlreadyExistsException,
                            JobPersistenceException

Insert or update a trigger.

Throws:
ObjectAlreadyExistsException
JobPersistenceException

triggerExists

protected boolean triggerExists(java.sql.Connection conn,
                                java.lang.String triggerName,
                                java.lang.String groupName)
                         throws JobPersistenceException

Check existence of a given trigger.

Throws:
JobPersistenceException

removeJob

protected boolean removeJob(java.sql.Connection conn,
                            SchedulingContext ctxt,
                            java.lang.String jobName,
                            java.lang.String groupName,
                            boolean activeDeleteSafe)
                     throws JobPersistenceException
Throws:
JobPersistenceException

retrieveJob

protected JobDetail retrieveJob(java.sql.Connection conn,
                                SchedulingContext ctxt,
                                java.lang.String jobName,
                                java.lang.String groupName)
                         throws JobPersistenceException
Throws:
JobPersistenceException

removeTrigger

protected boolean removeTrigger(java.sql.Connection conn,
                                SchedulingContext ctxt,
                                java.lang.String triggerName,
                                java.lang.String groupName)
                         throws JobPersistenceException
Throws:
JobPersistenceException

replaceTrigger

protected boolean replaceTrigger(java.sql.Connection conn,
                                 SchedulingContext ctxt,
                                 java.lang.String triggerName,
                                 java.lang.String groupName,
                                 Trigger newTrigger)
                          throws JobPersistenceException
Throws:
JobPersistenceException

retrieveTrigger

protected Trigger retrieveTrigger(java.sql.Connection conn,
                                  SchedulingContext ctxt,
                                  java.lang.String triggerName,
                                  java.lang.String groupName)
                           throws JobPersistenceException
Throws:
JobPersistenceException

getTriggerState

public int getTriggerState(java.sql.Connection conn,
                           SchedulingContext ctxt,
                           java.lang.String triggerName,
                           java.lang.String groupName)
                    throws JobPersistenceException
Throws:
JobPersistenceException

storeCalendar

protected void storeCalendar(java.sql.Connection conn,
                             SchedulingContext ctxt,
                             java.lang.String calName,
                             Calendar calendar,
                             boolean replaceExisting,
                             boolean updateTriggers)
                      throws ObjectAlreadyExistsException,
                             JobPersistenceException
Throws:
ObjectAlreadyExistsException
JobPersistenceException

calendarExists

protected boolean calendarExists(java.sql.Connection conn,
                                 java.lang.String calName)
                          throws JobPersistenceException
Throws:
JobPersistenceException

removeCalendar

protected boolean removeCalendar(java.sql.Connection conn,
                                 SchedulingContext ctxt,
                                 java.lang.String calName)
                          throws JobPersistenceException
Throws:
JobPersistenceException

retrieveCalendar

protected Calendar retrieveCalendar(java.sql.Connection conn,
                                    SchedulingContext ctxt,
                                    java.lang.String calName)
                             throws JobPersistenceException
Throws:
JobPersistenceException

getNumberOfJobs

protected int getNumberOfJobs(java.sql.Connection conn,
                              SchedulingContext ctxt)
                       throws JobPersistenceException
Throws:
JobPersistenceException

getNumberOfTriggers

protected int getNumberOfTriggers(java.sql.Connection conn,
                                  SchedulingContext ctxt)
                           throws JobPersistenceException
Throws:
JobPersistenceException

getNumberOfCalendars

protected int getNumberOfCalendars(java.sql.Connection conn,
                                   SchedulingContext ctxt)
                            throws JobPersistenceException
Throws:
JobPersistenceException

getJobNames

protected java.lang.String[] getJobNames(java.sql.Connection conn,
                                         SchedulingContext ctxt,
                                         java.lang.String groupName)
                                  throws JobPersistenceException
Throws:
JobPersistenceException

getTriggerNames

protected java.lang.String[] getTriggerNames(java.sql.Connection conn,
                                             SchedulingContext ctxt,
                                             java.lang.String groupName)
                                      throws JobPersistenceException
Throws:
JobPersistenceException

getJobGroupNames

protected java.lang.String[] getJobGroupNames(java.sql.Connection conn,
                                              SchedulingContext ctxt)
                                       throws JobPersistenceException
Throws:
JobPersistenceException

getTriggerGroupNames

protected java.lang.String[] getTriggerGroupNames(java.sql.Connection conn,
                                                  SchedulingContext ctxt)
                                           throws JobPersistenceException
Throws:
JobPersistenceException

getCalendarNames

protected java.lang.String[] getCalendarNames(java.sql.Connection conn,
                                              SchedulingContext ctxt)
                                       throws JobPersistenceException
Throws:
JobPersistenceException

getTriggersForJob

protected Trigger[] getTriggersForJob(java.sql.Connection conn,
                                      SchedulingContext ctxt,
                                      java.lang.String jobName,
                                      java.lang.String groupName)
                               throws JobPersistenceException
Throws:
JobPersistenceException

pauseTrigger

public void pauseTrigger(java.sql.Connection conn,
                         SchedulingContext ctxt,
                         java.lang.String triggerName,
                         java.lang.String groupName)
                  throws JobPersistenceException

Pause the Trigger with the given name.

Throws:
JobPersistenceException
See Also:
resumeTrigger(Connection, SchedulingContext, String, String)

getStatusForResumedTrigger

protected java.lang.String getStatusForResumedTrigger(java.sql.Connection conn,
                                                      SchedulingContext ctxt,
                                                      TriggerStatus status)
                                               throws JobPersistenceException
Throws:
JobPersistenceException

getNewStatusForTrigger

protected java.lang.String getNewStatusForTrigger(java.sql.Connection conn,
                                                  SchedulingContext ctxt,
                                                  java.lang.String jobName,
                                                  java.lang.String groupName)
                                           throws JobPersistenceException
Throws:
JobPersistenceException

resumeTrigger

public void resumeTrigger(java.sql.Connection conn,
                          SchedulingContext ctxt,
                          java.lang.String triggerName,
                          java.lang.String groupName)
                   throws JobPersistenceException

Resume (un-pause) the Trigger with the given name.

If the Trigger missed one or more fire-times, then the Trigger's misfire instruction will be applied.

Throws:
JobPersistenceException
See Also:
pauseTrigger(Connection, SchedulingContext, String, String)

pauseTriggerGroup

public void pauseTriggerGroup(java.sql.Connection conn,
                              SchedulingContext ctxt,
                              java.lang.String groupName)
                       throws JobPersistenceException

Pause all of the Triggers in the given group.

Throws:
JobPersistenceException
See Also:
resumeTriggerGroup(Connection, SchedulingContext, String)

getPausedTriggerGroups

public java.util.Set getPausedTriggerGroups(java.sql.Connection conn,
                                            SchedulingContext ctxt)
                                     throws JobPersistenceException

Pause all of the Triggers in the given group.

Throws:
JobPersistenceException
See Also:
resumeTriggerGroup(Connection, SchedulingContext, String)

resumeTriggerGroup

public void resumeTriggerGroup(java.sql.Connection conn,
                               SchedulingContext ctxt,
                               java.lang.String groupName)
                        throws JobPersistenceException

Resume (un-pause) all of the Triggers in the given group.

If any Trigger missed one or more fire-times, then the Trigger's misfire instruction will be applied.

Throws:
JobPersistenceException
See Also:
pauseTriggerGroup(Connection, SchedulingContext, String)

pauseAll

public void pauseAll(java.sql.Connection conn,
                     SchedulingContext ctxt)
              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:
JobStore.resumeAll(SchedulingContext), JobStore.pauseTriggerGroup(SchedulingContext, String)

resumeAll

public void resumeAll(java.sql.Connection conn,
                      SchedulingContext ctxt)
               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 the Trigger's misfire instruction will be applied.

Throws:
JobPersistenceException
See Also:
JobStore.pauseAll(SchedulingContext)

getFiredTriggerRecordId

protected java.lang.String getFiredTriggerRecordId()

acquireNextTrigger

protected Trigger acquireNextTrigger(java.sql.Connection conn,
                                     SchedulingContext ctxt)
                              throws JobPersistenceException
Throws:
JobPersistenceException

releaseAcquiredTrigger

protected void releaseAcquiredTrigger(java.sql.Connection conn,
                                      SchedulingContext ctxt,
                                      Trigger trigger)
                               throws JobPersistenceException
Throws:
JobPersistenceException

triggerFired

protected TriggerFiredBundle triggerFired(java.sql.Connection conn,
                                          SchedulingContext ctxt,
                                          Trigger trigger)
                                   throws JobPersistenceException
Throws:
JobPersistenceException

triggeredJobComplete

protected void triggeredJobComplete(java.sql.Connection conn,
                                    SchedulingContext ctxt,
                                    Trigger trigger,
                                    JobDetail jobDetail,
                                    int triggerInstCode)
                             throws JobPersistenceException
Throws:
JobPersistenceException

getDelegate

protected DriverDelegate getDelegate()
                              throws NoSuchDelegateException

Get the driver delegate for DB operations.

Throws:
NoSuchDelegateException

getLockHandler

protected Semaphore getLockHandler()

doRecoverMisfires

protected abstract boolean doRecoverMisfires()
                                      throws JobPersistenceException
Throws:
JobPersistenceException

signalSchedulingChange

protected void signalSchedulingChange()

doCheckin

protected abstract boolean doCheckin()
                              throws JobPersistenceException
Throws:
JobPersistenceException

clusterCheckIn

protected java.util.List clusterCheckIn(java.sql.Connection conn)
                                 throws JobPersistenceException
Throws:
JobPersistenceException

clusterRecover

protected void clusterRecover(java.sql.Connection conn,
                              java.util.List failedInstances)
                       throws JobPersistenceException
Throws:
JobPersistenceException

logWarnIfNonZero

protected void logWarnIfNonZero(int val,
                                java.lang.String warning)

closeConnection

protected void closeConnection(java.sql.Connection conn)
                        throws JobPersistenceException
Closes the supplied connection

Parameters:
conn - (Optional)
Throws:
JobPersistenceException - thrown if a SQLException occurs when the connection is closed

rollbackConnection

protected void rollbackConnection(java.sql.Connection conn)
                           throws JobPersistenceException
Rollback the supplied connection

Parameters:
conn - (Optional)
Throws:
JobPersistenceException - thrown if a SQLException occurs when the connection is rolled back

commitConnection

protected void commitConnection(java.sql.Connection conn)
                         throws JobPersistenceException
Commit the supplied connection

Parameters:
conn - (Optional)
Throws:
JobPersistenceException - thrown if a SQLException occurs when the connection is committed

Quartz Project Page