|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.atomikos.jdbc.AbstractDataSourceBean
public abstract class AbstractDataSourceBean
Abstract data source bean with generic functionality.
| Constructor Summary | |
|---|---|
AbstractDataSourceBean()
|
|
| Method Summary | ||
|---|---|---|
void |
close()
|
|
protected abstract void |
doClose()
|
|
protected abstract ConnectionFactory |
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. |
|
Connection |
getConnection()
|
|
Connection |
getConnection(HeuristicMessage msg)
Get a connection to the datasource for the given description of the work. |
|
Connection |
getConnection(String msg)
Get a connection to the datasource for the given description of the work. |
|
Connection |
getConnection(String username,
String password)
|
|
Connection |
getConnection(String user,
String passwd,
HeuristicMessage msg)
Get a connection to the datasource for the given description of the work. |
|
Connection |
getConnection(String user,
String passwd,
String msg)
Get a connection to the datasource for the given description of the work. |
|
int |
getDefaultIsolationLevel()
Gets the default isolation level for connections created by this datasource. |
|
boolean |
getLocalTransactionMode()
Tests whether local transactions are allowed - defaults to true 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. |
|
int |
getReapTimeout()
Get the amount of time in seconds the connection pool will allow a connection to be borrowed before claiming it back. |
|
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 |
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 |
setReapTimeout(int reapTimeout)
Sets the amount of time (in seconds) that the connection pool will allow a connection to be in use, before claiming it back. |
|
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)
|
|
protected void |
throwAtomikosSQLException(String msg,
Throwable cause)
|
|
|
unwrap(Class<T> iface)
|
|
protected abstract Object |
unwrapVendorInstance()
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractDataSourceBean()
| Method Detail |
|---|
protected void throwAtomikosSQLException(String msg)
throws AtomikosSQLException
AtomikosSQLException
protected void throwAtomikosSQLException(String msg,
Throwable cause)
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 int getReapTimeout()
getReapTimeout in interface ConnectionPoolPropertiespublic void setReapTimeout(int reapTimeout)
reapTimeout - The timeout in seconds. Zero means unlimited. Note that this value is
only an indication; the pool will check regularly as indicated by the maintenanceInteval property.
Default is 0 (no timeout).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 int poolAvailableSize()
public int poolTotalSize()
public PrintWriter getLogWriter()
throws SQLException
getLogWriter in interface CommonDataSourceSQLException
public int getLoginTimeout()
throws SQLException
getLoginTimeout in interface CommonDataSourceSQLException
public void setLogWriter(PrintWriter out)
throws SQLException
setLogWriter in interface CommonDataSourceSQLException
public void setLoginTimeout(int seconds)
throws SQLException
setLoginTimeout in interface CommonDataSourceSQLException
public void init()
throws AtomikosSQLException
AtomikosSQLExceptionpublic void close()
protected abstract ConnectionFactory doInit()
throws Exception
Exceptionprotected abstract void doClose()
public Connection getConnection(HeuristicMessage msg)
throws SQLException
HeuristicDataSource
getConnection in interface HeuristicDataSourcemsg - The heuristic message that best describes the work about to be
done.
SQLException - On error.
public 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 ConnectionPoolProperties
public Reference getReference()
throws NamingException
getReference in interface ReferenceableNamingException
public Connection getConnection()
throws SQLException
getConnection in interface DataSourceSQLException
public Connection getConnection(String msg)
throws SQLException
HeuristicDataSource
getConnection in interface HeuristicDataSourcemsg - The heuristic message that best describes the work about to be
done.
SQLException - On error.
public Connection getConnection(String user,
String passwd,
String msg)
throws SQLException
HeuristicDataSource
getConnection in interface HeuristicDataSourceuser - The user name to use.passwd - The password.msg - The heuristic message that best describes the work about to be
done.
SQLException - On error.
public Connection getConnection(String user,
String passwd,
HeuristicMessage msg)
throws SQLException
HeuristicDataSource
getConnection in interface HeuristicDataSourceuser - The user name to use.passwd - The password.msg - The heuristic message that best describes the work about to be
done.
SQLException - On error.public 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
SQLFeatureNotSupportedExceptionpublic void refreshPool()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||