Author: kfujino Date: Thu Sep 1 10:26:13 2011 New Revision: 1163986 URL: http://svn.apache.org/viewvc?rev=1163986&view=rev Log: Avoid IllegalArgumentException when setting maxActive less than or equal to 0. ArrayBlockingQueue doesn't allow capacity of 0 or less.
Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=1163986&r1=1163985&r2=1163986&view=diff ============================================================================== --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Thu Sep 1 10:26:13 2011 @@ -394,22 +394,6 @@ public class ConnectionPool { */ protected void init(PoolConfiguration properties) throws SQLException { poolProperties = properties; - //make space for 10 extra in case we flow over a bit - busy = new ArrayBlockingQueue<PooledConnection>(properties.getMaxActive(),false); - //busy = new FairBlockingQueue<PooledConnection>(); - //make space for 10 extra in case we flow over a bit - if (properties.isFairQueue()) { - idle = new FairBlockingQueue<PooledConnection>(); - //idle = new MultiLockFairBlockingQueue<PooledConnection>(); - } else { - idle = new ArrayBlockingQueue<PooledConnection>(properties.getMaxActive(),properties.isFairQueue()); - } - - //if the evictor thread is supposed to run, start it now - if (properties.isPoolSweeperEnabled()) { - poolCleaner = new PoolCleaner("[Pool-Cleaner]:" + properties.getName(), this, properties.getTimeBetweenEvictionRunsMillis()); - poolCleaner.start(); - } //end if //make sure the pool is properly configured if (properties.getMaxActive()<1) { @@ -432,6 +416,23 @@ public class ConnectionPool { log.warn("maxIdle is smaller than minIdle, setting maxIdle to: "+properties.getMinIdle()); properties.setMaxIdle(properties.getMinIdle()); } + + //make space for 10 extra in case we flow over a bit + busy = new ArrayBlockingQueue<PooledConnection>(properties.getMaxActive(),false); + //busy = new FairBlockingQueue<PooledConnection>(); + //make space for 10 extra in case we flow over a bit + if (properties.isFairQueue()) { + idle = new FairBlockingQueue<PooledConnection>(); + //idle = new MultiLockFairBlockingQueue<PooledConnection>(); + } else { + idle = new ArrayBlockingQueue<PooledConnection>(properties.getMaxActive(),properties.isFairQueue()); + } + + //if the evictor thread is supposed to run, start it now + if (properties.isPoolSweeperEnabled()) { + poolCleaner = new PoolCleaner("[Pool-Cleaner]:" + properties.getName(), this, properties.getTimeBetweenEvictionRunsMillis()); + poolCleaner.start(); + } //end if //create JMX MBean if (this.getPoolProperties().isJmxEnabled()) createMBean(); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org