
public class DbConnectionPool extends Object
| Constructor and Description |
|---|
DbConnectionPool(ConnectionPoolDataSource dataSource)
Constructs a MiniConnectionPoolManager object with no timeout and no
limit.
|
DbConnectionPool(ConnectionPoolDataSource dataSource,
int maxConnections)
Constructs a MiniConnectionPoolManager object with a timeout of
DbConstant.DELAYMAXCONNECTION seconds.
|
DbConnectionPool(ConnectionPoolDataSource dataSource,
int maxConnections,
int timeout)
Constructs a ConnectionPool object.
|
DbConnectionPool(ConnectionPoolDataSource dataSource,
Timer timer,
long delay)
Constructs a MiniConnectionPoolManager object with no timeout and no
limit.
|
| Modifier and Type | Method and Description |
|---|---|
void |
dispose()
Closes all unused pooled connections.
|
void |
freeIdleConnections()
Release all idle connections
|
int |
getActiveConnections()
Returns the number of active (open) connections of this pool.
|
Connection |
getConnection()
Retrieves a connection from the connection pool.
|
long |
getLoginTimeout() |
int |
getMaxConnections() |
long |
getTimeoutForceClose() |
void |
resetPoolDataSource(ConnectionPoolDataSource dataSource) |
public DbConnectionPool(ConnectionPoolDataSource dataSource)
dataSource - the data source for the connections.public DbConnectionPool(ConnectionPoolDataSource dataSource, Timer timer, long delay)
dataSource - the data source for the connections.timer - delay - in ms period of time to check existing connections
and
limit to get a new connectionpublic DbConnectionPool(ConnectionPoolDataSource dataSource, int maxConnections)
dataSource - the data source for the connections.maxConnections - the maximum number of connections. 0 means
no
limitpublic DbConnectionPool(ConnectionPoolDataSource dataSource, int maxConnections, int timeout)
dataSource - the data source for the connections.maxConnections - the maximum number of connections. 0 means
no
limittimeout - the maximum time in seconds to wait for a free
connection.public void freeIdleConnections()
public void resetPoolDataSource(ConnectionPoolDataSource dataSource)
public final int getMaxConnections()
public final long getLoginTimeout()
public final long getTimeoutForceClose()
public void dispose()
throws SQLException
SQLException - //public Connection getConnection() throws SQLException
maxConnections connections are already in
use, the method waits until a connection becomes available or
timeout seconds elapsed. When
the application is finished using the connection, it must close it in
order
to return it to the pool.TimeoutException - when no connection becomes available
within
timeout seconds.SQLException - //public int getActiveConnections()
Connection
objects that have been issued by getConnection() for which
Connection.close() has not
yet been called.Copyright © 2009–2022 Waarp. All rights reserved.