https://issues.apache.org/bugzilla/show_bug.cgi?id=50333
authorfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 10 Jan 2011 16:41:43 +0000 (16:41 +0000)
committerfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 10 Jan 2011 16:41:43 +0000 (16:41 +0000)
dont allow 0 or negative max active values

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1057268 13f79535-47bb-0310-9956-ffa450edef68

modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/PoolProperties.java

index 63bf0b7..1622c79 100644 (file)
@@ -402,6 +402,10 @@ public class ConnectionPool {
         } //end if
 
         //make sure the pool is properly configured
+        if (properties.getMaxActive()<1) {
+            log.warn("maxActive is smaller than 1, setting maxActive to: "+PoolProperties.DEFAULT_MAX_ACTIVE);
+            properties.setMaxActive(PoolProperties.DEFAULT_MAX_ACTIVE);
+        }
         if (properties.getMaxActive()<properties.getInitialSize()) {
             log.warn("initialSize is larger than maxActive, setting initialSize to: "+properties.getMaxActive());
             properties.setInitialSize(properties.getMaxActive());
index 70b7125..6fd20d4 100644 (file)
@@ -36,6 +36,8 @@ import org.apache.juli.logging.LogFactory;
 public class PoolProperties implements PoolConfiguration {
     private static final Log log = LogFactory.getLog(PoolProperties.class);
     
+    public static final int DEFAULT_MAX_ACTIVE = 100;
+    
     protected static AtomicInteger poolCounter = new AtomicInteger(0);
     protected Properties dbProperties = new Properties();
     protected String url = null;
@@ -46,7 +48,7 @@ public class PoolProperties implements PoolConfiguration {
     protected String defaultCatalog = null;
     protected String connectionProperties;
     protected int initialSize = 10;
-    protected int maxActive = 100;
+    protected int maxActive = DEFAULT_MAX_ACTIVE;
     protected int maxIdle = maxActive;
     protected int minIdle = initialSize;
     protected int maxWait = 30000;