|
JavaXT
|
|
ConnectionPool ClassA lightweight, high-performance JDBC connection pool manager with health monitoring, validation caching, and lock-free concurrent connection management.
Constructors ConnectionPool( ConnectionPoolDataSource dataSource, int maxConnections, Integer timeout )
Public MethodsgetConnection( ) returns Connection Retrieves a connection from the connection pool. If all the connections are in use, the method waits until a connection becomes available or timeout seconds elapsed. When the application is finished using the connection, it must be closed in order to return it to the pool.getActiveConnections( ) returns int Returns the number of active (open) connections of this pool. This is the number of getInactiveConnections( ) returns int Returns the number of inactive (unused) connections in this pool. This is the number of internally kept recycled connections, for which getMaxConnections( ) returns int Returns the configured maximum number of connections in the pool. getConnectionPoolDataSource( ) returns ConnectionPoolDataSource Returns the ConnectionPoolDataSource backing this connection pool. getTimeout( ) returns int Returns the maximum time to wait for a free connection, in seconds. getConnectionIdleTimeout( ) returns int Returns the connection idle timeout in seconds. Connections that remain unused in the pool for more than the idle timeout are automatically removed. This prevents accumulation of stale connections that may have been closed by the database server. Note that this only affects connections sitting idle in the pool, not active connections being used by your application. getValidationQuery( ) returns String Returns the validation query used to periodically test connections in the pool. getValidationTimeout( ) returns int Returns the interval used to execute validation queries in seconds. close( ) returns void Closes all unused pooled connections and shuts down the connection pool. After calling this method, clients can no longer get new connections via getConnection(). forceHealthCheck( ) returns void Synchronously runs a single health-check pass. In normal operation the same health-check runs on a background scheduler every 30 seconds. Safe to call at any time. getPoolStatistics( ) returns PoolStatistics Returns current pool statistics for monitoring. Public Classes |
|