You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ps...@apache.org on 2021/04/11 22:39:57 UTC

svn commit: r1888642 - in /commons/sandbox/performance/trunk: ./ src/dbcp/ src/http/ src/java/org/apache/commons/performance/dbcp/ src/java/org/apache/commons/performance/pool/ src/pool/ src/site/apt/ src/test/org/apache/commons/performance/pool/

Author: psteitz
Date: Sun Apr 11 22:39:56 2021
New Revision: 1888642

URL: http://svn.apache.org/viewvc?rev=1888642&view=rev
Log:
Dropped support for 1.x versions of pool and dbcp.

Added:
    commons/sandbox/performance/trunk/src/http/build.properties.sample
Removed:
    commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/pool/WaiterFactory.java
Modified:
    commons/sandbox/performance/trunk/pom.xml
    commons/sandbox/performance/trunk/src/dbcp/build.properties.sample
    commons/sandbox/performance/trunk/src/dbcp/build.xml
    commons/sandbox/performance/trunk/src/dbcp/config-dbcp.xml
    commons/sandbox/performance/trunk/src/http/build.xml
    commons/sandbox/performance/trunk/src/http/config-http.xml
    commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/dbcp/DBCPClientThread.java
    commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/dbcp/DBCPSoak.java
    commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/pool/PoolClientThread.java
    commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/pool/PoolSoak.java
    commons/sandbox/performance/trunk/src/pool/build.properties.sample
    commons/sandbox/performance/trunk/src/pool/build.xml
    commons/sandbox/performance/trunk/src/site/apt/index.apt
    commons/sandbox/performance/trunk/src/test/org/apache/commons/performance/pool/PoolSoakTest.java
    commons/sandbox/performance/trunk/src/test/org/apache/commons/performance/pool/WaiterTest.java
    commons/sandbox/performance/trunk/src/test/org/apache/commons/performance/pool/config-pool.xml

Modified: commons/sandbox/performance/trunk/pom.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/performance/trunk/pom.xml?rev=1888642&r1=1888641&r2=1888642&view=diff
==============================================================================
--- commons/sandbox/performance/trunk/pom.xml (original)
+++ commons/sandbox/performance/trunk/pom.xml Sun Apr 11 22:39:56 2021
@@ -53,20 +53,10 @@
       <artifactId>commons-digester</artifactId>
       <version>2.1</version>
     </dependency>
-   <dependency>
-      <groupId>commons-dbcp</groupId>
-      <artifactId>commons-dbcp</artifactId>
-      <version>1.3</version>
-    </dependency>
-    <dependency>
-       <groupId>commons-pool</groupId>
-       <artifactId>commons-pool</artifactId>
-       <version>1.5.6</version>
-    </dependency>
     <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-math3</artifactId>
-       <version>3.2</version>
+       <version>3.6.1</version>
     </dependency>
     <dependency>
        <groupId>commons-httpclient</groupId>
@@ -76,7 +66,7 @@
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
-      <version>4.11</version>
+      <version>4.12</version>
       <scope>test</scope>
     </dependency>
     <dependency>

Modified: commons/sandbox/performance/trunk/src/dbcp/build.properties.sample
URL: http://svn.apache.org/viewvc/commons/sandbox/performance/trunk/src/dbcp/build.properties.sample?rev=1888642&r1=1888641&r2=1888642&view=diff
==============================================================================
--- commons/sandbox/performance/trunk/src/dbcp/build.properties.sample (original)
+++ commons/sandbox/performance/trunk/src/dbcp/build.properties.sample Sun Apr 11 22:39:56 2021
@@ -16,8 +16,10 @@
 # limitations under the License.
 ###############################################################################
 
+# Copied unchanged from DBCP 2.0 release tag (DBCP_2_0)
+
 # Remote maven repository (used to download dependencies not provided below)
-mavenRepo=http://repo1.maven.org/maven2
+mavenRepo=https://repo1.maven.org/maven2
 
 # Local maven repo (not needed if full paths are provided below)
 localMavenRepo=${user.home}/.m2/repository
@@ -26,12 +28,10 @@ localMavenRepo=${user.home}/.m2/reposito
 # Uncomment to use a real mysql database
 #jdbc-jar=${localMavenRepo}/mysql/mysql-connector-java/5.0.2/mysql-connector-java-5.0.2.jar
 # DBCP mocks - no real database access or latency.  Build from source using "ant mock-jar" from DBCP trunk.
-jdbc-jar=./commons-dbcp2-2.0-mocks.jar
+#jdbc-jar=./commons-dbcp2-2.0-mocks.jar
 
 
 # Replace with full path to versions of pool, dbcp jars you want to test with
-pool-jar=${localMavenRepo}/commons-pool/commons-pool/1.5.6/commons-pool-1.5.6.jar
-dbcp-jar=${localMavenRepo}/commons-dbcp/commons-dbcp/1.4/commons-dbcp-1.4.jar
 pool2-jar=${localMavenRepo}/org/apache/commons/commons-pool2/2.2/commons-pool2-2.2.jar
 dbcp2-jar=${localMavenRepo}/org/apache/commons/commons-dbcp2/2.0/commons-dbcp2-2.0.jar
 tomcat-jdbc-jar=${localMavenRepo}/org/apache/tomcat/tomcat-jdbc/8.0.3/tomcat-jdbc-8.0.3.jar

Modified: commons/sandbox/performance/trunk/src/dbcp/build.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/performance/trunk/src/dbcp/build.xml?rev=1888642&r1=1888641&r2=1888642&view=diff
==============================================================================
--- commons/sandbox/performance/trunk/src/dbcp/build.xml (original)
+++ commons/sandbox/performance/trunk/src/dbcp/build.xml Sun Apr 11 22:39:56 2021
@@ -29,9 +29,6 @@
   <property file="${component-propfile}"/>
 
   <path id="compile.classpath">
-    <pathelement location="${jdbc-jar}"/>
-  	<pathelement location="${pool-jar}"/>
-  	<pathelement location="${dbcp-jar}"/>
   	<pathelement location="${pool2-jar}"/>
   	<pathelement location="${dbcp2-jar}"/>
   	<pathelement location="${tomcat-jdbc-jar}"/>
@@ -87,9 +84,17 @@
     dest="${lib}/commons-logging-1.0.4.jar"
     usetimestamp="true"/>
   </target>
+
+  <!-- Grab dbcp tests jar to get the mock jdbc driver -->
+  <target name="get-dbcp-tests">
+    <get
+	  src="${mavenRepo}/org/apache/commons/commons-dbcp2/2.8.0/commons-dbcp2-2.8.0-tests.jar"
+	  dest="${lib}/commons-dbcp2-2.8.0-tests.jar"
+	  usetimestamp="true"/>
+  </target>
  
   <target name="get-deps"
-      depends="get-collections,get-beanutils,get-digester,get-math,get-logging">
+      depends="get-collections,get-beanutils,get-digester,get-math,get-logging,get-dbcp-tests">
   </target>
 
   <target name="compile" depends="clean,init,get-deps">

Modified: commons/sandbox/performance/trunk/src/dbcp/config-dbcp.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/performance/trunk/src/dbcp/config-dbcp.xml?rev=1888642&r1=1888641&r2=1888642&view=diff
==============================================================================
--- commons/sandbox/performance/trunk/src/dbcp/config-dbcp.xml (original)
+++ commons/sandbox/performance/trunk/src/dbcp/config-dbcp.xml Sun Apr 11 22:39:56 2021
@@ -23,7 +23,7 @@
   <database>
     <driver>org.apache.commons.dbcp2.TesterDriver</driver>
     <url>jdbc:apache:commons:testdriver</url> 
-    <username>username</username>
+    <username>userName</username>
     <password>password</password>
     <!-- no-op, integerIndexed, integerScan, or textScan -->
     <query-type>integerIndexed</query-type>
@@ -50,7 +50,7 @@
   
   <pool>
     <!-- GenericObjectPool or AbandonedObjectPool -->
-    <type>GenericObjectPool</type>
+    <type>GenericObjectPool2</type>
     <max-active>15</max-active>
     <max-idle>15</max-idle>
     <min-idle>3</min-idle>
@@ -66,13 +66,6 @@
     <sampling-rate>0.1</sampling-rate>
   </pool>
   
-  <!-- Ignored unless pool type is AbandonedObjectPool -->
-  <abandoned-config>
-    <log-abandoned>true</log-abandoned>
-    <remove-abandoned>true</remove-abandoned>
-    <abandoned-timeout>50000</abandoned-timeout>
-  </abandoned-config>
-  
   <run>
     <iterations>1000</iterations>
     <clients>50</clients>

Added: commons/sandbox/performance/trunk/src/http/build.properties.sample
URL: http://svn.apache.org/viewvc/commons/sandbox/performance/trunk/src/http/build.properties.sample?rev=1888642&view=auto
==============================================================================
--- commons/sandbox/performance/trunk/src/http/build.properties.sample (added)
+++ commons/sandbox/performance/trunk/src/http/build.properties.sample Sun Apr 11 22:39:56 2021
@@ -0,0 +1,22 @@
+###############################################################################
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###############################################################################
+
+# Remote maven repository (used to download dependencies not provided below)
+mavenRepo=https://repo1.maven.org/maven2
+
+

Modified: commons/sandbox/performance/trunk/src/http/build.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/performance/trunk/src/http/build.xml?rev=1888642&r1=1888641&r2=1888642&view=diff
==============================================================================
--- commons/sandbox/performance/trunk/src/http/build.xml (original)
+++ commons/sandbox/performance/trunk/src/http/build.xml Sun Apr 11 22:39:56 2021
@@ -71,8 +71,8 @@
 
   <target name="get-math">
     <get
-    src="${mavenRepo}/org/apache/commons/commons-math/2.1/commons-math-2.1.jar"
-    dest="${lib}/commons-math-2.1.jar"
+    src="${mavenRepo}/org/apache/commons/commons-math3/3.6.1/commons-math3-3.6.1.jar"
+    dest="${lib}/commons-math-3.6.1.jar"
     usetimestamp="true"/>
   </target>
 

Modified: commons/sandbox/performance/trunk/src/http/config-http.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/performance/trunk/src/http/config-http.xml?rev=1888642&r1=1888641&r2=1888642&view=diff
==============================================================================
--- commons/sandbox/performance/trunk/src/http/config-http.xml (original)
+++ commons/sandbox/performance/trunk/src/http/config-http.xml Sun Apr 11 22:39:56 2021
@@ -39,9 +39,13 @@
     <cycle-type>oscillating</cycle-type>
   </run>
   <http>
-  	<url>http://localhost:8080/DBTest/test.jsp</url><!--GET or POST-->
-  	<method>GET</method><!--Socket timeout in milliseconds-->
-  	<socket-timeout>20000</socket-timeout><!--String to search for in response-->
-  	<success-key>updated</success-key></http>
-
+    <!-- URL to hit -->
+  	<url>http://localhost:8080</url>
+  	<!--GET or POST-->
+  	<method>GET</method>
+  	<!--Socket timeout in milliseconds-->
+  	<socket-timeout>20000</socket-timeout>
+  	<!--String to search for in response-->
+  	<success-key>Tomcat</success-key>
+  </http>
 </configuration>

Modified: commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/dbcp/DBCPClientThread.java
URL: http://svn.apache.org/viewvc/commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/dbcp/DBCPClientThread.java?rev=1888642&r1=1888641&r2=1888642&view=diff
==============================================================================
--- commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/dbcp/DBCPClientThread.java (original)
+++ commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/dbcp/DBCPClientThread.java Sun Apr 11 22:39:56 2021
@@ -21,6 +21,7 @@ import java.util.logging.Logger;
 
 import javax.sql.DataSource;
 
+import org.apache.commons.dbcp2.BasicDataSource;
 import org.apache.commons.math3.stat.descriptive.SummaryStatistics;
 import org.apache.commons.performance.ClientThread;
 import org.apache.commons.performance.Statistics;
@@ -62,10 +63,7 @@ public class DBCPClientThread
     /** Sampling rate for numActive, numIdle */
     private double samplingRate;
 
-    // Cast targets to query for stats
-    org.apache.commons.dbcp.BasicDataSource dbcp1DS = null;
-
-    org.apache.commons.dbcp2.BasicDataSource dbcp2DS = null;
+    BasicDataSource dbcp2DS = null;
 
     org.apache.tomcat.jdbc.pool.DataSource tomcatDS = null;
 
@@ -99,12 +97,9 @@ public class DBCPClientThread
 
         this.dataSource = dataSource;
 
-        if (dataSource instanceof org.apache.commons.dbcp.BasicDataSource) {
-            type = DataSourceType.DBCP1;
-            dbcp1DS = (org.apache.commons.dbcp.BasicDataSource) dataSource;
-        } else if (dataSource instanceof org.apache.commons.dbcp2.BasicDataSource) {
+        if (dataSource instanceof BasicDataSource) {
             type = DataSourceType.DBCP2;
-            dbcp2DS = (org.apache.commons.dbcp2.BasicDataSource) dataSource;
+            dbcp2DS = (BasicDataSource) dataSource;
         } else {
             type = DataSourceType.TOMCAT;
             tomcatDS = (org.apache.tomcat.jdbc.pool.DataSource) dataSource;
@@ -174,10 +169,6 @@ public class DBCPClientThread
             int numIdle;
             int numActive;
             switch (type) {
-                case DBCP1:
-                    numActive = dbcp1DS.getNumActive();
-                    numIdle = dbcp1DS.getNumIdle();
-                    break;
                 case DBCP2:
                     numActive = dbcp2DS.getNumActive();
                     numIdle = dbcp2DS.getNumIdle();
@@ -205,7 +196,7 @@ public class DBCPClientThread
     }
 
     private enum DataSourceType {
-                                 DBCP1, DBCP2, TOMCAT
+                                 DBCP2, TOMCAT
     }
 
 }

Modified: commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/dbcp/DBCPSoak.java
URL: http://svn.apache.org/viewvc/commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/dbcp/DBCPSoak.java?rev=1888642&r1=1888641&r2=1888642&view=diff
==============================================================================
--- commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/dbcp/DBCPSoak.java (original)
+++ commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/dbcp/DBCPSoak.java Sun Apr 11 22:39:56 2021
@@ -17,28 +17,26 @@ package org.apache.commons.performance.d
 import java.sql.Connection;
 import java.sql.Driver;
 import java.sql.DriverManager;
+import java.sql.SQLException;
 import java.sql.Statement;
 import java.util.Properties;
 import java.util.logging.Logger;
 
 import javax.sql.DataSource;
 
-import org.apache.commons.dbcp.AbandonedConfig;
-import org.apache.commons.dbcp.ConnectionFactory;
-import org.apache.commons.dbcp.DriverConnectionFactory;
-import org.apache.commons.dbcp.DriverManagerConnectionFactory;
-import org.apache.commons.dbcp.PoolableConnectionFactory;
-import org.apache.commons.dbcp.PoolingDataSource;
+import org.apache.commons.dbcp2.BasicDataSource;
+import org.apache.commons.dbcp2.ConnectionFactory;
+import org.apache.commons.dbcp2.DriverConnectionFactory;
+import org.apache.commons.dbcp2.DriverManagerConnectionFactory;
+import org.apache.commons.dbcp2.PoolableConnectionFactory;
+import org.apache.commons.dbcp2.PoolingDataSource;
 import org.apache.commons.math3.random.RandomDataGenerator;
 import org.apache.commons.performance.ClientThread;
 import org.apache.commons.performance.ConfigurationException;
 import org.apache.commons.performance.LoadGenerator;
 import org.apache.commons.performance.Statistics;
-import org.apache.commons.pool.KeyedObjectPoolFactory;
-import org.apache.commons.pool.PoolableObjectFactory;
-import org.apache.commons.pool.impl.GenericKeyedObjectPool;
-import org.apache.commons.pool.impl.GenericKeyedObjectPoolFactory;
-import org.apache.commons.pool.impl.GenericObjectPool;
+import org.apache.commons.pool2.impl.AbandonedConfig;
+import org.apache.commons.pool2.impl.GenericObjectPool;
 import org.apache.tomcat.jdbc.pool.PoolProperties;
 
 /**
@@ -112,6 +110,29 @@ public class DBCPSoak
 
     private DataSource dataSource;
 
+    private PoolableConnectionFactory
+        createPoolableConnectionFactory(final ConnectionFactory driverConnectionFactory)
+            throws SQLException {
+        PoolableConnectionFactory connectionFactory = null;
+        try {
+            connectionFactory = new PoolableConnectionFactory(driverConnectionFactory,
+                                                              null);
+            connectionFactory.setValidationQuery(validationQuery);
+
+            connectionFactory.setDefaultReadOnly(readOnly);
+            connectionFactory.setDefaultAutoCommit(autocommit);
+
+            connectionFactory.setPoolStatements(poolPreparedStatements);
+
+        } catch (final RuntimeException e) {
+            throw e;
+        } catch (final Exception e) {
+            throw new SQLException("Cannot create PoolableConnectionFactory (" +
+                                   e.getMessage() + ")", e);
+        }
+        return connectionFactory;
+    }
+
     /**
      * Create connection pool and, if necessary, test table.
      */
@@ -119,36 +140,8 @@ public class DBCPSoak
     protected void init()
         throws Exception {
 
-        if (dataSourceType.equals("BasicDataSource")) {
-            org.apache.commons.dbcp.BasicDataSource bds = new org.apache.commons.dbcp.BasicDataSource();
-            bds.setDefaultAutoCommit(autocommit);
-            bds.setPassword(connectPassword);
-            bds.setUrl(connectUrl);
-            bds.setUsername(connectUser);
-            bds.setDriverClassName(driverClass);
-            bds.setMinEvictableIdleTimeMillis(idleTimeout);
-            bds.setMaxActive(maxActive);
-            bds.setMaxIdle(maxIdle);
-            bds.setMaxWait(maxWait);
-            bds.setMinIdle(minIdle);
-            bds.setPoolPreparedStatements(poolPreparedStatements);
-            bds.setDefaultReadOnly(readOnly);
-            bds.setTestOnBorrow(testOnBorrow);
-            bds.setTestOnReturn(testOnReturn);
-            bds.setTestWhileIdle(testWhileIdle);
-            bds.setNumTestsPerEvictionRun(testsPerEviction);
-            bds.setTimeBetweenEvictionRunsMillis(timeBetweenEvictions);
-            bds.setValidationQuery(validationQuery);
-            if (poolType.equals("AbandonedObjectPool")) {
-                bds.setRemoveAbandoned(true);
-            }
-            dataSource = bds;
-            checkDatabase();
-            return;
-        }
-
         if (dataSourceType.equals("BasicDataSource2")) {
-            org.apache.commons.dbcp2.BasicDataSource bds = new org.apache.commons.dbcp2.BasicDataSource();
+            BasicDataSource bds = new BasicDataSource();
             bds.setDefaultAutoCommit(autocommit);
             bds.setPassword(connectPassword);
             bds.setUrl(connectUrl);
@@ -200,28 +193,6 @@ public class DBCPSoak
 
         Class.forName(driverClass);
 
-        // Create object pool
-        if (poolType.equals("GenericObjectPool")) {
-            connectionPool = new org.apache.commons.pool.impl.GenericObjectPool(null,
-                                                                                maxActive,
-                                                                                exhaustedAction,
-                                                                                maxWait,
-                                                                                maxIdle,
-                                                                                minIdle,
-                                                                                testOnBorrow,
-                                                                                testOnReturn,
-                                                                                timeBetweenEvictions,
-                                                                                testsPerEviction,
-                                                                                idleTimeout,
-                                                                                testWhileIdle);
-        } else if (poolType.equals("AbandonedObjectPool")) {
-            connectionPool = new org.apache.commons.dbcp.AbandonedObjectPool(null,
-                                                                             abandonedConfig);
-        } else {
-            throw new ConfigurationException("invalid pool type configuration: " +
-                                             poolType);
-        }
-
         // Create raw connection factory
         ConnectionFactory connectionFactory = null;
         if (driverType.equals("DriverManager")) {
@@ -238,31 +209,9 @@ public class DBCPSoak
             throw new ConfigurationException("Bad config setting for driver type");
         }
 
-        // Create object factory
-        PoolableObjectFactory poolableConnectionFactory = null;
-        KeyedObjectPoolFactory statementPoolFactory = null;
-        if (poolPreparedStatements) { // Use same defaults as BasicDataSource
-            statementPoolFactory = new GenericKeyedObjectPoolFactory(null, -1, // unlimited
-                                                                               // maxActive
-                                                                               // (per
-                                                                               // key)
-                                                                     GenericKeyedObjectPool.WHEN_EXHAUSTED_FAIL,
-                                                                     0, // maxWait
-                                                                     1, // maxIdle
-                                                                        // (per
-                                                                        // key)
-                                                                     maxOpenStatements); // TODO:
-                                                                                         // make
-                                                                                         // all
-                                                                                         // configurable
-        }
+        PoolableConnectionFactory poolableConnectionFactory = null;
         if (factoryType.equals("PoolableConnectionFactory")) {
-            poolableConnectionFactory = new PoolableConnectionFactory(connectionFactory,
-                                                                      connectionPool,
-                                                                      statementPoolFactory,
-                                                                      validationQuery,
-                                                                      readOnly,
-                                                                      autocommit);
+            poolableConnectionFactory = createPoolableConnectionFactory(connectionFactory);
         } else if (factoryType.equals("CPDSConnectionFactory")) {
             throw new ConfigurationException("CPDSConnectionFactory not implemented yet");
         } else {
@@ -270,6 +219,20 @@ public class DBCPSoak
                                              factoryType);
         }
 
+        // Create object pool
+        connectionPool = new GenericObjectPool(poolableConnectionFactory);
+        connectionPool.setMaxTotal(maxActive);
+        connectionPool.setMaxWaitMillis(maxWait);
+        connectionPool.setMaxIdle(maxIdle);
+        connectionPool.setMinIdle(minIdle);
+        connectionPool.setTimeBetweenEvictionRunsMillis(timeBetweenEvictions);
+        connectionPool.setNumTestsPerEvictionRun(testsPerEviction);
+        connectionPool.setMinEvictableIdleTimeMillis(idleTimeout);
+        connectionPool.setTestWhileIdle(testWhileIdle);
+        connectionPool.setTestOnBorrow(testOnBorrow);
+        connectionPool.setBlockWhenExhausted(autocommit);
+        connectionPool.setTestOnReturn(testOnReturn);
+
         // Create DataSource
         dataSource = new PoolingDataSource(connectionPool);
         checkDatabase();
@@ -303,12 +266,10 @@ public class DBCPSoak
     @Override
     protected void cleanUp()
         throws Exception {
-        if (dataSourceType.equals("BasicDataSource")) {
-            ((org.apache.commons.dbcp.BasicDataSource) dataSource).close();
-        } else if (dataSourceType.equals("tomcat-jdbc-pool")) {
+        if (dataSourceType.equals("tomcat-jdbc-pool")) {
             ((org.apache.tomcat.jdbc.pool.DataSource) dataSource).close();
         } else {
-            ((org.apache.commons.dbcp2.BasicDataSource) dataSource).close();
+            ((BasicDataSource) dataSource).close();
         }
     }
 
@@ -381,16 +342,6 @@ public class DBCPSoak
         this.idleTimeout = Long.parseLong(idleTimeout);
         this.testWhileIdle = Boolean.parseBoolean(testWhileIdle);
         this.poolType = type;
-        if (exhaustedAction.equals("block")) {
-            this.exhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_BLOCK;
-        } else if (exhaustedAction.equals("fail")) {
-            this.exhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_FAIL;
-        } else if (exhaustedAction.equals("grow")) {
-            this.exhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_GROW;
-        } else {
-            throw new ConfigurationException("Bad configuration setting for exhausted action: " +
-                                             exhaustedAction);
-        }
         this.samplingRate = Double.parseDouble(samplingRate);
     }
 
@@ -398,8 +349,8 @@ public class DBCPSoak
                                          String removeAbandoned,
                                          String abandonedTimeout) {
         abandonedConfig.setLogAbandoned(Boolean.parseBoolean(logAbandoned));
-        abandonedConfig
-            .setRemoveAbandoned(Boolean.parseBoolean(removeAbandoned));
+        abandonedConfig.setRemoveAbandonedOnMaintenance(Boolean
+            .parseBoolean(removeAbandoned));
         abandonedConfig
             .setRemoveAbandonedTimeout(Integer.parseInt(abandonedTimeout));
     }

Modified: commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/pool/PoolClientThread.java
URL: http://svn.apache.org/viewvc/commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/pool/PoolClientThread.java?rev=1888642&r1=1888641&r2=1888642&view=diff
==============================================================================
--- commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/pool/PoolClientThread.java (original)
+++ commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/pool/PoolClientThread.java Sun Apr 11 22:39:56 2021
@@ -1,18 +1,15 @@
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
+ * or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
  */
 
 package org.apache.commons.performance.pool;
@@ -21,41 +18,38 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.logging.Logger;
 
-//import org.apache.commons.pool.ObjectPool;
-//import org.apache.commons.pool2.ObjectPool;
-//import org.apache.commons.pool.KeyedObjectPool;
-//import org.apache.commons.pool2.KeyedObjectPool;
+// import org.apache.commons.pool.ObjectPool;
+// import org.apache.commons.pool2.ObjectPool;
+// import org.apache.commons.pool.KeyedObjectPool;
+// import org.apache.commons.pool2.KeyedObjectPool;
 import org.apache.commons.math3.random.RandomDataGenerator;
 import org.apache.commons.math3.stat.descriptive.SummaryStatistics;
 import org.apache.commons.performance.ClientThread;
 import org.apache.commons.performance.Statistics;
+import org.apache.commons.pool2.KeyedObjectPool;
+import org.apache.commons.pool2.ObjectPool;
 
 /**
  * <p>
- * Client thread that borrows and returns objects from a pool in a loop. See {@link ClientThread
- * ClientThread javadoc} for a description of how times between requests are computed. In addition
- * to request latency, pool numIdle and numActive statistics and stats on instance idle time are
- * tracked. Constructors are provided for both 1.x and version 2 simple and keyed pools.
+ * Client thread that borrows and returns objects from a pool in a loop. See
+ * {@link ClientThread ClientThread javadoc} for a description of how times
+ * between requests are computed. In addition to request latency, pool numIdle
+ * and numActive statistics and stats on instance idle time are tracked.
+ * Constructors are provided for both 1.x and version 2 simple and keyed pools.
  * </p>
- * 
  * <p>
  * Note that this class is *not* threadsafe.
  * </p>
  */
 public class PoolClientThread
-    extends ClientThread {
-
-    /** Version 1.x object pool (if keyed = false) */
-    private final org.apache.commons.pool.ObjectPool pool;
-
-    /** Version 1.x keyed pool (if keyed = true) */
-    private final org.apache.commons.pool.KeyedObjectPool keyedPool;
+    extends
+    ClientThread {
 
     /** Version 2 object pool (if keyed = false) */
-    private final org.apache.commons.pool2.ObjectPool<Waiter> pool2;
+    private final ObjectPool<Waiter> pool2;
 
     /** Version 2 keyed pool (if keyed = true) */
-    private final org.apache.commons.pool2.KeyedObjectPool<Integer, Waiter> keyedPool2;
+    private final KeyedObjectPool<Integer, Waiter> keyedPool2;
 
     /** Whether or not pool being tested is keyed */
     private boolean keyed;
@@ -78,79 +72,10 @@ public class PoolClientThread
     /** Statistics on instance idle time */
     private SummaryStatistics instanceIdleTimeStats = new SummaryStatistics();
 
-    /** Just-borrowed Waiter instance (used to grab idle time stats in cleanUp) */
-    private Waiter waiter = null;
-
     /**
-     * Create a pool client thread for a version 1.x ObjectPool.
-     * 
-     * @param iterations number of iterations
-     * @param minDelay minimum mean time between client requests
-     * @param maxDelay maximum mean time between client requests
-     * @param delayType distribution of time between client requests
-     * @param rampPeriod ramp period of cycle for cyclic load
-     * @param peakPeriod peak period of cycle for cyclic load
-     * @param troughPeriod trough period of cycle for cyclic load
-     * @param cycleType type of cycle for mean delay
-     * @param rampType type of ramp (linear or random jumps)
-     * @param logger common logger shared by all clients
-     * @param stats Statistics container
-     * @param pool ObjectPool
-     * @param samplingRate proportion of requests for which numIdle and numActive will be sampled
-     *        for statistical analysis
+     * Just-borrowed Waiter instance (used to grab idle time stats in cleanUp)
      */
-    public PoolClientThread(long iterations, long minDelay, long maxDelay, double sigma, String delayType,
-                            long rampPeriod, long peakPeriod, long troughPeriod, String cycleType, String rampType,
-                            Logger logger, Statistics stats, org.apache.commons.pool.ObjectPool pool,
-                            double samplingRate) {
-
-        super(iterations, minDelay, maxDelay, sigma, delayType, rampPeriod, peakPeriod, troughPeriod, cycleType,
-              rampType, logger, stats);
-        this.pool = pool;
-        this.pool2 = null;
-        this.keyedPool2 = null;
-        this.keyedPool = null;
-        this.keyed = false;
-        this.samplingRate = samplingRate;
-    }
-
-    /**
-     * Create a pool client thread for a version 1.x KeyedObjectPool.
-     * 
-     * @param iterations number of iterations
-     * @param minDelay minimum mean time between client requests
-     * @param maxDelay maximum mean time between client requests
-     * @param delayType distribution of time between client requests
-     * @param rampPeriod ramp period of cycle for cyclic load
-     * @param peakPeriod peak period of cycle for cyclic load
-     * @param troughPeriod trough period of cycle for cyclic load
-     * @param cycleType type of cycle for mean delay
-     * @param rampType type of ramp (linear or random jumps)
-     * @param logger common logger shared by all clients
-     * @param stats Statistics container
-     * @param keyedPool KeyedObjectPool
-     * @param samplingRate proportion of requests for which numIdle and numActive will be sampled
-     *        for statistical analysis
-     */
-    public PoolClientThread(long iterations, long minDelay, long maxDelay, double sigma, String delayType,
-                            long rampPeriod, long peakPeriod, long troughPeriod, String cycleType, String rampType,
-                            Logger logger, Statistics stats, org.apache.commons.pool.KeyedObjectPool keyedPool,
-                            double samplingRate) {
-
-        super(iterations, minDelay, maxDelay, sigma, delayType, rampPeriod, peakPeriod, troughPeriod, cycleType,
-              rampType, logger, stats);
-
-        this.keyedPool = keyedPool;
-        this.pool = null;
-        this.pool2 = null;
-        this.keyedPool2 = null;
-        this.keyed = true;
-        this.samplingRate = samplingRate;
-        keys = new ArrayList<Integer>();
-        for (int i = 0; i < 20; i++) { // TODO: make number of keys configurable
-            keys.add(new Integer(i));
-        }
-    }
+    private Waiter waiter = null;
 
     /**
      * Create a pool client thread for a version 1.x ObjectPool.
@@ -167,20 +92,20 @@ public class PoolClientThread
      * @param logger common logger shared by all clients
      * @param stats Statistics container
      * @param pool ObjectPool
-     * @param samplingRate proportion of requests for which numIdle and numActive will be sampled
-     *        for statistical analysis
+     * @param samplingRate proportion of requests for which numIdle and
+     *        numActive will be sampled for statistical analysis
      */
-    public PoolClientThread(long iterations, long minDelay, long maxDelay, double sigma, String delayType,
-                            long rampPeriod, long peakPeriod, long troughPeriod, String cycleType, String rampType,
-                            Logger logger, Statistics stats, org.apache.commons.pool2.ObjectPool<Waiter> pool,
+    public PoolClientThread(long iterations, long minDelay, long maxDelay,
+                            double sigma, String delayType, long rampPeriod,
+                            long peakPeriod, long troughPeriod,
+                            String cycleType, String rampType, Logger logger,
+                            Statistics stats, ObjectPool<Waiter> pool,
                             double samplingRate) {
 
-        super(iterations, minDelay, maxDelay, sigma, delayType, rampPeriod, peakPeriod, troughPeriod, cycleType,
-              rampType, logger, stats);
+        super(iterations, minDelay, maxDelay, sigma, delayType, rampPeriod,
+              peakPeriod, troughPeriod, cycleType, rampType, logger, stats);
         this.pool2 = pool;
-        this.pool = null;
         this.keyedPool2 = null;
-        this.keyedPool = null;
         this.keyed = false;
         this.samplingRate = samplingRate;
     }
@@ -200,21 +125,22 @@ public class PoolClientThread
      * @param logger common logger shared by all clients
      * @param stats Statistics container
      * @param keyedPool KeyedObjectPool
-     * @param samplingRate proportion of requests for which numIdle and numActive will be sampled
-     *        for statistical analysis
+     * @param samplingRate proportion of requests for which numIdle and
+     *        numActive will be sampled for statistical analysis
      */
-    public PoolClientThread(long iterations, long minDelay, long maxDelay, double sigma, String delayType,
-                            long rampPeriod, long peakPeriod, long troughPeriod, String cycleType, String rampType,
-                            Logger logger, Statistics stats,
-                            org.apache.commons.pool2.KeyedObjectPool<Integer, Waiter> keyedPool, double samplingRate) {
+    public PoolClientThread(long iterations, long minDelay, long maxDelay,
+                            double sigma, String delayType, long rampPeriod,
+                            long peakPeriod, long troughPeriod,
+                            String cycleType, String rampType, Logger logger,
+                            Statistics stats,
+                            KeyedObjectPool<Integer, Waiter> keyedPool,
+                            double samplingRate) {
 
-        super(iterations, minDelay, maxDelay, sigma, delayType, rampPeriod, peakPeriod, troughPeriod, cycleType,
-              rampType, logger, stats);
+        super(iterations, minDelay, maxDelay, sigma, delayType, rampPeriod,
+              peakPeriod, troughPeriod, cycleType, rampType, logger, stats);
 
         this.keyedPool2 = keyedPool;
-        this.pool = null;
         this.pool2 = null;
-        this.keyedPool = null;
         this.keyed = true;
         this.samplingRate = samplingRate;
         keys = new ArrayList<Integer>();
@@ -229,21 +155,13 @@ public class PoolClientThread
         throws Exception {
         if (keyed) {
             Integer key = keys.get(randomData.nextInt(0, 19));
-            waiter = keyedPool2 == null ? (Waiter) keyedPool.borrowObject(key) : keyedPool2.borrowObject(key);
+            waiter = keyedPool2.borrowObject(key);
             waiter.doWait();
-            if (keyedPool2 == null) {
-                keyedPool.returnObject(key, waiter);
-            } else {
-                keyedPool2.returnObject(key, waiter);
-            }
+            keyedPool2.returnObject(key, waiter);
         } else {
-            waiter = pool2 == null ? (Waiter) pool.borrowObject() : pool2.borrowObject();
+            waiter = pool2.borrowObject();
             waiter.doWait();
-            if (pool2 == null) {
-                pool.returnObject(waiter);
-            } else {
-                pool2.returnObject(waiter);
-            }
+            pool2.returnObject(waiter);
         }
     }
 
@@ -252,12 +170,11 @@ public class PoolClientThread
         throws Exception {
         // Capture pool metrics
         if (randomData.nextUniform(0, 1) < samplingRate) {
-            if (keyed) {
-                numIdleStats.addValue(keyedPool2 == null ? keyedPool.getNumIdle() : keyedPool2.getNumIdle());
-                numActiveStats.addValue(keyedPool2 == null ? keyedPool.getNumActive() : keyedPool2.getNumActive());
-            } else {
-                numIdleStats.addValue(pool2 == null ? pool.getNumIdle() : pool2.getNumIdle());
-                numActiveStats.addValue(pool2 == null ? pool.getNumActive() : pool2.getNumActive());
+            if (keyedPool2 != null) {
+                numActiveStats.addValue(keyedPool2.getNumActive());
+            }
+            if (pool2 != null) {
+                numActiveStats.addValue(pool2.getNumActive());
             }
         }
         if (waiter != null) {
@@ -270,8 +187,12 @@ public class PoolClientThread
     protected void finish()
         throws Exception {
         // Add metrics to stats
-        stats.addStatistics(numIdleStats, Thread.currentThread().getName(), "numIdle");
-        stats.addStatistics(numActiveStats, Thread.currentThread().getName(), "numActive");
-        stats.addStatistics(instanceIdleTimeStats, Thread.currentThread().getName(), "instance idle time");
+        stats.addStatistics(numIdleStats, Thread.currentThread().getName(),
+                            "numIdle");
+        stats.addStatistics(numActiveStats, Thread.currentThread().getName(),
+                            "numActive");
+        stats.addStatistics(instanceIdleTimeStats,
+                            Thread.currentThread().getName(),
+                            "instance idle time");
     }
 }

Modified: commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/pool/PoolSoak.java
URL: http://svn.apache.org/viewvc/commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/pool/PoolSoak.java?rev=1888642&r1=1888641&r2=1888642&view=diff
==============================================================================
--- commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/pool/PoolSoak.java (original)
+++ commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/pool/PoolSoak.java Sun Apr 11 22:39:56 2021
@@ -1,82 +1,97 @@
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
+ * or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
  */
 
 package org.apache.commons.performance.pool;
 
 import java.util.logging.Logger;
 
-import org.apache.commons.dbcp.AbandonedConfig;
-import org.apache.commons.dbcp.AbandonedObjectPool;
 import org.apache.commons.performance.ClientThread;
 import org.apache.commons.performance.ConfigurationException;
 import org.apache.commons.performance.LoadGenerator;
 import org.apache.commons.performance.Statistics;
-import org.apache.commons.pool.impl.SoftReferenceObjectPool;
-import org.apache.commons.pool.impl.StackKeyedObjectPool;
-import org.apache.commons.pool.impl.StackObjectPool;
+import org.apache.commons.pool2.impl.AbandonedConfig;
+import org.apache.commons.pool2.impl.GenericKeyedObjectPool;
 import org.apache.commons.pool2.impl.GenericKeyedObjectPoolConfig;
+import org.apache.commons.pool2.impl.GenericObjectPool;
 import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
 
 /**
- * Configurable load / performance tester for commons pool. Uses Commons Digester to parse and load
- * configuration and spawns PoolClientThread instances to generate load and gather statistics.
- * 
+ * Configurable load / performance tester for commons pool. Uses Commons
+ * Digester to parse and load configuration and spawns PoolClientThread
+ * instances to generate load and gather statistics.
  */
 public class PoolSoak
-    extends LoadGenerator {
+    extends
+    LoadGenerator {
 
     // Pool instances
-    private org.apache.commons.pool.impl.GenericObjectPool genericObjectPool;
-    private org.apache.commons.pool.impl.GenericKeyedObjectPool genericKeyedObjectPool;
-    private org.apache.commons.pool2.impl.GenericObjectPool<Waiter> genericObjectPool2;
-    private org.apache.commons.pool2.impl.GenericKeyedObjectPool<Integer, Waiter> genericKeyedObjectPool2;
-    private StackObjectPool stackObjectPool;
-    private SoftReferenceObjectPool softReferenceObjectPool;
-    private StackKeyedObjectPool stackKeyedObjectPool;
+
+    private GenericObjectPool<Waiter> genericObjectPool2;
+
+    private GenericKeyedObjectPool<Integer, Waiter> genericKeyedObjectPool2;
 
     // Pool properties
     private String poolType;
+
     private int maxActive; // maxActive for GOP, maxTotal for GKOP
+
     private int maxActivePerKey; // maxActive for GKOP
+
     private int maxIdle;
+
     private int minIdle;
+
     private long maxWait;
+
     private byte exhaustedAction;
+
     private boolean testOnBorrow;
+
     private boolean testOnReturn;
+
     private long timeBetweenEvictions;
+
     private int testsPerEviction;
+
     private long idleTimeout;
+
     private boolean testWhileIdle;
+
     private AbandonedConfig abandonedConfig = new AbandonedConfig();
+
     private boolean lifo;
+
     private double samplingRate;
 
     // WaiterFactory properties
     private long activateLatency;
+
     private long destroyLatency;
+
     private long makeLatency;
+
     private long passivateLatency;
+
     private long validateLatency;
+
     private long waiterLatency;
+
     private double passivateInvalidationProbability;
 
     /**
-     * Add pool configuration to parameters loaded by super. Also set config file name.
+     * Add pool configuration to parameters loaded by super. Also set config
+     * file name.
      */
     @Override
     protected void configure()
@@ -89,7 +104,9 @@ public class PoolSoak
         digester.addCallParam("configuration/factory/passivate-latency", 3);
         digester.addCallParam("configuration/factory/validate-latency", 4);
         digester.addCallParam("configuration/factory/waiter-latency", 5);
-        digester.addCallParam("configuration/factory/passivate-invalidation-probability", 6);
+        digester
+            .addCallParam("configuration/factory/passivate-invalidation-probability",
+                          6);
         digester.addCallMethod("configuration/pool", "configurePool", 15);
         digester.addCallParam("configuration/pool/max-active", 0);
         digester.addCallParam("configuration/pool/max-active-per-key", 1);
@@ -106,10 +123,15 @@ public class PoolSoak
         digester.addCallParam("configuration/pool/lifo", 12);
         digester.addCallParam("configuration/pool/type", 13);
         digester.addCallParam("configuration/pool/sampling-rate", 14);
-        digester.addCallMethod("configuration/abandoned-config", "configureAbandonedConfig", 3);
-        digester.addCallParam("configuration/abandoned-config/log-abandoned", 0);
-        digester.addCallParam("configuration/abandoned-config/remove-abandoned", 1);
-        digester.addCallParam("configuration/abandoned-config/abandoned-timeout", 2);
+        digester.addCallMethod("configuration/abandoned-config",
+                               "configureAbandonedConfig", 3);
+        digester.addCallParam("configuration/abandoned-config/log-abandoned",
+                              0);
+        digester.addCallParam("configuration/abandoned-config/remove-abandoned",
+                              1);
+        digester
+            .addCallParam("configuration/abandoned-config/abandoned-timeout",
+                          2);
 
         this.configFile = "config-pool.xml";
 
@@ -122,34 +144,21 @@ public class PoolSoak
     protected void init()
         throws Exception {
         // Create factory
-        WaiterFactory factory = new WaiterFactory(activateLatency, destroyLatency, makeLatency, passivateLatency,
-                                                  validateLatency, waiterLatency, maxActive, maxActivePerKey,
-                                                  passivateInvalidationProbability);
 
-        WaiterFactory2 factory2 = new WaiterFactory2(activateLatency, destroyLatency, makeLatency, passivateLatency,
-                                                     validateLatency, waiterLatency, maxActive, maxActivePerKey,
+        WaiterFactory2 factory2 = new WaiterFactory2(activateLatency,
+                                                     destroyLatency,
+                                                     makeLatency,
+                                                     passivateLatency,
+                                                     validateLatency,
+                                                     waiterLatency, maxActive,
+                                                     maxActivePerKey,
                                                      passivateInvalidationProbability);
 
         // Create object pool
-        if (poolType.equals("GenericObjectPool")) {
-            genericObjectPool = new org.apache.commons.pool.impl.GenericObjectPool(factory);
-            genericObjectPool.setMaxActive(maxActive);
-            genericObjectPool.setWhenExhaustedAction(exhaustedAction);
-            genericObjectPool.setMaxWait(maxWait);
-            genericObjectPool.setMaxIdle(maxIdle);
-            genericObjectPool.setMinIdle(minIdle);
-            genericObjectPool.setTestOnBorrow(testOnBorrow);
-            genericObjectPool.setTestOnReturn(testOnReturn);
-            genericObjectPool.setTimeBetweenEvictionRunsMillis(timeBetweenEvictions);
-            genericObjectPool.setNumTestsPerEvictionRun(testsPerEviction);
-            genericObjectPool.setMinEvictableIdleTimeMillis(idleTimeout);
-            genericObjectPool.setTestWhileIdle(testWhileIdle);
-            genericObjectPool.setLifo(lifo);
-        } else if (poolType.equals("GenericObjectPool2")) {
+
+        if (poolType.equals("GenericObjectPool2")) {
             GenericObjectPoolConfig config = new GenericObjectPoolConfig();
-            config
-                .setBlockWhenExhausted(exhaustedAction == org.apache.commons.pool.impl.GenericObjectPool.WHEN_EXHAUSTED_BLOCK
-                    ? true : false);
+            config.setBlockWhenExhausted(exhaustedAction == 1 ? true : false);
             config.setMaxIdle(maxIdle);
             config.setMinIdle(minIdle);
             config.setMaxWaitMillis(maxWait);
@@ -161,43 +170,14 @@ public class PoolSoak
             config.setMinEvictableIdleTimeMillis(idleTimeout);
             config.setLifo(lifo);
             config.setMaxTotal(maxActive);
-            genericObjectPool2 = new org.apache.commons.pool2.impl.GenericObjectPool<Waiter>(factory2, config);
-        } else if (poolType.equals("AbandonedObjectPool")) {
-            genericObjectPool = new AbandonedObjectPool(factory, abandonedConfig);
-            genericObjectPool.setMaxActive(maxActive);
-            genericObjectPool.setWhenExhaustedAction(exhaustedAction);
-            genericObjectPool.setMaxWait(maxWait);
-            genericObjectPool.setMaxIdle(maxIdle);
-            genericObjectPool.setMinIdle(minIdle);
-            genericObjectPool.setTestOnBorrow(testOnBorrow);
-            genericObjectPool.setTestOnReturn(testOnReturn);
-            genericObjectPool.setTimeBetweenEvictionRunsMillis(timeBetweenEvictions);
-            genericObjectPool.setNumTestsPerEvictionRun(testsPerEviction);
-            genericObjectPool.setMinEvictableIdleTimeMillis(idleTimeout);
-            genericObjectPool.setTestWhileIdle(testWhileIdle);
-            genericObjectPool.setLifo(lifo);
-        } else if (poolType.equals("GenericKeyedObjectPool")) {
-            genericKeyedObjectPool = new org.apache.commons.pool.impl.GenericKeyedObjectPool(factory);
-            genericKeyedObjectPool.setMaxActive(maxActivePerKey);
-            genericKeyedObjectPool.setMaxTotal(maxActive);
-            genericKeyedObjectPool.setWhenExhaustedAction(exhaustedAction);
-            genericKeyedObjectPool.setMaxWait(maxWait);
-            genericKeyedObjectPool.setMaxIdle(maxIdle);
-            genericKeyedObjectPool.setMinIdle(minIdle);
-            genericKeyedObjectPool.setTestOnBorrow(testOnBorrow);
-            genericKeyedObjectPool.setTestOnReturn(testOnReturn);
-            genericKeyedObjectPool.setTimeBetweenEvictionRunsMillis(timeBetweenEvictions);
-            genericKeyedObjectPool.setNumTestsPerEvictionRun(testsPerEviction);
-            genericKeyedObjectPool.setMinEvictableIdleTimeMillis(idleTimeout);
-            genericKeyedObjectPool.setTestWhileIdle(testWhileIdle);
-            genericKeyedObjectPool.setLifo(lifo);
+            genericObjectPool2 = new GenericObjectPool<Waiter>(factory2,
+                                                               config);
+
         } else if (poolType.equals("GenericKeyedObjectPool2")) {
             GenericKeyedObjectPoolConfig config = new GenericKeyedObjectPoolConfig();
             config.setMaxTotal(maxActive);
             config.setMaxTotalPerKey(maxActivePerKey);
-            config
-                .setBlockWhenExhausted(exhaustedAction == org.apache.commons.pool.impl.GenericObjectPool.WHEN_EXHAUSTED_BLOCK
-                    ? true : false);
+            config.setBlockWhenExhausted(exhaustedAction == 1 ? true : false);
             config.setMaxWaitMillis(maxWait);
             config.setMaxIdlePerKey(maxIdle);
             config.setMinIdlePerKey(minIdle);
@@ -208,17 +188,11 @@ public class PoolSoak
             config.setMinEvictableIdleTimeMillis(idleTimeout);
             config.setTestWhileIdle(testWhileIdle);
             config.setLifo(lifo);
-            genericKeyedObjectPool2 = new org.apache.commons.pool2.impl.GenericKeyedObjectPool<Integer, Waiter>(
-                                                                                                                factory2,
-                                                                                                                config);
-        } else if (poolType.equals("StackObjectPool")) {
-            stackObjectPool = new StackObjectPool(factory);
-        } else if (poolType.equals("SoftReferenceObjectPool")) {
-            softReferenceObjectPool = new SoftReferenceObjectPool(factory);
-        } else if (poolType.equals("StackKeyedObjectPool")) {
-            stackKeyedObjectPool = new StackKeyedObjectPool(factory);
+            genericKeyedObjectPool2 = new GenericKeyedObjectPool<Integer, Waiter>(factory2,
+                                                                                  config);
         } else {
-            throw new ConfigurationException("invalid pool type configuration: " + poolType);
+            throw new ConfigurationException("invalid pool type configuration: " +
+                                             poolType);
         }
 
         logger.info(displayConfig());
@@ -230,70 +204,41 @@ public class PoolSoak
     @Override
     protected void cleanUp()
         throws Exception {
-        if (genericObjectPool != null) {
-            genericObjectPool.close();
-        }
-        if (genericKeyedObjectPool != null) {
-            genericKeyedObjectPool.close();
-        }
+
         if (genericObjectPool2 != null) {
             genericObjectPool2.close();
         }
         if (genericKeyedObjectPool2 != null) {
             genericKeyedObjectPool2.close();
         }
-        if (stackObjectPool != null) {
-            stackObjectPool.close();
-        }
-        if (softReferenceObjectPool != null) {
-            softReferenceObjectPool.close();
-        }
-        if (stackKeyedObjectPool != null) {
-            stackKeyedObjectPool.close();
-        }
+
     }
 
     /**
      * Create and return a PoolClientThread
      */
     @Override
-    protected ClientThread makeClientThread(long iterations, long minDelay, long maxDelay, double sigma,
-        String delayType, long rampPeriod, long peakPeriod, long troughPeriod, String cycleType, String rampType,
-        Logger logger, Statistics stats) {
-        if (poolType.equals("GenericObjectPool")) {
-            return new PoolClientThread(iterations, minDelay, maxDelay, sigma, delayType, rampPeriod, peakPeriod,
-                                        troughPeriod, cycleType, rampType, logger, stats, genericObjectPool,
-                                        samplingRate);
-        }
-        if (poolType.equals("GenericKeyedObjectPool")) {
-            return new PoolClientThread(iterations, minDelay, maxDelay, sigma, delayType, rampPeriod, peakPeriod,
-                                        troughPeriod, cycleType, rampType, logger, stats, genericKeyedObjectPool,
-                                        samplingRate);
-        }
+    protected ClientThread
+        makeClientThread(long iterations, long minDelay, long maxDelay,
+                         double sigma, String delayType, long rampPeriod,
+                         long peakPeriod, long troughPeriod, String cycleType,
+                         String rampType, Logger logger, Statistics stats) {
+
         if (poolType.equals("GenericObjectPool2")) {
-            return new PoolClientThread(iterations, minDelay, maxDelay, sigma, delayType, rampPeriod, peakPeriod,
-                                        troughPeriod, cycleType, rampType, logger, stats, genericObjectPool2,
+            return new PoolClientThread(iterations, minDelay, maxDelay, sigma,
+                                        delayType, rampPeriod, peakPeriod,
+                                        troughPeriod, cycleType, rampType,
+                                        logger, stats, genericObjectPool2,
                                         samplingRate);
         }
         if (poolType.equals("GenericKeyedObjectPool2")) {
-            return new PoolClientThread(iterations, minDelay, maxDelay, sigma, delayType, rampPeriod, peakPeriod,
-                                        troughPeriod, cycleType, rampType, logger, stats, genericKeyedObjectPool2,
-                                        samplingRate);
-        }
-        if (poolType.equals("StackKeyedObjectPool")) {
-            return new PoolClientThread(iterations, minDelay, maxDelay, sigma, delayType, rampPeriod, peakPeriod,
-                                        troughPeriod, cycleType, rampType, logger, stats, stackKeyedObjectPool,
-                                        samplingRate);
-        }
-        if (poolType.equals("StackObjectPool")) {
-            return new PoolClientThread(iterations, minDelay, maxDelay, sigma, delayType, rampPeriod, peakPeriod,
-                                        troughPeriod, cycleType, rampType, logger, stats, stackObjectPool, samplingRate);
-        }
-        if (poolType.equals("SoftReferenceObjectPool")) {
-            return new PoolClientThread(iterations, minDelay, maxDelay, sigma, delayType, rampPeriod, peakPeriod,
-                                        troughPeriod, cycleType, rampType, logger, stats, softReferenceObjectPool,
+            return new PoolClientThread(iterations, minDelay, maxDelay, sigma,
+                                        delayType, rampPeriod, peakPeriod,
+                                        troughPeriod, cycleType, rampType,
+                                        logger, stats, genericKeyedObjectPool2,
                                         samplingRate);
         }
+
         return null;
     }
 
@@ -301,8 +246,10 @@ public class PoolSoak
     // Configuration methods specific to this LoadGenerator invoked by Digester
     // when superclass execute calls digester.parse.
     // ------------------------------------------------------------------------
-    public void configureFactory(String activateLatency, String destroyLatency, String makeLatency,
-        String passivateLatency, String validateLatency, String waiterLatency, String passivateInvalidationProbability) {
+    public void configureFactory(String activateLatency, String destroyLatency,
+                                 String makeLatency, String passivateLatency,
+                                 String validateLatency, String waiterLatency,
+                                 String passivateInvalidationProbability) {
 
         this.activateLatency = Long.parseLong(activateLatency);
         this.destroyLatency = Long.parseLong(destroyLatency);
@@ -310,12 +257,17 @@ public class PoolSoak
         this.passivateLatency = Long.parseLong(passivateLatency);
         this.validateLatency = Long.parseLong(validateLatency);
         this.waiterLatency = Long.parseLong(waiterLatency);
-        this.passivateInvalidationProbability = Double.parseDouble(passivateInvalidationProbability);
+        this.passivateInvalidationProbability = Double
+            .parseDouble(passivateInvalidationProbability);
     }
 
-    public void configurePool(String maxActive, String maxActivePerKey, String maxIdle, String minIdle, String maxWait,
-        String exhaustedAction, String testOnBorrow, String testOnReturn, String timeBetweenEvictions,
-        String testsPerEviction, String idleTimeout, String testWhileIdle, String lifo, String type, String samplingRate)
+    public void configurePool(String maxActive, String maxActivePerKey,
+                              String maxIdle, String minIdle, String maxWait,
+                              String exhaustedAction, String testOnBorrow,
+                              String testOnReturn, String timeBetweenEvictions,
+                              String testsPerEviction, String idleTimeout,
+                              String testWhileIdle, String lifo, String type,
+                              String samplingRate)
         throws ConfigurationException {
         this.maxActive = Integer.parseInt(maxActive);
         this.maxActivePerKey = Integer.parseInt(maxActivePerKey);
@@ -331,30 +283,24 @@ public class PoolSoak
         this.lifo = Boolean.parseBoolean(lifo);
         this.poolType = type;
         if (exhaustedAction.equals("block")) {
-            this.exhaustedAction = org.apache.commons.pool.impl.GenericObjectPool.WHEN_EXHAUSTED_BLOCK;
+            this.exhaustedAction = 1;
         } else if (exhaustedAction.equals("fail")) {
-            this.exhaustedAction = org.apache.commons.pool.impl.GenericObjectPool.WHEN_EXHAUSTED_FAIL;
-        } else if (exhaustedAction.equals("grow")) {
-            this.exhaustedAction = org.apache.commons.pool.impl.GenericObjectPool.WHEN_EXHAUSTED_GROW;
+            this.exhaustedAction = 0;
         } else {
-            throw new ConfigurationException("Bad configuration setting for exhausted action: " + exhaustedAction);
+            throw new ConfigurationException("Bad configuration setting for exhausted action: " +
+                                             exhaustedAction);
         }
         this.samplingRate = Double.parseDouble(samplingRate);
     }
 
-    public void configureAbandonedConfig(String logAbandoned, String removeAbandoned, String abandonedTimeout) {
+    public void configureAbandonedConfig(String logAbandoned,
+                                         String removeAbandoned,
+                                         String abandonedTimeout) {
         abandonedConfig.setLogAbandoned(Boolean.parseBoolean(logAbandoned));
-        abandonedConfig.setRemoveAbandoned(Boolean.parseBoolean(removeAbandoned));
-        abandonedConfig.setRemoveAbandonedTimeout(Integer.parseInt(abandonedTimeout));
-    }
-
-    // Pool getters for unit tests
-    protected org.apache.commons.pool.impl.GenericObjectPool getGenericObjectPool() {
-        return genericObjectPool;
-    }
-
-    protected org.apache.commons.pool.impl.GenericKeyedObjectPool getGenericKeyedObjectPool() {
-        return genericKeyedObjectPool;
+        abandonedConfig
+            .setRemoveAbandonedOnBorrow(Boolean.parseBoolean(removeAbandoned));
+        abandonedConfig
+            .setRemoveAbandonedTimeout(Integer.parseInt(abandonedTimeout));
     }
 
     public String displayConfig() {
@@ -402,7 +348,7 @@ public class PoolSoak
         buffer.append(abandonedConfig.getLogAbandoned());
         buffer.append("\n");
         buffer.append("  removeAbandoned: ");
-        buffer.append(abandonedConfig.getRemoveAbandoned());
+        buffer.append(abandonedConfig.getRemoveAbandonedOnBorrow());
         buffer.append("\n");
         buffer.append("  abandonedTimeout: ");
         buffer.append(abandonedConfig.getRemoveAbandonedTimeout());
@@ -411,4 +357,8 @@ public class PoolSoak
         return buffer.toString();
     }
 
+    protected GenericObjectPool getGenericObjectPool() {
+        return genericObjectPool2;
+    }
+
 }

Modified: commons/sandbox/performance/trunk/src/pool/build.properties.sample
URL: http://svn.apache.org/viewvc/commons/sandbox/performance/trunk/src/pool/build.properties.sample?rev=1888642&r1=1888641&r2=1888642&view=diff
==============================================================================
--- commons/sandbox/performance/trunk/src/pool/build.properties.sample (original)
+++ commons/sandbox/performance/trunk/src/pool/build.properties.sample Sun Apr 11 22:39:56 2021
@@ -17,10 +17,8 @@
 ###############################################################################
 
 # Remote maven repository
-mavenRepo=http://repo1.maven.org/maven2
+mavenRepo=https://repo1.maven.org/maven2
 
 # Replace with full path to versions of pool, dbcp jars you want to test with
-pool-jar=${user.home}/.m2/repository/commons-pool/commons-pool/1.5.6/commons-pool-1.5.6.jar
 pool2-jar=${user.home}/.m2/repository/org/apache/commons/commons-pool2/2.2/commons-pool2-2.2.jar
-dbcp-jar=${user.home}/.m2/repository/commons-dbcp/commons-dbcp/1.3/commons-dbcp-1.3.jar
 

Modified: commons/sandbox/performance/trunk/src/pool/build.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/performance/trunk/src/pool/build.xml?rev=1888642&r1=1888641&r2=1888642&view=diff
==============================================================================
--- commons/sandbox/performance/trunk/src/pool/build.xml (original)
+++ commons/sandbox/performance/trunk/src/pool/build.xml Sun Apr 11 22:39:56 2021
@@ -29,9 +29,7 @@
   <property file="${component-propfile}"/>
 
   <path id="compile.classpath">
-  	<pathelement location="${pool-jar}"/>
   	<pathelement location="${pool2-jar}"/>
-  	<pathelement location="${dbcp-jar}"/>
     <fileset dir="${lib}">
       <include name="*.jar"/>
     </fileset>

Modified: commons/sandbox/performance/trunk/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/commons/sandbox/performance/trunk/src/site/apt/index.apt?rev=1888642&r1=1888641&r2=1888642&view=diff
==============================================================================
--- commons/sandbox/performance/trunk/src/site/apt/index.apt (original)
+++ commons/sandbox/performance/trunk/src/site/apt/index.apt Sun Apr 11 22:39:56 2021
@@ -59,7 +59,7 @@ Overview
 
  [[1]] Edit the configuration in src/dbcp/config-dbcp.xml
 
- [[2]] Make sure the configured database is running and accepting connections
+ [[2]] If you have configured a real database, make sure it is running and accepting connections
 
  [[3]] Specify the path to the jdbc driver jar and the dbcp and pool jars
  you want to test with in src/dbcp/build.properties 

Modified: commons/sandbox/performance/trunk/src/test/org/apache/commons/performance/pool/PoolSoakTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/performance/trunk/src/test/org/apache/commons/performance/pool/PoolSoakTest.java?rev=1888642&r1=1888641&r2=1888642&view=diff
==============================================================================
--- commons/sandbox/performance/trunk/src/test/org/apache/commons/performance/pool/PoolSoakTest.java (original)
+++ commons/sandbox/performance/trunk/src/test/org/apache/commons/performance/pool/PoolSoakTest.java Sun Apr 11 22:39:56 2021
@@ -1,136 +1,91 @@
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
+ * or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
  */
 package org.apache.commons.performance.pool;
 
-import java.io.InputStream;
 import java.io.IOException;
-import org.apache.commons.dbcp.AbandonedObjectPool;
-import org.apache.commons.pool.impl.GenericObjectPool;
+import java.io.InputStream;
+
+import org.apache.commons.pool2.impl.GenericObjectPool;
+
 import junit.framework.Test;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
-public class PoolSoakTest extends TestCase {
-    
+public class PoolSoakTest
+    extends
+    TestCase {
+
+    public PoolSoakTest(String name) {
+        super(name);
+    }
+
+    public static Test suite() {
+        return new TestSuite(PoolSoakTest.class);
+    }
+
+    protected PoolSoak poolSoak = null;
+
+    public void setUp()
+        throws Exception {
+        poolSoak = new PoolSoak();
+        poolSoak.configure();
+    }
+
+    public void testGenericObjectPoolConfig()
+        throws Exception {
+        /**
+         * Contents of config file <max-active>15</max-active>
+         * <max-idle>15</max-idle> <min-idle>0</min-idle>
+         * <max-wait>-1</max-wait> <!-- block, fail, or grow -->
+         * <exhausted-action>block</exhausted-action>
+         * <test-on-borrow>false</test-on-borrow>
+         * <test-on-return>false</test-on-return>
+         * <time-between-evictions>-1</time-between-evictions>
+         * <tests-per-eviction>3</tests-per-eviction>
+         * <idle-timeout>-1</idle-timeout>
+         * <test-while-idle>false</test-while-idle>
+         **/
+        poolSoak.getDigester().parse(getInputStream("config-pool.xml"));
+        poolSoak.init();
+        GenericObjectPool pool = poolSoak.getGenericObjectPool();
+        assertEquals(15, pool.getMaxTotal());
+        assertEquals(15, pool.getMaxIdle());
+        assertEquals(10, pool.getMinIdle());
+        assertEquals(-1, pool.getMaxWaitMillis());
+        assertEquals(true, pool.getBlockWhenExhausted());
+        assertEquals(false, pool.getTestOnBorrow());
+        assertEquals(false, pool.getTestOnReturn());
+        assertEquals(-1, pool.getTimeBetweenEvictionRunsMillis());
+        assertEquals(3, pool.getNumTestsPerEvictionRun());
+        assertEquals(-1, pool.getMinEvictableIdleTimeMillis());
+        assertEquals(false, pool.getTestWhileIdle());
+    }
+
+    /**
+     * Return an appropriate InputStream for the specified test file (which must
+     * be inside our current package). Borrowed from Commons Digester
+     * RuleTestCase.
+     *
+     * @param name Name of the test file we want
+     * @exception IOException if an input/output error occurs
+     */
+    protected InputStream getInputStream(String name)
+        throws IOException {
+
+        return (this.getClass()
+            .getResourceAsStream("/org/apache/commons/performance/pool/" +
+                                 name));
+    }
 
-  public PoolSoakTest(String name) {
-    super(name);
-  }
-
-
-  public static Test suite() {
-    return new TestSuite(PoolSoakTest.class);
-  }
-  
-  protected PoolSoak poolSoak = null;
-  
-  public void setUp() throws Exception {
-     poolSoak = new PoolSoak();
-     poolSoak.configure();
-  }
-  
-  public void testGenericObjectPoolConfig() throws Exception {
-    /** Contents of config file
-    <max-active>15</max-active>
-    <max-idle>15</max-idle>
-    <min-idle>0</min-idle>
-    <max-wait>-1</max-wait>
-    <!-- block, fail, or grow -->
-    <exhausted-action>block</exhausted-action>
-    <test-on-borrow>false</test-on-borrow>
-    <test-on-return>false</test-on-return>
-    <time-between-evictions>-1</time-between-evictions>
-    <tests-per-eviction>3</tests-per-eviction>
-    <idle-timeout>-1</idle-timeout>
-    <test-while-idle>false</test-while-idle>
-    **/
-     poolSoak.getDigester().parse(getInputStream("config-pool.xml"));
-     poolSoak.init();
-     GenericObjectPool pool = poolSoak.getGenericObjectPool();
-     assertEquals(15, pool.getMaxActive());
-     assertEquals(15, pool.getMaxIdle());
-     assertEquals(10, pool.getMinIdle());
-     assertEquals(-1, pool.getMaxWait());
-     assertEquals(GenericObjectPool.WHEN_EXHAUSTED_BLOCK, 
-             pool.getWhenExhaustedAction());
-     assertEquals(false, pool.getTestOnBorrow());
-     assertEquals(false, pool.getTestOnReturn());
-     assertEquals(-1, pool.getTimeBetweenEvictionRunsMillis());
-     assertEquals(3, pool.getNumTestsPerEvictionRun());
-     assertEquals(-1, pool.getMinEvictableIdleTimeMillis());
-     assertEquals(false, pool.getTestWhileIdle());  
-  } 
-  
-  public void testAbandonedObjectPoolConfig() throws Exception {
-   /* 
-   <pool>
-    <!-- GenericObjectPool or AbandonedObjectPool -->
-    <type>AbandonedObjectPool</type>
-    <max-active>15</max-active>
-    <max-idle>-1</max-idle>
-    <min-idle>0</min-idle>
-    <max-wait>-1</max-wait>
-    <!-- block, fail, or grow -->
-    <exhausted-action>grow</exhausted-action>
-    <test-on-borrow>true</test-on-borrow>
-    <test-on-return>false</test-on-return>
-    <time-between-evictions>-1</time-between-evictions>
-    <tests-per-eviction>3</tests-per-eviction>
-    <idle-timeout>-1</idle-timeout>
-    <test-while-idle>true</test-while-idle>
-  </pool>
-  
-  <!-- Ignored unless pool type is AbandonedObjectPool -->
-  <abandoned-config>
-    <log-abandoned>true</log-abandoned>
-    <remove-abandoned>false</remove-abandoned>
-    <abandoned-timeout>50000</abandoned-timeout>
-  </abandoned-config> 
-  */
-      poolSoak.getDigester().parse(getInputStream("config-abandoned.xml"));
-      poolSoak.init();
-      AbandonedObjectPool pool = (AbandonedObjectPool) poolSoak.getGenericObjectPool();
-      assertEquals(15, pool.getMaxActive());
-      assertEquals(-1, pool.getMaxIdle());
-      assertEquals(0, pool.getMinIdle());
-      assertEquals(-1, pool.getMaxWait());
-      assertEquals(GenericObjectPool.WHEN_EXHAUSTED_GROW, 
-              pool.getWhenExhaustedAction());
-      assertEquals(true, pool.getTestOnBorrow());
-      assertEquals(false, pool.getTestOnReturn());
-      assertEquals(-1, pool.getTimeBetweenEvictionRunsMillis());
-      assertEquals(3, pool.getNumTestsPerEvictionRun());
-      assertEquals(-1, pool.getMinEvictableIdleTimeMillis());
-      assertEquals(true, pool.getTestWhileIdle());      
-  }
-  
-  /**
-   * Return an appropriate InputStream for the specified test file (which
-   * must be inside our current package).
-   * 
-   * Borrowed from Commons Digester RuleTestCase.
-   *
-   * @param name Name of the test file we want
-   * @exception IOException if an input/output error occurs
-   */
-  protected InputStream getInputStream(String name) throws IOException {
-
-      return (this.getClass().getResourceAsStream
-              ("/org/apache/commons/performance/pool/" + name));
-  }
-  
 }

Modified: commons/sandbox/performance/trunk/src/test/org/apache/commons/performance/pool/WaiterTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/performance/trunk/src/test/org/apache/commons/performance/pool/WaiterTest.java?rev=1888642&r1=1888641&r2=1888642&view=diff
==============================================================================
--- commons/sandbox/performance/trunk/src/test/org/apache/commons/performance/pool/WaiterTest.java (original)
+++ commons/sandbox/performance/trunk/src/test/org/apache/commons/performance/pool/WaiterTest.java Sun Apr 11 22:39:56 2021
@@ -1,82 +1,86 @@
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
+ * or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
  */
 package org.apache.commons.performance.pool;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-public class WaiterTest extends TestCase {
-    
-
-  public WaiterTest(String name) {
-    super(name);
-  }
-
-
-  public static Test suite() {
-    return new TestSuite(WaiterTest.class);
-  }
-  
-  protected WaiterFactory factory = null;
-  
-  /*
-   public WaiterFactory(long activateLatency, long destroyLatency,
-            long makeLatency, long passivateLatency, long validateLatency,
-            long waiterLatency,long maxActive)
-   */
-  public void setUp() throws Exception {
-     factory = new WaiterFactory(0, 0, 0, 0, 0, 0, 5);  // All latencies 0, maxActive = 5;
-  }
-  
-  public void testMaxActiveExceeded() throws Exception {
-     try {
-         for (int i = 0; i < 6; i++) {
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import org.apache.commons.pool2.PooledObject;
+import org.junit.Before;
+import org.junit.Test;
+
+public class WaiterTest {
+
+    public WaiterTest() {
+
+    }
+
+    protected WaiterFactory2 factory = null;
+
+    /*
+     * public WaiterFactory(long activateLatency, long destroyLatency, long
+     * makeLatency, long passivateLatency, long validateLatency, long
+     * waiterLatency,long maxActive)
+     */
+    @Before
+    public void setUp()
+        throws Exception {
+        factory = new WaiterFactory2(0, 0, 0, 0, 0, 0, 5); // All latencies 0,
+                                                           // maxActive = 5;
+    }
+
+    @Test
+    public void testMaxActiveExceeded()
+        throws Exception {
+        try {
+            for (int i = 0; i < 6; i++) {
+                factory.makeObject();
+            }
+            fail("Expecting IllegalStateException");
+        } catch (IllegalStateException ex) {
+            // Expected
+        }
+    }
+
+    @Test
+    public void testMaxActive()
+        throws Exception {
+        for (int i = 0; i < 5; i++) {
             factory.makeObject();
-         }
-         fail("Expecting IllegalStateException");
-     } catch (IllegalStateException ex) {
-         // Expected
-     }
-  }
-  
-  public void testMaxActive() throws Exception {
-      for (int i = 0; i < 5; i++) {
-          factory.makeObject();
-      }
-  }
-  
-  public void testgetLastIdleTime() throws Exception {
-      Waiter waiter = (Waiter) factory.makeObject();
-      factory.passivateObject(waiter); // Start last idle time clock
-      Thread.sleep(200);
-      factory.passivateObject(waiter); // Should make no difference
-      Thread.sleep(200);
-      factory.activateObject(waiter);  // last idle time updated
-      assertEquals(400, waiter.getLastIdleTimeMs(), 50);
-      Thread.sleep(200);
-      factory.activateObject(waiter);  // Should make no difference
-      Thread.sleep(200);
-      factory.passivateObject(waiter);
-      Thread.sleep(400);
-      factory.activateObject(waiter);  // Last idle time updated
-      assertEquals(400, waiter.getLastIdleTimeMs(), 50);
-      factory.passivateObject(waiter); // clock started
-      assertEquals(400, waiter.getLastIdleTimeMs(), 50); // but no lastIdleTime update until reactivated
-  }
-  
+        }
+    }
+
+    @Test
+    public void testgetLastIdleTime()
+        throws Exception {
+        PooledObject<Waiter> waiter = factory.makeObject();
+        factory.passivateObject(waiter); // Start last idle time clock
+        Thread.sleep(200);
+        factory.passivateObject(waiter); // Should make no difference
+        Thread.sleep(200);
+        factory.activateObject(waiter); // last idle time updated
+        assertEquals(400, waiter.getObject().getLastIdleTimeMs(), 50);
+        Thread.sleep(200);
+        factory.activateObject(waiter); // Should make no difference
+        Thread.sleep(200);
+        factory.passivateObject(waiter);
+        Thread.sleep(400);
+        factory.activateObject(waiter); // Last idle time updated
+        assertEquals(400, waiter.getObject().getLastIdleTimeMs(), 50);
+        factory.passivateObject(waiter); // clock started
+        // but no lastIdleTime update until reactivated
+        assertEquals(400, waiter.getObject().getLastIdleTimeMs(), 50);
+    }
+
 }

Modified: commons/sandbox/performance/trunk/src/test/org/apache/commons/performance/pool/config-pool.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/performance/trunk/src/test/org/apache/commons/performance/pool/config-pool.xml?rev=1888642&r1=1888641&r2=1888642&view=diff
==============================================================================
--- commons/sandbox/performance/trunk/src/test/org/apache/commons/performance/pool/config-pool.xml (original)
+++ commons/sandbox/performance/trunk/src/test/org/apache/commons/performance/pool/config-pool.xml Sun Apr 11 22:39:56 2021
@@ -33,7 +33,7 @@
   
   <pool>
     <!-- GenericObjectPool or AbandonedObjectPool -->
-    <type>GenericObjectPool</type>
+    <type>GenericObjectPool2</type>
     <max-active>15</max-active>
     <max-idle>15</max-idle>
     <min-idle>10</min-idle>