|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgoldengate.common.database.DbConnectionPool
public class DbConnectionPool
A simple standalone JDBC connection pool manager.
The public methods of this class are thread-safe. Nothe that JDBC4 is needed and isValid() must be implemented (not yet in PostGre in April 2012)
Nested Class Summary | |
---|---|
static class |
DbConnectionPool.TimeoutException
Thrown in when no free connection becomes available within timeout seconds. |
Constructor Summary | |
---|---|
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,
org.jboss.netty.util.Timer timer,
long delay)
Constructs a MiniConnectionPoolManager object with no timeout and no limit. |
Method Summary | |
---|---|
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()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DbConnectionPool(ConnectionPoolDataSource dataSource)
dataSource
- the data source for the connections.public DbConnectionPool(ConnectionPoolDataSource dataSource, org.jboss.netty.util.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.Method Detail |
---|
public void freeIdleConnections()
public int getMaxConnections()
public long getLoginTimeout()
public 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.
DbConnectionPool.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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |