public class PoolingDataSource extends ResourceBean implements javax.sql.DataSource, XAResourceProducer, PoolingDataSourceMBean
DataSource wrapping vendor's XADataSource implementation.| Constructor and Description |
|---|
PoolingDataSource() |
PoolingDataSource(java.lang.Object... factoryConstructorArgs) |
| Modifier and Type | Method and Description |
|---|---|
void |
addConnectionCustomizer(ConnectionCustomizer connectionCustomizer) |
void |
close()
Release this
XAResourceProducer's internal resources. |
XAStatefulHolder |
createPooledConnection(java.lang.Object xaFactory,
ResourceBean bean)
Create a
XAStatefulHolder that will be placed in an XAPool. |
void |
endRecovery()
Release internal resources held after call to
startRecovery(). |
XAResourceHolder |
findXAResourceHolder(javax.transaction.xa.XAResource xaResource)
Find in the
XAResourceHolders created by this XAResourceProducer the one which this
XAResource belongs to. |
java.sql.Connection |
getConnection() |
java.sql.Connection |
getConnection(java.lang.String username,
java.lang.String password) |
java.lang.String |
getCursorHoldability() |
long |
getInPoolSize() |
java.lang.String |
getIsolationLevel() |
java.lang.String |
getLocalAutoCommit() |
int |
getLoginTimeout() |
java.io.PrintWriter |
getLogWriter() |
java.util.logging.Logger |
getParentLogger() |
int |
getPreparedStatementCacheSize() |
javax.naming.Reference |
getReference()
PoolingDataSource must alway have a unique name so this method builds a reference to this object using
the unique name as RefAddr. |
java.lang.String |
getTestQuery() |
long |
getTotalPoolSize() |
void |
init()
Initializes the pool by creating the initial amount of connections.
|
boolean |
isEnableJdbc4ConnectionTest() |
boolean |
isFailed() |
boolean |
isWrapperFor(java.lang.Class<?> iface) |
void |
removeConnectionCustomizer(ConnectionCustomizer connectionCustomizer) |
void |
reset() |
void |
setCursorHoldability(java.lang.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(java.lang.String isolationLevel)
Set the default isolation level for connections.
|
void |
setLocalAutoCommit(java.lang.String localAutoCommit)
Set the default local transactions autocommit mode.
|
void |
setLoginTimeout(int seconds) |
void |
setLogWriter(java.io.PrintWriter out) |
void |
setPreparedStatementCacheSize(int preparedStatementCacheSize)
Set the target maximum size of the prepared statement cache.
|
void |
setTestQuery(java.lang.String testQuery)
When set, the specified query will be executed on the connection acquired from the pool before being handed to
the caller.
|
XAResourceHolderState |
startRecovery()
Prepare the recoverable
XAResource producer for recovery. |
java.lang.String |
toString() |
<T> T |
unwrap(java.lang.Class<T> iface) |
getAcquireIncrement, getAcquisitionInterval, getAcquisitionTimeout, getAllowLocalTransactions, getApplyTransactionTimeout, getAutomaticEnlistingEnabled, getClassName, getDeferConnectionRelease, getDriverProperties, getIgnoreRecoveryFailures, getMaxIdleTime, getMaxPoolSize, getMinPoolSize, getShareTransactionConnections, getTwoPcOrderingPosition, getUniqueName, getUseTmJoin, incCreatedResourcesCounter, isDisabled, setAcquireIncrement, setAcquisitionInterval, setAcquisitionTimeout, setAllowLocalTransactions, setApplyTransactionTimeout, setAutomaticEnlistingEnabled, setClassName, setDeferConnectionRelease, setDisabled, setDriverProperties, setIgnoreRecoveryFailures, setMaxIdleTime, setMaxPoolSize, setMinPoolSize, setShareTransactionConnections, setTwoPcOrderingPosition, setUniqueName, setUseTmJoinclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetUniqueNamegetMaxPoolSize, getMinPoolSize, isDisabled, setDisabledpublic PoolingDataSource()
public PoolingDataSource(java.lang.Object... factoryConstructorArgs)
public void init()
init in interface XAResourceProducerpublic java.lang.String getTestQuery()
public void setTestQuery(java.lang.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 int getPreparedStatementCacheSize()
public void setPreparedStatementCacheSize(int preparedStatementCacheSize)
preparedStatementCacheSize - the target maximum prepared statement cache size.public java.lang.String getIsolationLevel()
public void setIsolationLevel(java.lang.String isolationLevel)
isolationLevel - the default isolation level.public java.lang.String getCursorHoldability()
public void setCursorHoldability(java.lang.String cursorHoldability)
cursorHoldability - the default cursor holdability.public java.lang.String getLocalAutoCommit()
public void setLocalAutoCommit(java.lang.String localAutoCommit)
localAutoCommit - the default local transactions autocommit mode.public void addConnectionCustomizer(ConnectionCustomizer connectionCustomizer)
public void removeConnectionCustomizer(ConnectionCustomizer connectionCustomizer)
public java.sql.Connection getConnection()
throws java.sql.SQLException
getConnection in interface javax.sql.DataSourcejava.sql.SQLExceptionpublic java.sql.Connection getConnection(java.lang.String username,
java.lang.String password)
throws java.sql.SQLException
getConnection in interface javax.sql.DataSourcejava.sql.SQLExceptionpublic java.lang.String toString()
toString in class java.lang.Objectpublic XAResourceHolderState startRecovery() throws RecoveryException
XAResourceProducerXAResource producer for recovery.startRecovery in interface XAResourceProducerXAResourceHolderState 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 XAResourceProducerRecoveryException - thrown when an error occured while releasing reserved resources.public void setFailed(boolean failed)
XAResourceProducersetFailed in interface XAResourceProducerfailed - 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 XAResourceProducerpublic XAStatefulHolder createPooledConnection(java.lang.Object xaFactory, ResourceBean bean) throws java.lang.Exception
XAResourceProducerXAStatefulHolder that will be placed in an XAPool.createPooledConnection in interface XAResourceProducerxaFactory - the vendor's resource-specific XA factory.bean - the resource-specific bean describing the resource parameters.XAStatefulHolder that will be placed in an XAPool.java.lang.Exception - thrown when the XAStatefulHolder cannot be created.public XAResourceHolder findXAResourceHolder(javax.transaction.xa.XAResource xaResource)
XAResourceProducerXAResourceHolders created by this XAResourceProducer the one which this
XAResource belongs to.findXAResourceHolder in interface XAResourceProducerxaResource - the XAResource to look for.XAResourceHolder or null if the XAResource does not belong to this
XAResourceProducer.public javax.naming.Reference getReference()
throws javax.naming.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 javax.naming.ReferenceablePoolingDataSource.javax.naming.NamingExceptionpublic int getLoginTimeout()
throws java.sql.SQLException
getLoginTimeout in interface javax.sql.CommonDataSourcejava.sql.SQLExceptionpublic java.util.logging.Logger getParentLogger()
throws java.sql.SQLFeatureNotSupportedException
getParentLogger in interface javax.sql.CommonDataSourcejava.sql.SQLFeatureNotSupportedExceptionpublic void setLoginTimeout(int seconds)
throws java.sql.SQLException
setLoginTimeout in interface javax.sql.CommonDataSourcejava.sql.SQLExceptionpublic java.io.PrintWriter getLogWriter()
throws java.sql.SQLException
getLogWriter in interface javax.sql.CommonDataSourcejava.sql.SQLExceptionpublic void setLogWriter(java.io.PrintWriter out)
throws java.sql.SQLException
setLogWriter in interface javax.sql.CommonDataSourcejava.sql.SQLExceptionpublic boolean isWrapperFor(java.lang.Class<?> iface)
throws java.sql.SQLException
isWrapperFor in interface java.sql.Wrapperjava.sql.SQLExceptionpublic <T> T unwrap(java.lang.Class<T> iface)
throws java.sql.SQLException
unwrap in interface java.sql.Wrapperjava.sql.SQLExceptionpublic long getInPoolSize()
getInPoolSize in interface PoolingDataSourceMBeanpublic long getTotalPoolSize()
getTotalPoolSize in interface PoolingDataSourceMBeanpublic void reset()
throws java.lang.Exception
reset in interface PoolingDataSourceMBeanjava.lang.ExceptionCopyright © 2006-2023 Bitronix Software. All Rights Reserved.