public abstract class AbstractDataSourceBean extends Object implements DataSource, ConnectionPoolProperties, Referenceable, Serializable, com.atomikos.icatch.OrderedLifecycleComponent
DEFAULT_BORROW_CONNECTION_TIMEOUT, DEFAULT_ISOLATION_LEVEL_UNSET, DEFAULT_MAINTENANCE_INTERVAL, DEFAULT_MAX_IDLE_TIME, DEFAULT_MAX_LIFETIME, DEFAULT_POOL_SIZE| Constructor and Description |
|---|
AbstractDataSourceBean() |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected abstract void |
doClose() |
protected abstract ConnectionFactory<Connection> |
doInit() |
int |
getBorrowConnectionTimeout()
Get the maximum amount of time in seconds the pool will block
waiting for a connection to become available in the pool when it
is empty.
|
boolean |
getConcurrentConnectionValidation() |
Connection |
getConnection() |
Connection |
getConnection(String username,
String password) |
int |
getDefaultIsolationLevel()
Gets the default isolation level for connections created by this datasource.
|
boolean |
getLocalTransactionMode()
Tests whether local transactions are allowed - defaults to false
for JDBC.
|
int |
getLoginTimeout() |
PrintWriter |
getLogWriter() |
int |
getMaintenanceInterval()
Gets the maintenance interval as set.
|
int |
getMaxIdleTime()
Gets the maximum amount of time in seconds a connection can stay in the pool
before being eligible for being closed during pool shrinking.
|
int |
getMaxLifetime()
Gets the maximum lifetime in seconds.
|
int |
getMaxPoolSize()
Get the maximum pool size.
|
int |
getMinPoolSize()
Gets the minimum size of the pool.
|
Logger |
getParentLogger()
JDK 1.7 requirement.
|
Reference |
getReference() |
String |
getTestQuery()
Gets the SQL query used to test a connection before returning it.
|
String |
getUniqueResourceName()
Get the resource name.
|
void |
init() |
protected abstract boolean |
isAssignableFromWrappedVendorClass(Class<?> iface) |
boolean |
isWrapperFor(Class<?> iface) |
int |
poolAvailableSize() |
int |
poolTotalSize() |
void |
refreshPool()
Refreshes all available connections in the pool.
|
void |
setBorrowConnectionTimeout(int borrowConnectionTimeout)
Sets the maximum amount of time in seconds the pool will block
waiting for a connection to become available in the pool when it
is empty.
|
void |
setConcurrentConnectionValidation(boolean value)
Sets whether or not to use concurrent connection validation.
|
void |
setDefaultIsolationLevel(int defaultIsolationLevel)
Sets the default isolation level of connections returned by this datasource.
|
void |
setLoginTimeout(int seconds) |
void |
setLogWriter(PrintWriter out) |
void |
setMaintenanceInterval(int maintenanceInterval)
Sets the maintenance interval for the pool maintenance thread.
|
void |
setMaxIdleTime(int maxIdleTime)
Sets the maximum amount of seconds that unused excess connections should stay in the pool.
|
void |
setMaxLifetime(int maxLifetime)
Sets the maximum amount of seconds that a connection is kept in the pool before
it is destroyed automatically.
|
void |
setMaxPoolSize(int maxPoolSize)
Sets the maximum pool size.
|
void |
setMinPoolSize(int minPoolSize)
Sets the minimum pool size.
|
void |
setPoolSize(int poolSize)
Sets both the minimal and maximal pool size.
|
void |
setTestQuery(String testQuery)
Sets the SQL query or statement used to validate a connection before returning it.
|
void |
setUniqueResourceName(String resourceName)
Sets the resource name.
|
protected void |
throwAtomikosSQLException(String msg) |
String |
toString() |
<T> T |
unwrap(Class<T> iface) |
protected abstract Object |
unwrapVendorInstance() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetIgnoreJtaTransactionsprotected void throwAtomikosSQLException(String msg) throws AtomikosSQLException
AtomikosSQLExceptionpublic int getMinPoolSize()
getMinPoolSize in interface ConnectionPoolPropertiespublic void setMinPoolSize(int minPoolSize)
minPoolSize - public int getMaxPoolSize()
getMaxPoolSize in interface ConnectionPoolPropertiespublic void setMaxPoolSize(int maxPoolSize)
maxPoolSize - public void setPoolSize(int poolSize)
public int getBorrowConnectionTimeout()
getBorrowConnectionTimeout in interface ConnectionPoolPropertiespublic void setBorrowConnectionTimeout(int borrowConnectionTimeout)
borrowConnectionTimeout - The time in seconds. Zero or negative means no waiting at all.
Defaults to 30 seconds.public void setMaintenanceInterval(int maintenanceInterval)
maintenanceInterval - The interval in seconds. If not set or not positive then the pool's default (60 secs) will be used.public int getMaintenanceInterval()
getMaintenanceInterval in interface ConnectionPoolPropertiespublic int getMaxIdleTime()
getMaxIdleTime in interface ConnectionPoolPropertiespublic void setMaxIdleTime(int maxIdleTime)
maxIdleTime - The preferred idle time for unused excess connections. Note that this value is
only an indication; the pool will check regularly as indicated by the maintenanceInteval property.
The default is 60 seconds.public void setMaxLifetime(int maxLifetime)
maxLifetime - public int getMaxLifetime()
getMaxLifetime in interface ConnectionPoolPropertiespublic String getTestQuery()
getTestQuery in interface ConnectionPoolPropertiespublic void setTestQuery(String testQuery)
testQuery - - The SQL query or statement to validate the connection with. Note that
although you can specify updates here, these will NOT be part of any JTA transaction!public void setConcurrentConnectionValidation(boolean value)
value - public boolean getConcurrentConnectionValidation()
public int poolAvailableSize()
public int poolTotalSize()
public PrintWriter getLogWriter() throws SQLException
getLogWriter in interface CommonDataSourceSQLExceptionpublic int getLoginTimeout()
throws SQLException
getLoginTimeout in interface CommonDataSourceSQLExceptionpublic void setLogWriter(PrintWriter out) throws SQLException
setLogWriter in interface CommonDataSourceSQLExceptionpublic void setLoginTimeout(int seconds)
throws SQLException
setLoginTimeout in interface CommonDataSourceSQLExceptionpublic void init()
throws AtomikosSQLException
init in interface com.atomikos.icatch.OrderedLifecycleComponentAtomikosSQLExceptionpublic void close()
close in interface com.atomikos.icatch.OrderedLifecycleComponentprotected abstract ConnectionFactory<Connection> doInit() throws Exception
Exceptionprotected abstract void doClose()
public Connection getConnection() throws SQLException
getConnection in interface DataSourceSQLExceptionpublic Connection getConnection(String username, String password) throws SQLException
getConnection in interface DataSourceSQLExceptionpublic String getUniqueResourceName()
getUniqueResourceName in interface ConnectionPoolPropertiespublic void setUniqueResourceName(String resourceName)
resourceName - An arbitrary user-specified value that identifies
this datasource. It must be unique for recovery purposes.public boolean getLocalTransactionMode()
getLocalTransactionMode in interface ConnectionPoolPropertiespublic Reference getReference() throws NamingException
getReference in interface ReferenceableNamingExceptionpublic void setDefaultIsolationLevel(int defaultIsolationLevel)
defaultIsolationLevel - The default isolation level.
Negative values are ignored and result in vendor-specific JDBC driver or DBMS internal defaults.public int getDefaultIsolationLevel()
getDefaultIsolationLevel in interface ConnectionPoolPropertiespublic boolean isWrapperFor(Class<?> iface)
isWrapperFor in interface Wrapperprotected abstract boolean isAssignableFromWrappedVendorClass(Class<?> iface)
public <T> T unwrap(Class<T> iface) throws SQLException
unwrap in interface WrapperSQLExceptionprotected abstract Object unwrapVendorInstance()
public Logger getParentLogger() throws SQLFeatureNotSupportedException
getParentLogger in interface CommonDataSourceSQLFeatureNotSupportedExceptionpublic void refreshPool()
Copyright © 2023. All rights reserved.