org.springframework.scheduling.quartz
Class LocalDataSourceJobStore

java.lang.Object
  extended by org.quartz.impl.jdbcjobstore.JobStoreSupport
      extended by org.quartz.impl.jdbcjobstore.JobStoreCMT
          extended by org.springframework.scheduling.quartz.LocalDataSourceJobStore
All Implemented Interfaces:
Constants, JobStore

public class LocalDataSourceJobStore
extends JobStoreCMT

Subclass of Quartz' JobStoreCMT class that delegates to a Spring-managed DataSource instead of using a Quartz-managed connection pool. This JobStore will be used if SchedulerFactoryBean's "dataSource" property is set.

Supports both transactional and non-transactional DataSource access. With a non-XA DataSource and local Spring transactions, a single DataSource argument is sufficient. In case of an XA DataSource and global JTA transactions, SchedulerFactoryBean's "nonTransactionalDataSource" property should be set, passing in a non-XA DataSource that will not participate in global transactions.

Operations performed by this JobStore will properly participate in any kind of Spring-managed transaction, as it uses Spring's DataSourceUtils connection handling methods that are aware of a current transaction.

Note that all Quartz Scheduler operations that affect the persistent job store should usually be performed within active transaction, as they assume to get proper locks etc.

Since:
1.1
Author:
Juergen Hoeller
See Also:
SchedulerFactoryBean.setDataSource(javax.sql.DataSource), SchedulerFactoryBean.setNonTransactionalDataSource(javax.sql.DataSource), DataSourceUtils.doGetConnection(javax.sql.DataSource), DataSourceUtils.releaseConnection(java.sql.Connection, javax.sql.DataSource)

Field Summary
static String NON_TX_DATA_SOURCE_PREFIX
          Name used for the non-transactional ConnectionProvider for Quartz.
static String TX_DATA_SOURCE_PREFIX
          Name used for the transactional ConnectionProvider for Quartz.
 
Fields inherited from class org.quartz.impl.jdbcjobstore.JobStoreCMT
dontSetNonManagedTXConnectionAutoCommitFalse, nonManagedTxDsName, setTxIsolationLevelReadCommitted
 
Fields inherited from class org.quartz.impl.jdbcjobstore.JobStoreSupport
calendarCache, delegateClass, delegateClassName, dsName, firstCheckIn, instanceId, instanceName, lastCheckin, LOCK_CALENDAR_ACCESS, LOCK_JOB_ACCESS, LOCK_MISFIRE_ACCESS, LOCK_STATE_ACCESS, LOCK_TRIGGER_ACCESS, maxToRecoverAtATime, tablePrefix, 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_PAUSED_BLOCKED, 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
LocalDataSourceJobStore()
           
 
Method Summary
protected  void closeConnection(Connection con)
           
 void initialize(ClassLoadHelper loadHelper, SchedulerSignaler signaler)
           
 
Methods inherited from class org.quartz.impl.jdbcjobstore.JobStoreCMT
acquireNextTrigger, cleanVolatileTriggerAndJobs, doCheckin, doRecoverMisfires, getCalendarNames, getJobGroupNames, getJobNames, getNonManagedTXConnection, getNonManagedTXDataSource, getNumberOfCalendars, getNumberOfJobs, getNumberOfTriggers, getPausedTriggerGroups, getTriggerGroupNames, getTriggerNames, getTriggersForJob, getTriggerState, isDontSetNonManagedTXConnectionAutoCommitFalse, isTxIsolationLevelReadCommitted, pauseAll, pauseJob, pauseJobGroup, pauseTrigger, pauseTriggerGroup, recoverJobs, releaseAcquiredTrigger, removeCalendar, removeJob, removeTrigger, replaceTrigger, resumeAll, resumeJob, resumeJobGroup, resumeTrigger, resumeTriggerGroup, retrieveCalendar, retrieveJob, retrieveTrigger, setDontSetNonManagedTXConnectionAutoCommitFalse, setNonManagedTXDataSource, setTxIsolationLevelReadCommitted, shutdown, storeCalendar, storeJob, storeJobAndTrigger, storeTrigger, triggeredJobComplete, triggerFired
 
Methods inherited from class org.quartz.impl.jdbcjobstore.JobStoreSupport
acquireNextTrigger, calcFailedIfAfter, calendarExists, canUseProperties, cleanVolatileTriggerAndJobs, clusterCheckIn, clusterRecover, commitConnection, findFailedInstances, getCalendarNames, getClassLoadHelper, getClusterCheckinInterval, getConnection, getDataSource, getDbRetryInterval, getDelegate, getDriverDelegateClass, getFiredTriggerRecordId, getInstanceId, getInstanceName, getJobGroupNames, getJobNames, getLockHandler, getMaxMisfiresToHandleAtATime, getMisfireThreshold, getMisfireTime, getNewStatusForTrigger, getNumberOfCalendars, getNumberOfJobs, getNumberOfTriggers, getPausedTriggerGroups, getSelectWithLockSQL, getStatusForResumedTrigger, getTablePrefix, getTriggerGroupNames, getTriggerNames, getTriggersForJob, getTriggerState, getUseDBLocks, isClustered, isDontSetAutoCommitFalse, isLockOnInsert, isTxIsolationLevelSerializable, jobExists, logWarnIfNonZero, pauseAll, pauseTrigger, pauseTriggerGroup, recoverJobs, recoverMisfiredJobs, releaseAcquiredTrigger, releaseLock, removeCalendar, removeJob, removeTrigger, replaceTrigger, resumeAll, resumeTrigger, resumeTriggerGroup, retrieveCalendar, retrieveJob, retrieveTrigger, rollbackConnection, schedulerStarted, setClusterCheckinInterval, setDataSource, setDbRetryInterval, setDontSetAutoCommitFalse, setDriverDelegateClass, setInstanceId, setInstanceName, setIsClustered, setLockOnInsert, setMaxMisfiresToHandleAtATime, setMisfireThreshold, setSelectWithLockSQL, setTablePrefix, setTxIsolationLevelSerializable, setUseDBLocks, setUseProperties, signalSchedulingChange, storeCalendar, storeJob, storeTrigger, supportsPersistence, triggeredJobComplete, triggerExists, triggerFired, updateMisfiredTrigger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TX_DATA_SOURCE_PREFIX

public static final String TX_DATA_SOURCE_PREFIX
Name used for the transactional ConnectionProvider for Quartz. This provider will delegate to the local Spring-managed DataSource.

See Also:
DBConnectionManager.addConnectionProvider(java.lang.String, org.quartz.utils.ConnectionProvider), SchedulerFactoryBean.setDataSource(javax.sql.DataSource), Constant Field Values

NON_TX_DATA_SOURCE_PREFIX

public static final String NON_TX_DATA_SOURCE_PREFIX
Name used for the non-transactional ConnectionProvider for Quartz. This provider will delegate to the local Spring-managed DataSource.

See Also:
DBConnectionManager.addConnectionProvider(java.lang.String, org.quartz.utils.ConnectionProvider), SchedulerFactoryBean.setDataSource(javax.sql.DataSource), Constant Field Values
Constructor Detail

LocalDataSourceJobStore

public LocalDataSourceJobStore()
Method Detail

initialize

public void initialize(ClassLoadHelper loadHelper,
                       SchedulerSignaler signaler)
                throws SchedulerConfigException
Specified by:
initialize in interface JobStore
Overrides:
initialize in class JobStoreCMT
Throws:
SchedulerConfigException

closeConnection

protected void closeConnection(Connection con)
Overrides:
closeConnection in class JobStoreSupport


Copyright (c) 2002-2006 The Spring Framework Project.