Top Description Fields Constructors Methods
org.springframework.scheduling.quartz

public Class LocalDataSourceJobStore

extends org.quartz.impl.jdbcjobstore.JobStoreCMT
Class Inheritance
Annotations
@SuppressWarnings:unchecked
Imports
java.sql.Connection, .DatabaseMetaData, .SQLException, javax.sql.DataSource, org.quartz.SchedulerConfigException, org.quartz.impl.jdbcjobstore.JobStoreCMT, org.quartz.impl.jdbcjobstore.SimpleSemaphore, org.quartz.spi.ClassLoadHelper, org.quartz.spi.SchedulerSignaler, org.quartz.utils.ConnectionProvider, org.quartz.utils.DBConnectionManager, org.springframework.jdbc.datasource.DataSourceUtils, org.springframework.jdbc.support.JdbcUtils, .MetaDataAccessException, org.springframework.lang.Nullable

Subclass of Quartz's JobStoreCMT class that delegates to a Spring-managed DataSource instead of using a Quartz-managed JDBC connection pool. This JobStore will be used if SchedulerFactoryBean's "dataSource" property is set. You may also configure it explicitly, possibly as a custom subclass of this LocalDataSourceJobStore or as an equivalent JobStoreCMT variant.

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.

Author
Juergen Hoeller
Since
1.1
See Also
SchedulerFactoryBean#setDataSource, SchedulerFactoryBean#setNonTransactionalDataSource, SchedulerFactoryBean#getConfigTimeDataSource(), SchedulerFactoryBean#getConfigTimeNonTransactionalDataSource(), org.springframework.jdbc.datasource.DataSourceUtils#doGetConnection, org.springframework.jdbc.datasource.DataSourceUtils#releaseConnection

Field Summary

Modifier and TypeField and Description
private DataSource
public static final String
NON_TX_DATA_SOURCE_PREFIX

Name used for the non-transactional ConnectionProvider for Quartz.

public static final String
TX_DATA_SOURCE_PREFIX

Name used for the transactional ConnectionProvider for Quartz.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
public void
initialize(org.quartz.spi.ClassLoadHelper loadHelper, org.quartz.spi.SchedulerSignaler signaler)

Field Detail

dataSourceback to summary
private DataSource dataSource
Annotations
@Nullable
NON_TX_DATA_SOURCE_PREFIXback to summary
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
org.quartz.utils.DBConnectionManager#addConnectionProvider, SchedulerFactoryBean#setDataSource
TX_DATA_SOURCE_PREFIXback to summary
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
org.quartz.utils.DBConnectionManager#addConnectionProvider, SchedulerFactoryBean#setDataSource

Constructor Detail

LocalDataSourceJobStoreback to summary
public LocalDataSourceJobStore()

Method Detail

closeConnectionback to summary
protected void closeConnection(Connection con)
Annotations
@Override
initializeback to summary
public void initialize(org.quartz.spi.ClassLoadHelper loadHelper, org.quartz.spi.SchedulerSignaler signaler) throws org.quartz.SchedulerConfigException
Annotations
@Override