|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.ibatis.datasource.pooled.PooledDataSource
public class PooledDataSource
This is a simple, synchronous, thread-safe database connection pool.
Field Summary | |
---|---|
protected int |
poolMaximumActiveConnections
|
protected int |
poolMaximumCheckoutTime
|
protected int |
poolMaximumIdleConnections
|
protected int |
poolPingConnectionsNotUsedFor
|
protected boolean |
poolPingEnabled
|
protected String |
poolPingQuery
|
protected int |
poolTimeToWait
|
Constructor Summary | |
---|---|
PooledDataSource()
|
|
PooledDataSource(ClassLoader driverClassLoader,
String driver,
String url,
Properties driverProperties)
|
|
PooledDataSource(ClassLoader driverClassLoader,
String driver,
String url,
String username,
String password)
|
|
PooledDataSource(String driver,
String url,
Properties driverProperties)
|
|
PooledDataSource(String driver,
String url,
String username,
String password)
|
Method Summary | ||
---|---|---|
protected void |
finalize()
|
|
void |
forceCloseAll()
Closes all active and idle connections in the pool |
|
Connection |
getConnection()
|
|
Connection |
getConnection(String username,
String password)
|
|
Integer |
getDefaultTransactionIsolationLevel()
|
|
String |
getDriver()
|
|
Properties |
getDriverProperties()
|
|
int |
getLoginTimeout()
|
|
PrintWriter |
getLogWriter()
|
|
String |
getPassword()
|
|
int |
getPoolMaximumActiveConnections()
|
|
int |
getPoolMaximumCheckoutTime()
|
|
int |
getPoolMaximumIdleConnections()
|
|
int |
getPoolPingConnectionsNotUsedFor()
|
|
String |
getPoolPingQuery()
|
|
PoolState |
getPoolState()
|
|
int |
getPoolTimeToWait()
|
|
String |
getUrl()
|
|
String |
getUsername()
|
|
boolean |
isAutoCommit()
|
|
boolean |
isPoolPingEnabled()
|
|
boolean |
isWrapperFor(Class<?> iface)
|
|
protected boolean |
pingConnection(org.apache.ibatis.datasource.pooled.PooledConnection conn)
Method to check to see if a connection is still usable |
|
protected void |
pushConnection(org.apache.ibatis.datasource.pooled.PooledConnection conn)
|
|
void |
setDefaultAutoCommit(boolean defaultAutoCommit)
|
|
void |
setDefaultTransactionIsolationLevel(Integer defaultTransactionIsolationLevel)
|
|
void |
setDriver(String driver)
|
|
void |
setDriverProperties(Properties driverProps)
|
|
void |
setLoginTimeout(int loginTimeout)
|
|
void |
setLogWriter(PrintWriter logWriter)
|
|
void |
setPassword(String password)
|
|
void |
setPoolMaximumActiveConnections(int poolMaximumActiveConnections)
The maximum number of active connections |
|
void |
setPoolMaximumCheckoutTime(int poolMaximumCheckoutTime)
The maximum time a connection can be used before it *may* be given away again. |
|
void |
setPoolMaximumIdleConnections(int poolMaximumIdleConnections)
The maximum number of idle connections |
|
void |
setPoolPingConnectionsNotUsedFor(int milliseconds)
If a connection has not been used in this many milliseconds, ping the database to make sure the connection is still good. |
|
void |
setPoolPingEnabled(boolean poolPingEnabled)
Determines if the ping query should be used. |
|
void |
setPoolPingQuery(String poolPingQuery)
The query to be used to check a connection |
|
void |
setPoolTimeToWait(int poolTimeToWait)
The time to wait before retrying to get a connection |
|
void |
setUrl(String url)
|
|
void |
setUsername(String username)
|
|
|
unwrap(Class<T> iface)
|
|
static Connection |
unwrapConnection(Connection conn)
Unwraps a pooled connection to get to the 'real' connection |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int poolMaximumActiveConnections
protected int poolMaximumIdleConnections
protected int poolMaximumCheckoutTime
protected int poolTimeToWait
protected String poolPingQuery
protected boolean poolPingEnabled
protected int poolPingConnectionsNotUsedFor
Constructor Detail |
---|
public PooledDataSource()
public PooledDataSource(String driver, String url, String username, String password)
public PooledDataSource(String driver, String url, Properties driverProperties)
public PooledDataSource(ClassLoader driverClassLoader, String driver, String url, String username, String password)
public PooledDataSource(ClassLoader driverClassLoader, String driver, String url, Properties driverProperties)
Method Detail |
---|
public Connection getConnection() throws SQLException
getConnection
in interface DataSource
SQLException
public Connection getConnection(String username, String password) throws SQLException
getConnection
in interface DataSource
SQLException
public void setLoginTimeout(int loginTimeout) throws SQLException
setLoginTimeout
in interface CommonDataSource
SQLException
public int getLoginTimeout() throws SQLException
getLoginTimeout
in interface CommonDataSource
SQLException
public void setLogWriter(PrintWriter logWriter) throws SQLException
setLogWriter
in interface CommonDataSource
SQLException
public PrintWriter getLogWriter() throws SQLException
getLogWriter
in interface CommonDataSource
SQLException
public void setDriver(String driver)
public void setUrl(String url)
public void setUsername(String username)
public void setPassword(String password)
public void setDefaultAutoCommit(boolean defaultAutoCommit)
public void setDefaultTransactionIsolationLevel(Integer defaultTransactionIsolationLevel)
public void setDriverProperties(Properties driverProps)
public void setPoolMaximumActiveConnections(int poolMaximumActiveConnections)
poolMaximumActiveConnections
- The maximum number of active connectionspublic void setPoolMaximumIdleConnections(int poolMaximumIdleConnections)
poolMaximumIdleConnections
- The maximum number of idle connectionspublic void setPoolMaximumCheckoutTime(int poolMaximumCheckoutTime)
poolMaximumCheckoutTime
- The maximum timepublic void setPoolTimeToWait(int poolTimeToWait)
poolTimeToWait
- The time to waitpublic void setPoolPingQuery(String poolPingQuery)
poolPingQuery
- The querypublic void setPoolPingEnabled(boolean poolPingEnabled)
poolPingEnabled
- True if we need to check a connection before using itpublic void setPoolPingConnectionsNotUsedFor(int milliseconds)
milliseconds
- the number of milliseconds of inactivity that will trigger a pingpublic String getDriver()
public String getUrl()
public String getUsername()
public String getPassword()
public boolean isAutoCommit()
public Integer getDefaultTransactionIsolationLevel()
public Properties getDriverProperties()
public int getPoolMaximumActiveConnections()
public int getPoolMaximumIdleConnections()
public int getPoolMaximumCheckoutTime()
public int getPoolTimeToWait()
public String getPoolPingQuery()
public boolean isPoolPingEnabled()
public int getPoolPingConnectionsNotUsedFor()
public void forceCloseAll()
public PoolState getPoolState()
protected void pushConnection(org.apache.ibatis.datasource.pooled.PooledConnection conn) throws SQLException
SQLException
protected boolean pingConnection(org.apache.ibatis.datasource.pooled.PooledConnection conn)
conn
- - the connection to check
public static Connection unwrapConnection(Connection conn)
conn
- - the pooled connection to unwrap
protected void finalize() throws Throwable
finalize
in class Object
Throwable
public <T> T unwrap(Class<T> iface) throws SQLException
unwrap
in interface Wrapper
SQLException
public boolean isWrapperFor(Class<?> iface) throws SQLException
isWrapperFor
in interface Wrapper
SQLException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |