Author: kfujino Date: Wed Jul 20 06:18:41 2016 New Revision: 1753452 URL: http://svn.apache.org/viewvc?rev=1753452&view=rev Log: In order to avoid the unintended skip of PoolCleaner, remove the check code of the execution interval in the task that has been scheduled.
Modified: tomcat/tc8.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml Modified: tomcat/tc8.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=1753452&r1=1753451&r2=1753452&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java (original) +++ tomcat/tc8.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Wed Jul 20 06:18:41 2016 @@ -1286,7 +1286,7 @@ public class ConnectionPool { Thread.currentThread().setContextClassLoader(loader); } } - poolCleanTimer.scheduleAtFixedRate(cleaner, cleaner.sleepTime,cleaner.sleepTime); + poolCleanTimer.schedule(cleaner, cleaner.sleepTime,cleaner.sleepTime); } private static synchronized void unregisterCleaner(PoolCleaner cleaner) { @@ -1326,7 +1326,6 @@ public class ConnectionPool { protected static class PoolCleaner extends TimerTask { protected WeakReference<ConnectionPool> pool; protected long sleepTime; - protected volatile long lastRun = 0; PoolCleaner(ConnectionPool pool, long sleepTime) { this.pool = new WeakReference<>(pool); @@ -1344,9 +1343,7 @@ public class ConnectionPool { ConnectionPool pool = this.pool.get(); if (pool == null) { stopRunning(); - } else if (!pool.isClosed() && - (System.currentTimeMillis() - lastRun) > sleepTime) { - lastRun = System.currentTimeMillis(); + } else if (!pool.isClosed()) { try { if (pool.getPoolProperties().isRemoveAbandoned()) pool.checkAbandoned(); Modified: tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml?rev=1753452&r1=1753451&r2=1753452&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml Wed Jul 20 06:18:41 2016 @@ -180,6 +180,11 @@ Ensure that do not remove the abandoned connection that has been already released. (kfujino) </fix> + <fix> + In order to avoid the unintended skip of <code>PoolCleaner</code>, + remove the check code of the execution interval in the task that has + been scheduled. (kfujino) + </fix> </changelog> </subsection> <subsection name="Other"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org