commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1102217 - in /commons/proper/dbcp/trunk/src: java/org/apache/commons/dbcp2/ java/org/apache/commons/dbcp2/cpdsadapter/ java/org/apache/commons/dbcp2/datasources/ test/org/apache/commons/dbcp2/
Date Thu, 12 May 2011 09:45:12 GMT
Author: markt
Date: Thu May 12 09:45:12 2011
New Revision: 1102217

URL: http://svn.apache.org/viewvc?rev=1102217&view=rev
Log:
Sync for pool2 changes to use WhenExhaustedAction Enum

Modified:
    commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/BasicDataSource.java
    commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/cpdsadapter/DriverAdapterCPDS.java
    commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSource.java
    commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestAbandonedObjectPool.java
    commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestDriverManagerConnectionFactory.java
    commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestPoolingDriver.java

Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/BasicDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/BasicDataSource.java?rev=1102217&r1=1102216&r2=1102217&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/BasicDataSource.java (original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/BasicDataSource.java Thu May
12 09:45:12 2011
@@ -34,6 +34,7 @@ import org.apache.commons.pool2.KeyedObj
 import org.apache.commons.pool2.impl.GenericKeyedObjectPool;
 import org.apache.commons.pool2.impl.GenericKeyedObjectPoolFactory;
 import org.apache.commons.pool2.impl.GenericObjectPool;
+import org.apache.commons.pool2.impl.WhenExhaustedAction;
 
 
 /**
@@ -1533,7 +1534,7 @@ public class BasicDataSource implements 
             if (isPoolPreparedStatements()) {
                 statementPoolFactory = new GenericKeyedObjectPoolFactory(null,
                             -1, // unlimited maxActive (per key)
-                            GenericKeyedObjectPool.WHEN_EXHAUSTED_FAIL,
+                            WhenExhaustedAction.FAIL,
                             0, // maxWait
                             1, // maxIdle (per key)
                             maxOpenPreparedStatements);

Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/cpdsadapter/DriverAdapterCPDS.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/cpdsadapter/DriverAdapterCPDS.java?rev=1102217&r1=1102216&r2=1102217&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/cpdsadapter/DriverAdapterCPDS.java
(original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/cpdsadapter/DriverAdapterCPDS.java
Thu May 12 09:45:12 2011
@@ -36,6 +36,7 @@ import javax.naming.NamingException;
 
 import org.apache.commons.pool2.KeyedObjectPool;
 import org.apache.commons.pool2.impl.GenericKeyedObjectPool;
+import org.apache.commons.pool2.impl.WhenExhaustedAction;
 
 /**
  * <p>
@@ -176,7 +177,7 @@ public class DriverAdapterCPDS
                 // since there is no limit, create a prepared statement pool with an eviction
thread
                 //  evictor settings are the same as the connection pool settings.
                 stmtPool = new GenericKeyedObjectPool(null,
-                    getMaxActive(), GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW, 0,
+                    getMaxActive(), WhenExhaustedAction.GROW, 0,
                     getMaxIdle(), false, false,
                     getTimeBetweenEvictionRunsMillis(),getNumTestsPerEvictionRun(),getMinEvictableIdleTimeMillis(),
                     false);
@@ -187,7 +188,7 @@ public class DriverAdapterCPDS
                 //  pool has LRU functionality so when the limit is reached, 15% of the pool
is cleared.
                 // see org.apache.commons.pool2.impl.GenericKeyedObjectPool.clearOldest method
                 stmtPool = new GenericKeyedObjectPool(null,
-                    getMaxActive(), GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW, 0,
+                    getMaxActive(), WhenExhaustedAction.GROW, 0,
                     getMaxIdle(), getMaxPreparedStatements(), false, false,
                     -1,0,0, // -1 tells the pool that there should be no eviction thread.
                     false);

Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSource.java?rev=1102217&r1=1102216&r2=1102217&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSource.java
(original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSource.java
Thu May 12 09:45:12 2011
@@ -36,6 +36,7 @@ import javax.sql.PooledConnection;
 
 import org.apache.commons.dbcp2.SQLNestedException;
 import org.apache.commons.pool2.impl.GenericObjectPool;
+import org.apache.commons.pool2.impl.WhenExhaustedAction;
 
 /**
  * <p>The base class for <code>SharedPoolDataSource</code> and 
@@ -861,12 +862,13 @@ public abstract class InstanceKeyDataSou
         return cpds;
     }
 
-    protected byte whenExhaustedAction(int maxActive, int maxWait) {
-        byte whenExhausted = GenericObjectPool.WHEN_EXHAUSTED_BLOCK;
+    protected WhenExhaustedAction whenExhaustedAction(int maxActive,
+            int maxWait) {
+        WhenExhaustedAction whenExhausted = WhenExhaustedAction.BLOCK;
         if (maxActive <= 0) {
-            whenExhausted = GenericObjectPool.WHEN_EXHAUSTED_GROW;
+            whenExhausted = WhenExhaustedAction.GROW;
         } else if (maxWait == 0) {
-            whenExhausted = GenericObjectPool.WHEN_EXHAUSTED_FAIL;
+            whenExhausted = WhenExhaustedAction.FAIL;
         }
         return whenExhausted;
     }    

Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestAbandonedObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestAbandonedObjectPool.java?rev=1102217&r1=1102216&r2=1102217&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestAbandonedObjectPool.java
(original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestAbandonedObjectPool.java
Thu May 12 09:45:12 2011
@@ -24,6 +24,7 @@ import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
 import org.apache.commons.pool2.PoolableObjectFactory;
+import org.apache.commons.pool2.impl.WhenExhaustedAction;
 
 /**
  * TestCase for AbandonedObjectPool
@@ -71,7 +72,7 @@ public class TestAbandonedObjectPool ext
         final int POOL_SIZE = 30;
         pool.setMaxActive(POOL_SIZE);
         pool.setMaxIdle(POOL_SIZE);
-        pool.setWhenExhaustedAction(AbandonedObjectPool.WHEN_EXHAUSTED_FAIL);
+        pool.setWhenExhaustedAction(WhenExhaustedAction.FAIL);
 
         // Exhaust the connection pool
         Vector vec = new Vector();

Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestDriverManagerConnectionFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestDriverManagerConnectionFactory.java?rev=1102217&r1=1102216&r2=1102217&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestDriverManagerConnectionFactory.java
(original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestDriverManagerConnectionFactory.java
Thu May 12 09:45:12 2011
@@ -22,6 +22,7 @@ import java.sql.Connection;
 import javax.sql.DataSource;
 
 import org.apache.commons.pool2.impl.GenericObjectPool;
+import org.apache.commons.pool2.impl.WhenExhaustedAction;
 
 import junit.framework.Test;
 import junit.framework.TestCase;
@@ -48,7 +49,7 @@ public class TestDriverManagerConnection
         System.setProperty("jdbc.drivers",
                 "org.apache.commons.dbcp2.TesterDriver");
         GenericObjectPool connectionPool = new GenericObjectPool(null, 10,
-                GenericObjectPool.WHEN_EXHAUSTED_BLOCK, -1, 0);
+                WhenExhaustedAction.BLOCK, -1, 0);
         final ConnectionFactory connectionFactory =
             new DriverManagerConnectionFactory(
                     "jdbc:apache:commons:testdriver",

Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestPoolingDriver.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestPoolingDriver.java?rev=1102217&r1=1102216&r2=1102217&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestPoolingDriver.java (original)
+++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestPoolingDriver.java Thu
May 12 09:45:12 2011
@@ -31,6 +31,7 @@ import org.apache.commons.pool2.ObjectPo
 import org.apache.commons.pool2.impl.GenericKeyedObjectPool;
 import org.apache.commons.pool2.impl.GenericKeyedObjectPoolFactory;
 import org.apache.commons.pool2.impl.GenericObjectPool;
+import org.apache.commons.pool2.impl.WhenExhaustedAction;
 
 /**
  * Tests for a  {@link GenericObjectPool} based {@link PoolingDriver}.
@@ -57,9 +58,9 @@ public class TestPoolingDriver extends T
     @Override
     public void setUp() throws Exception {
         super.setUp();
-        GenericObjectPool pool = new GenericObjectPool(null, getMaxActive(), GenericObjectPool.WHEN_EXHAUSTED_BLOCK,
getMaxWait(), 10, true, true, 10000L, 5, 5000L, true);
+        GenericObjectPool pool = new GenericObjectPool(null, getMaxActive(), WhenExhaustedAction.BLOCK,
getMaxWait(), 10, true, true, 10000L, 5, 5000L, true);
         DriverConnectionFactory cf = new DriverConnectionFactory(new TesterDriver(),"jdbc:apache:commons:testdriver",null);
-        GenericKeyedObjectPoolFactory opf = new GenericKeyedObjectPoolFactory(null, 10, GenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK,
2000L, 10, true, true, 10000L, 5, 5000L, true);
+        GenericKeyedObjectPoolFactory opf = new GenericKeyedObjectPoolFactory(null, 10, WhenExhaustedAction.BLOCK,
2000L, 10, true, true, 10000L, 5, 5000L, true);
         PoolableConnectionFactory pcf = new PoolableConnectionFactory(cf, pool, opf, "SELECT
COUNT(*) FROM DUAL", false, true);
         assertNotNull(pcf);
         driver = new PoolingDriver();
@@ -114,7 +115,7 @@ public class TestPoolingDriver extends T
         ObjectPool connectionPool = new GenericObjectPool(
             null,
             70,
-            GenericObjectPool.WHEN_EXHAUSTED_BLOCK,
+            WhenExhaustedAction.BLOCK,
             60000,
             10);
         ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(



Mime
View raw message