|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectsnaq.util.ObjectPool<CacheConnection>
snaq.db.ConnectionPool
public class ConnectionPool
Implementation of a database connection pool.
CacheConnection,
CachedCallableStatement,
CachedPreparedStatement| Constructor Summary | |
|---|---|
ConnectionPool(String name,
int minPool,
int maxPool,
int maxSize,
long idleTimeout,
String url,
Properties props)
Creates a new ConnectionPool instance. |
|
ConnectionPool(String name,
int minPool,
int maxPool,
int maxSize,
long idleTimeout,
String url,
String username,
String password)
Creates a new ConnectionPool instance. |
|
ConnectionPool(String name,
int maxPool,
int maxSize,
long idleTimeout,
String url,
Properties props)
Creates a new ConnectionPool instance (with minPool=0). |
|
ConnectionPool(String name,
int maxPool,
int maxSize,
long idleTimeout,
String url,
String username,
String password)
Creates a new ConnectionPool instance (with minPool=0). |
|
| Method Summary | |
|---|---|
void |
addConnectionPoolListener(ConnectionPoolListener listener)
Adds a ConnectionPoolListener to the event notification list. |
Connection |
getConnection()
Gets a Connection from the pool. |
Connection |
getConnection(long timeout)
Gets a Connection from the pool. |
PasswordDecoder |
getPasswordDecoder()
Returns the current PasswordDecoder class. |
int |
getPoolSize()
Deprecated. Use ObjectPool.getMaxPool() instead. |
ConnectionValidator |
getValidator()
Returns the current ConnectionValidator class. |
boolean |
isCachingCallableStatements()
Returns whether the pool caches CallableStatement instances for each connection. |
boolean |
isCachingPreparedStatements()
Returns whether the pool caches PreparedStatement instances for each connection. |
boolean |
isCachingStatements()
Returns whether the pool caches Statement instances for each connection. |
boolean |
isRecycleAfterDelegateUse()
Returns whether connections may be recycled if the underlying raw/delegate connection has been used. |
void |
registerMBean()
Registers this pool with the platform MBean server. |
void |
removeConnectionPoolListener(ConnectionPoolListener listener)
Removes a ConnectionPoolListener from the event notification list. |
void |
setCaching(boolean b)
Determines whether to perform statement caching. |
void |
setCaching(boolean ss,
boolean ps,
boolean cs)
Determines whether to perform statement caching. |
void |
setPasswordDecoder(PasswordDecoder pd)
Sets the PasswordDecoder class. |
void |
setRecycleAfterDelegateUse(boolean b)
Sets whether the connection may be recycled if the underlying raw/delegate connection has been used (default: false). |
void |
setValidator(ConnectionValidator cv)
Sets the validator class for Connection instances. |
void |
unregisterMBean()
Removes this pool from the platform MBean server registration list. |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ConnectionPool(String name,
int minPool,
int maxPool,
int maxSize,
long idleTimeout,
String url,
String username,
String password)
ConnectionPool instance.
name - pool nameminPool - minimum number of pooled connections, or 0 for nonemaxPool - maximum number of pooled connections, or 0 for nonemaxSize - maximum number of possible connections, or 0 for no limitidleTimeout - idle timeout (seconds) for idle pooled connections, or 0 for no timeouturl - JDBC connection URLusername - database usernamepassword - password for the database username supplied
public ConnectionPool(String name,
int maxPool,
int maxSize,
long idleTimeout,
String url,
String username,
String password)
ConnectionPool instance (with minPool=0).
name - pool namemaxPool - maximum number of pooled connections, or 0 for nonemaxSize - maximum number of possible connections, or 0 for no limitidleTimeout - idle timeout (seconds) for idle pooled connections, or 0 for no timeouturl - JDBC connection URLusername - database usernamepassword - password for the database username supplied
public ConnectionPool(String name,
int minPool,
int maxPool,
int maxSize,
long idleTimeout,
String url,
Properties props)
ConnectionPool instance.
name - pool nameminPool - minimum number of pooled connections, or 0 for nonemaxPool - maximum number of pooled connections, or 0 for nonemaxSize - maximum number of possible connections, or 0 for no limitidleTimeout - idle timeout (seconds) for idle pooled connections, or 0 for no timeouturl - JDBC connection URLprops - connection properties
public ConnectionPool(String name,
int maxPool,
int maxSize,
long idleTimeout,
String url,
Properties props)
ConnectionPool instance (with minPool=0).
name - pool namemaxPool - maximum number of pooled connections, or 0 for nonemaxSize - maximum number of possible connections, or 0 for no limitidleTimeout - idle timeout (seconds) for idle pooled connections, or 0 for no timeouturl - JDBC connection URLprops - connection properties| Method Detail |
|---|
public void registerMBean()
javax.management API.
public void unregisterMBean()
javax.management API.
@Deprecated public final int getPoolSize()
ObjectPool.getMaxPool() instead.
public void setValidator(ConnectionValidator cv)
Connection instances.
public ConnectionValidator getValidator()
ConnectionValidator class.
public void setPasswordDecoder(PasswordDecoder pd)
PasswordDecoder class.
public PasswordDecoder getPasswordDecoder()
PasswordDecoder class.
public Connection getConnection()
throws SQLException
Connection from the pool.
SQLException
public Connection getConnection(long timeout)
throws SQLException
Connection from the pool.
SQLExceptionpublic void setCaching(boolean b)
public void setCaching(boolean ss,
boolean ps,
boolean cs)
ss - whether to cache Statement objectsps - whether to cache PreparedStatement objectscs - whether to cache CallableStatement objectspublic boolean isCachingStatements()
Statement instances for each connection.
public boolean isCachingPreparedStatements()
PreparedStatement instances for each connection.
public boolean isCachingCallableStatements()
CallableStatement instances for each connection.
public final void setRecycleAfterDelegateUse(boolean b)
Each CacheConnection instance tracks whether a call to
CacheConnection.getDelegateConnection() has been made, and by default
prevents recycling of the connection if so, in order to help maintain
integrity of the pool. In certain circumstances it may be beneficial in
terms of performance to enable such recycling, provided the raw connections
are not compromised in any way, and the CacheConnection.close()
method is called on each CacheConnection instance and NOT the
raw connection.
public boolean isRecycleAfterDelegateUse()
public final void addConnectionPoolListener(ConnectionPoolListener listener)
ConnectionPoolListener to the event notification list.
public final void removeConnectionPoolListener(ConnectionPoolListener listener)
ConnectionPoolListener from the event notification list.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||