|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.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 |
getMaxPoolSize()
Get the maximum pool size. |
int |
getMinPoolSize()
Gets the minimum size of the pool. |
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()
|
int |
poolAvailableSize()
|
int |
poolTotalSize()
|
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 |
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)
|
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
AtomikosSQLException
public int getMinPoolSize()
getMinPoolSize
in interface ConnectionPoolProperties
public void setMinPoolSize(int minPoolSize)
minPoolSize
- public int getMaxPoolSize()
getMaxPoolSize
in interface ConnectionPoolProperties
public void setMaxPoolSize(int maxPoolSize)
maxPoolSize
- public void setPoolSize(int poolSize)
public int getBorrowConnectionTimeout()
getBorrowConnectionTimeout
in interface ConnectionPoolProperties
public 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 ConnectionPoolProperties
public 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 ConnectionPoolProperties
public int getMaxIdleTime()
getMaxIdleTime
in interface ConnectionPoolProperties
public 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 String getTestQuery()
getTestQuery
in interface ConnectionPoolProperties
public 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 DataSource
SQLException
public int getLoginTimeout() throws SQLException
getLoginTimeout
in interface DataSource
SQLException
public void setLogWriter(PrintWriter out) throws SQLException
setLogWriter
in interface DataSource
SQLException
public void setLoginTimeout(int seconds) throws SQLException
setLoginTimeout
in interface DataSource
SQLException
public void init() throws AtomikosSQLException
AtomikosSQLException
public void close()
protected abstract ConnectionFactory doInit() throws Exception
Exception
protected abstract void doClose()
public Connection getConnection(HeuristicMessage msg) throws SQLException
HeuristicDataSource
getConnection
in interface HeuristicDataSource
msg
- 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 DataSource
SQLException
public String getUniqueResourceName()
getUniqueResourceName
in interface ConnectionPoolProperties
public 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 Referenceable
NamingException
public Connection getConnection() throws SQLException
getConnection
in interface DataSource
SQLException
public Connection getConnection(String msg) throws SQLException
HeuristicDataSource
getConnection
in interface HeuristicDataSource
msg
- 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 HeuristicDataSource
user
- 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 HeuristicDataSource
user
- 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 ConnectionPoolProperties
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |