From 7d1f0c72b592f062b44349710ae500513b310676 Mon Sep 17 00:00:00 2001 From: Brett Wooldridge Date: Fri, 5 Dec 2014 15:23:22 +0900 Subject: [PATCH] Mainly doc fixup and method reordering. --- .../zaxxer/hikari/pool/BaseHikariPool.java | 40 +++++++++++++------ 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/hikaricp-common/src/main/java/com/zaxxer/hikari/pool/BaseHikariPool.java b/hikaricp-common/src/main/java/com/zaxxer/hikari/pool/BaseHikariPool.java index e8aef4a7..745dccc2 100644 --- a/hikaricp-common/src/main/java/com/zaxxer/hikari/pool/BaseHikariPool.java +++ b/hikaricp-common/src/main/java/com/zaxxer/hikari/pool/BaseHikariPool.java @@ -109,7 +109,8 @@ public abstract class BaseHikariPool implements HikariPoolMBean, IBagStateListen } /** - * Construct a HikariPool with the specified configuration. + * Construct a HikariPool with the specified configuration. We cache lots of configuration + * items in class-local final members for speed. * * @param configuration a HikariConfig instance * @param username authentication username @@ -206,13 +207,12 @@ public abstract class BaseHikariPool implements HikariPoolMBean, IBagStateListen * Release a connection back to the pool, or permanently close it if it is broken. * * @param bagEntry the PoolBagEntry to release back to the pool - * @param isBroken true if the connection was detected as broken */ - public final void releaseConnection(final PoolBagEntry bagEntry, final boolean isBroken) + public final void releaseConnection(final PoolBagEntry bagEntry) { metricsTracker.recordConnectionUsage(bagEntry); - if (isBroken || bagEntry.evicted) { + if (bagEntry.evicted) { LOGGER.debug("Connection returned to pool {} is broken or evicted. Closing connection.", configuration.getPoolName()); closeConnection(bagEntry); } @@ -350,15 +350,6 @@ public abstract class BaseHikariPool implements HikariPoolMBean, IBagStateListen // Protected methods // *********************************************************************** - /** - * Permanently close the real (underlying) connection (eat any exception). - * - * @param connectionProxy the connection to actually close - */ - protected abstract void closeConnection(final PoolBagEntry bagEntry); - - protected abstract ConcurrentBag createConcurrentBag(IBagStateListener listener); - /** * Create and add a single connection to the pool. */ @@ -403,6 +394,17 @@ public abstract class BaseHikariPool implements HikariPoolMBean, IBagStateListen } } + // *********************************************************************** + // Abstract methods + // *********************************************************************** + + /** + * Permanently close the real (underlying) connection (eat any exception). + * + * @param connectionProxy the connection to actually close + */ + protected abstract void closeConnection(final PoolBagEntry bagEntry); + /** * Check whether the connection is alive or not. * @@ -418,7 +420,19 @@ public abstract class BaseHikariPool implements HikariPoolMBean, IBagStateListen * @throws InterruptedException */ protected abstract void abortActiveConnections() throws InterruptedException; + + /** + * Create the JVM version-specific ConcurrentBag instance used by the pool. + * + * @param listener the IBagStateListener instance + * @return a ConcurrentBag instance + */ + protected abstract ConcurrentBag createConcurrentBag(IBagStateListener listener); + /** + * Create the JVM version-specific Housekeeping runnable instance used by the pool. + * @return the HouseKeeper instance + */ protected abstract Runnable getHouseKeeper(); // ***********************************************************************