|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.dbcp.BasicDataSource org.apache.commons.dbcp.managed.BasicManagedDataSource
public class BasicManagedDataSource
BasicManagedDataSource is an extension of BasicDataSource which creates ManagedConnections. This data source can create either full two-phase-commit XA connections or one-phase-commit local connections. Both types of connections are committed or rolled back as part of the global transaction (a.k.a. XA transaction or JTA Transaction), but only XA connections can be recovered in the case of a system crash.
BasicManagedDataSource adds the TransactionManager and XADataSource properties. The TransactionManager property is required and is used to elist connections in global transactions. The XADataSource is optional and if set is the class name of the XADataSource class for a two-phase-commit JDBC driver. If the XADataSource property is set, the driverClassName is ignored and a DataSourceXAConnectionFactory is created. Otherwise, a standard DriverConnectionFactory is created and wrapped with a LocalXAConnectionFactory.
BasicDataSource
,
ManagedConnection
Field Summary |
---|
Constructor Summary | |
---|---|
BasicManagedDataSource()
|
Method Summary | |
---|---|
protected ConnectionFactory |
createConnectionFactory()
Creates a JDBC connection factory for this datasource. |
protected void |
createDataSourceInstance()
Creates the actual data source instance. |
protected void |
createPoolableConnectionFactory(ConnectionFactory driverConnectionFactory,
KeyedObjectPoolFactory statementPoolFactory,
AbandonedConfig abandonedConfig)
Creates the PoolableConnectionFactory and attaches it to the connection pool. |
TransactionManager |
getTransactionManager()
Gets the required transaction manager property. |
protected TransactionRegistry |
getTransactionRegistry()
Gets the transaction registry. |
String |
getXADataSource()
Gets the optional XADataSource class name. |
XADataSource |
getXaDataSourceInstance()
Gets the XADataSource instance used by the XAConnectionFactory. |
void |
setTransactionManager(TransactionManager transactionManager)
Sets the required transaction manager property. |
void |
setXADataSource(String xaDataSource)
Sets the optional XADataSource class name. |
void |
setXaDataSourceInstance(XADataSource xaDataSourceInstance)
Sets the XADataSource instance used by the XAConnectionFactory. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BasicManagedDataSource()
Method Detail |
---|
public XADataSource getXaDataSourceInstance()
public void setXaDataSourceInstance(XADataSource xaDataSourceInstance)
Sets the XADataSource instance used by the XAConnectionFactory.
Note: this method currently has no effect once the pool has been
initialized. The pool is initialized the first time one of the
following methods is invoked: getConnection, setLogwriter,
setLoginTimeout, getLoginTimeout, getLogWriter.
xaDataSourceInstance
- XADataSource instancepublic TransactionManager getTransactionManager()
protected TransactionRegistry getTransactionRegistry()
public void setTransactionManager(TransactionManager transactionManager)
transactionManager
- the transaction manager used to enlist connectionspublic String getXADataSource()
public void setXADataSource(String xaDataSource)
xaDataSource
- the optional XADataSource class nameprotected ConnectionFactory createConnectionFactory() throws SQLException
BasicDataSource
createConnectionFactory
in class BasicDataSource
SQLException
protected void createDataSourceInstance() throws SQLException
BasicDataSource
createDataSourceInstance
in class BasicDataSource
SQLException
- if unable to create a datasource instanceprotected void createPoolableConnectionFactory(ConnectionFactory driverConnectionFactory, KeyedObjectPoolFactory statementPoolFactory, AbandonedConfig abandonedConfig) throws SQLException
createPoolableConnectionFactory
in class BasicDataSource
driverConnectionFactory
- JDBC connection factory created by createConnectionFactory()
statementPoolFactory
- statement pool factory (null if statement pooling is turned off)abandonedConfig
- abandoned connection tracking configuration (null if no tracking)
SQLException
- if an error occurs creating the PoolableConnectionFactory
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |