Bug 50333 - IllegalArgumentException occurs when setting maxActive to smaller than 1.
Summary: IllegalArgumentException occurs when setting maxActive to smaller than 1.
Status: RESOLVED FIXED
Alias: None
Product: Tomcat Modules
Classification: Unclassified
Component: jdbc-pool (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-25 00:22 UTC by Eiji Takahashi
Modified: 2011-01-10 11:41 UTC (History)
0 users



Attachments
patch (3.88 KB, application/octet-stream)
2010-11-25 00:22 UTC, Eiji Takahashi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eiji Takahashi 2010-11-25 00:22:29 UTC
Created attachment 26340 [details]
patch

IllegalArgumentException occurs when setting maxActive to smaller than 1.

-----
java.lang.IllegalArgumentException
        at java.util.concurrent.ArrayBlockingQueue.<init>(ArrayBlockingQueue.java:164)
        at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:365)
        at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:130)
        at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:93)
        at org.apache.tomcat.jdbc.pool.DataSourceFactory.createDataSource(DataSourceFactory.java:490)
        at org.apache.tomcat.jdbc.pool.DataSourceFactory.getObjectInstance(DataSourceFactory.java:219)
        at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:142)
        at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:826)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:145)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:814)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:159)
        at org.apache.catalina.core.NamingContextListener.addResource(NamingContextListener.java:1020)
        at org.apache.catalina.core.NamingContextListener.createNamingContext(NamingContextListener.java:631)
        at org.apache.catalina.core.NamingContextListener.lifecycleEvent(NamingContextListener.java:237)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:89)
        at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:668)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:596)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:303)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:431)
---

In DBCP, if the negative value is set to maxActive, the pool size is unlimited.
However, because ArrayBlockingQueue is used in JDBC-Pool, values that are smaller than 1 cannot be set to maxActive.  

In my patch, if maxActive is smaller than 1, default value (100) is set to maxActive. 

Regards.
Comment 1 Filip Hanik 2011-01-10 11:41:53 UTC
svn r 1057268