org.springframework.scheduling.quartz
Class LocalDataSourceJobStore

java.lang.Object
  extended by JobStoreCMT
      extended by org.springframework.scheduling.quartz.LocalDataSourceJobStore

public class LocalDataSourceJobStore
extends JobStoreCMT

Subclass of Quartz's 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 transactions, 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
private  javax.sql.DataSource dataSource
           
static java.lang.String NON_TX_DATA_SOURCE_PREFIX
          Name used for the non-transactional ConnectionProvider for Quartz.
static java.lang.String TX_DATA_SOURCE_PREFIX
          Name used for the transactional ConnectionProvider for Quartz.
 
Constructor Summary
LocalDataSourceJobStore()
           
 
Method Summary
protected  void closeConnection(java.sql.Connection con)
           
 void initialize(ClassLoadHelper loadHelper, SchedulerSignaler signaler)
           
 
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 java.lang.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:
org.quartz.utils.DBConnectionManager#addConnectionProvider, SchedulerFactoryBean.setDataSource(javax.sql.DataSource), Constant Field Values

NON_TX_DATA_SOURCE_PREFIX

public static final java.lang.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:
org.quartz.utils.DBConnectionManager#addConnectionProvider, SchedulerFactoryBean.setDataSource(javax.sql.DataSource), Constant Field Values

dataSource

private javax.sql.DataSource dataSource
Constructor Detail

LocalDataSourceJobStore

public LocalDataSourceJobStore()
Method Detail

initialize

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

closeConnection

protected void closeConnection(java.sql.Connection con)