public class PoolingDataSource extends ResourceBean implements DataSource, XAResourceProducer<JdbcPooledConnection,JdbcPooledConnection>, PoolingDataSourceMBean
DataSource wrapping vendor's XADataSource implementation.| Constructor and Description |
|---|
PoolingDataSource() |
| Modifier and Type | Method and Description |
|---|---|
void |
addConnectionCustomizer(ConnectionCustomizer connectionCustomizer) |
void |
close()
Release this
XAResourceProducer's internal resources. |
JdbcPooledConnection |
createPooledConnection(Object xaFactory,
ResourceBean bean)
Create a
XAStatefulHolder that will be placed in an XAPool. |
void |
endRecovery()
Release internal resources held after call to
startRecovery(). |
JdbcPooledConnection |
findXAResourceHolder(XAResource xaResource)
Find in the
XAResourceHolders created by this XAResourceProducer the one which this
XAResource belongs to. |
Connection |
getConnection() |
Connection |
getConnection(String username,
String password) |
int |
getConnectionTestTimeout() |
String |
getCursorHoldability() |
int |
getEffectiveConnectionTestTimeout() |
int |
getInPoolSize() |
String |
getIsolationLevel() |
String |
getLocalAutoCommit() |
int |
getLoginTimeout() |
PrintWriter |
getLogWriter() |
Logger |
getParentLogger() |
int |
getPreparedStatementCacheSize() |
Reference |
getReference()
PoolingDataSource must alway have a unique name so this method builds a reference to this object using
the unique name as RefAddr. |
String |
getTestQuery() |
int |
getTotalPoolSize() |
XADataSource |
getXaDataSource() |
void |
init()
Initializes the pool by creating the initial amount of connections.
|
boolean |
isEnableJdbc4ConnectionTest() |
boolean |
isFailed() |
boolean |
isWrapperFor(Class<?> iface) |
void |
removeConnectionCustomizer(ConnectionCustomizer connectionCustomizer) |
void |
reset() |
void |
setConnectionTestTimeout(int connectionTestTimeout)
Determines how many seconds the connection test logic
will wait for a response from the database.
|
void |
setCursorHoldability(String cursorHoldability)
Set the default cursor holdability for connections.
|
void |
setEnableJdbc4ConnectionTest(boolean enableJdbc4ConnectionTest)
When set and the underlying JDBC driver supports JDBC 4 isValid(), a Connection.isValid() call
is performed to test the connection before handing it to the caller.
|
void |
setFailed(boolean failed)
Mark this resource producer as failed or not.
|
void |
setIsolationLevel(String isolationLevel)
Set the default isolation level for connections.
|
void |
setLocalAutoCommit(String localAutoCommit)
Set the default local transactions autocommit mode.
|
void |
setLoginTimeout(int seconds) |
void |
setLogWriter(PrintWriter out) |
void |
setPreparedStatementCacheSize(int preparedStatementCacheSize)
Set the target maximum size of the prepared statement cache.
|
void |
setTestQuery(String testQuery)
When set, the specified query will be executed on the connection acquired from the pool before being handed to
the caller.
|
void |
setXaDataSource(XADataSource xaDataSource)
Inject a pre-configured XADataSource instead of relying on className and driverProperties
to build one.
|
XAResourceHolderState |
startRecovery()
Prepare the recoverable
XAResource producer for recovery. |
String |
toString() |
void |
unregister(JdbcPooledConnection xaResourceHolder) |
<T> T |
unwrap(Class<T> iface) |
getAcquireIncrement, getAcquisitionInterval, getAcquisitionTimeout, getAllowLocalTransactions, getApplyTransactionTimeout, getAutomaticEnlistingEnabled, getClassName, getDeferConnectionRelease, getDriverProperties, getIgnoreRecoveryFailures, getMaxIdleTime, getMaxLifeTime, getMaxPoolSize, getMinPoolSize, getShareTransactionConnections, getTwoPcOrderingPosition, getUniqueName, getUseTmJoin, incCreatedResourcesCounter, isDisabled, setAcquireIncrement, setAcquisitionInterval, setAcquisitionTimeout, setAllowLocalTransactions, setApplyTransactionTimeout, setAutomaticEnlistingEnabled, setClassName, setDeferConnectionRelease, setDisabled, setDriverProperties, setIgnoreRecoveryFailures, setMaxIdleTime, setMaxLifeTime, setMaxPoolSize, setMinPoolSize, setShareTransactionConnections, setTwoPcOrderingPosition, setUniqueName, setUseTmJoinclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetUniqueNamegetMaxPoolSize, getMinPoolSize, isDisabled, setDisabledpublic void init()
init in interface XAResourceProducer<JdbcPooledConnection,JdbcPooledConnection>public XADataSource getXaDataSource()
public void setXaDataSource(XADataSource xaDataSource)
xaDataSource - the pre-configured XADataSource.public String getTestQuery()
public void setTestQuery(String testQuery)
testQuery - the query that will be used to test connections.public void setEnableJdbc4ConnectionTest(boolean enableJdbc4ConnectionTest)
enableJdbc4ConnectionTest - true if JDBC 4 isValid() testing should be performed, false otherwise.public boolean isEnableJdbc4ConnectionTest()
public void setConnectionTestTimeout(int connectionTestTimeout)
connectionTestTimeout - connection timeoutpublic int getConnectionTestTimeout()
public int getEffectiveConnectionTestTimeout()
public int getPreparedStatementCacheSize()
public void setPreparedStatementCacheSize(int preparedStatementCacheSize)
preparedStatementCacheSize - the target maximum prepared statement cache size.public String getIsolationLevel()
public void setIsolationLevel(String isolationLevel)
isolationLevel - the default isolation level.public String getCursorHoldability()
public void setCursorHoldability(String cursorHoldability)
cursorHoldability - the default cursor holdability.public String getLocalAutoCommit()
public void setLocalAutoCommit(String localAutoCommit)
localAutoCommit - the default local transactions autocommit mode.public void addConnectionCustomizer(ConnectionCustomizer connectionCustomizer)
public void removeConnectionCustomizer(ConnectionCustomizer connectionCustomizer)
public Connection getConnection() throws SQLException
getConnection in interface DataSourceSQLExceptionpublic Connection getConnection(String username, String password) throws SQLException
getConnection in interface DataSourceSQLExceptionpublic XAResourceHolderState startRecovery() throws RecoveryException
XAResourceProducerXAResource producer for recovery.startRecovery in interface XAResourceProducer<JdbcPooledConnection,JdbcPooledConnection>XAResourceHolderState object that can be used to call recover().RecoveryException - thrown when a XAResourceHolderState cannot be acquired.public void endRecovery()
throws RecoveryException
XAResourceProducerstartRecovery().endRecovery in interface XAResourceProducer<JdbcPooledConnection,JdbcPooledConnection>RecoveryException - thrown when an error occurred while releasing reserved resources.public void setFailed(boolean failed)
XAResourceProducersetFailed in interface XAResourceProducer<JdbcPooledConnection,JdbcPooledConnection>failed - true is the resource must be considered failed, false it it must be considered sane.public boolean isFailed()
isFailed in interface PoolingDataSourceMBeanpublic void close()
XAResourceProducerXAResourceProducer's internal resources.close in interface XAResourceProducer<JdbcPooledConnection,JdbcPooledConnection>public JdbcPooledConnection createPooledConnection(Object xaFactory, ResourceBean bean) throws Exception
XAResourceProducerXAStatefulHolder that will be placed in an XAPool.createPooledConnection in interface XAResourceProducer<JdbcPooledConnection,JdbcPooledConnection>xaFactory - the vendor's resource-specific XA factory.bean - the resource-specific bean describing the resource parameters.XAStatefulHolder that will be placed in an XAPool.Exception - thrown when the XAStatefulHolder cannot be created.public JdbcPooledConnection findXAResourceHolder(XAResource xaResource)
XAResourceProducerXAResourceHolders created by this XAResourceProducer the one which this
XAResource belongs to.findXAResourceHolder in interface XAResourceProducer<JdbcPooledConnection,JdbcPooledConnection>xaResource - the XAResource to look for.XAResourceHolder or null if the XAResource does not belong to this
XAResourceProducer.public Reference getReference() throws NamingException
PoolingDataSource must alway have a unique name so this method builds a reference to this object using
the unique name as RefAddr.getReference in interface ReferenceablePoolingDataSource.NamingExceptionpublic int getLoginTimeout()
throws SQLException
getLoginTimeout in interface CommonDataSourceSQLExceptionpublic void setLoginTimeout(int seconds)
throws SQLException
setLoginTimeout in interface CommonDataSourceSQLExceptionpublic PrintWriter getLogWriter() throws SQLException
getLogWriter in interface CommonDataSourceSQLExceptionpublic void setLogWriter(PrintWriter out) throws SQLException
setLogWriter in interface CommonDataSourceSQLExceptionpublic boolean isWrapperFor(Class<?> iface) throws SQLException
isWrapperFor in interface WrapperSQLExceptionpublic <T> T unwrap(Class<T> iface) throws SQLException
unwrap in interface WrapperSQLExceptionpublic int getInPoolSize()
getInPoolSize in interface PoolingDataSourceMBeanpublic int getTotalPoolSize()
getTotalPoolSize in interface PoolingDataSourceMBeanpublic void reset()
throws Exception
reset in interface PoolingDataSourceMBeanExceptionpublic void unregister(JdbcPooledConnection xaResourceHolder)
public Logger getParentLogger() throws SQLFeatureNotSupportedException
getParentLogger in interface CommonDataSourceSQLFeatureNotSupportedExceptionCopyright © 2006-2016 Bitronix Software. All Rights Reserved.