jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1722514 - in /jmeter/trunk: ./ lib/ licenses/bin/ res/maven/ src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/ xdocs/ xdocs/usermanual/
Date Fri, 01 Jan 2016 17:59:05 GMT
Author: pmouawad
Date: Fri Jan  1 17:59:04 2016
New Revision: 1722514

URL: http://svn.apache.org/viewvc?rev=1722514&view=rev
Log:
Bug 58786 - JDBC Sampler : Replace Excalibur DataSource by more up to date library commons-dbcp2
Bugzilla Id: 58786

Modified:
    jmeter/trunk/build.properties
    jmeter/trunk/build.xml
    jmeter/trunk/eclipse.classpath
    jmeter/trunk/lib/   (props changed)
    jmeter/trunk/lib/aareadme.txt
    jmeter/trunk/licenses/bin/README.txt
    jmeter/trunk/res/maven/ApacheJMeter_parent.pom
    jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElement.java
    jmeter/trunk/xdocs/changes.xml
    jmeter/trunk/xdocs/usermanual/component_reference.xml

Modified: jmeter/trunk/build.properties
URL: http://svn.apache.org/viewvc/jmeter/trunk/build.properties?rev=1722514&r1=1722513&r2=1722514&view=diff
==============================================================================
--- jmeter/trunk/build.properties (original)
+++ jmeter/trunk/build.properties Fri Jan  1 17:59:04 2016
@@ -85,6 +85,11 @@ commons-collections.jar     = commons-co
 commons-collections.loc     = ${maven2.repo}/commons-collections/commons-collections/${commons-collections.version}
 commons-collections.md5     = f54a8510f834a1a57166970bfc982e94
 
+commons-dbcp2.version       = 2.1.1
+commons-dbcp2.jar           = commons-dbcp2-${commons-dbcp2.version}.jar
+commons-dbcp2.loc           = ${maven2.repo}/org/apache/commons/commons-dbcp2/${commons-dbcp2.version}
+commons-dbcp2.md5           = 298897b1e785b933b0522351871cf7ae
+
 commons-httpclient.version  = 3.1
 commons-httpclient.jar      = commons-httpclient-${commons-httpclient.version}.jar
 commons-httpclient.loc      = ${maven2.repo}/commons-httpclient/commons-httpclient/${commons-httpclient.version}
@@ -110,7 +115,6 @@ commons-lang3.jar           = commons-la
 commons-lang3.loc           = ${maven2.repo}/org/apache/commons/commons-lang3/${commons-lang3.version}
 commons-lang3.md5           = 8667a442ee77e509fbe8176b94726eb2
 
-
 commons-logging.version     = 1.2
 commons-logging.jar         = commons-logging-${commons-logging.version}.jar
 commons-logging.loc         = ${maven2.repo}/commons-logging/commons-logging/${commons-logging.version}

Modified: jmeter/trunk/build.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/build.xml?rev=1722514&r1=1722513&r2=1722514&view=diff
==============================================================================
--- jmeter/trunk/build.xml (original)
+++ jmeter/trunk/build.xml Fri Jan  1 17:59:04 2016
@@ -365,6 +365,7 @@
     <include name="${lib.dir}/${beanshell.jar}"/>
     <include name="${lib.dir}/${commons-codec.jar}"/>
     <include name="${lib.dir}/${commons-collections.jar}"/>
+    <include name="${lib.dir}/${commons-dbcp2.jar}"/>
     <include name="${lib.dir}/${commons-httpclient.jar}"/>
     <include name="${lib.dir}/${commons-io.jar}"/>
     <include name="${lib.dir}/${commons-jexl.jar}"/>
@@ -375,12 +376,7 @@
     <include name="${lib.dir}/${commons-net.jar}"/>
     <include name="${lib.dir}/${commons-pool2.jar}"/>
     <include name="${lib.dir}/${dnsjava.jar}"/>
-    <include name="${lib.dir}/${excalibur-datasource.jar}"/>
-    <include name="${lib.dir}/${excalibur-instrument.jar}"/>
     <include name="${lib.dir}/${excalibur-logger.jar}"/>
-    <include name="${lib.dir}/${excalibur-pool-api.jar}"/>
-    <include name="${lib.dir}/${excalibur-pool-impl.jar}"/>
-    <include name="${lib.dir}/${excalibur-pool-instrumented.jar}"/>
   	<include name="${lib.dir}/${freemarker.jar}"/>
     <include name="${lib.dir}/${htmllexer.jar}"/>
     <include name="${lib.dir}/${htmlparser.jar}"/>
@@ -442,6 +438,7 @@
     <pathelement location="${lib.dir}/${beanshell.jar}"/>
     <pathelement location="${lib.dir}/${commons-codec.jar}"/>
     <pathelement location="${lib.dir}/${commons-collections.jar}"/>
+  	<pathelement location="${lib.dir}/${commons-dbcp2.jar}"/>
     <pathelement location="${lib.dir}/${commons-httpclient.jar}"/>
     <pathelement location="${lib.dir}/${commons-io.jar}"/>
     <pathelement location="${lib.dir}/${commons-jexl.jar}"/>
@@ -452,12 +449,7 @@
     <pathelement location="${lib.dir}/${commons-net.jar}"/>
     <pathelement location="${lib.dir}/${commons-pool2.jar}"/>
     <pathelement location="${lib.dir}/${dnsjava.jar}"/>
-    <pathelement location="${lib.dir}/${excalibur-datasource.jar}"/>
-    <pathelement location="${lib.dir}/${excalibur-instrument.jar}"/>
     <pathelement location="${lib.dir}/${excalibur-logger.jar}"/>
-    <pathelement location="${lib.dir}/${excalibur-pool-api.jar}"/>
-    <pathelement location="${lib.dir}/${excalibur-pool-impl.jar}"/>
-    <pathelement location="${lib.dir}/${excalibur-pool-instrumented.jar}"/>
   	<pathelement location="${lib.dir}/${freemarker.jar}"/>
     <pathelement location="${lib.dir}/${htmllexer.jar}"/>
     <pathelement location="${lib.dir}/${htmlparser.jar}"/>
@@ -488,7 +480,7 @@
     <pathelement location="${lib.dir}/${jtidy.jar}"/>
     <pathelement location="${lib.dir}/${tika-core.jar}"/>
     <pathelement location="${lib.dir}/${tika-parsers.jar}"/>
-    <pathelement location="${lib.dir}/${xalan.jar}"/>
+  	<pathelement location="${lib.dir}/${xalan.jar}"/>
     <pathelement location="${lib.dir}/${xerces.jar}"/>
     <pathelement location="${lib.dir}/${xml-apis.jar}"/>
     <pathelement location="${lib.dir}/${xmlgraphics-commons.jar}"/>
@@ -871,7 +863,7 @@
   <target name="package" depends="compile, prepare-resources, package-only"
      description="Compile everything and create the jars"/>
 
-  <target name="package-and-check" depends="package, checkstyle" 
+  <target name="package-and-check" depends="clean, package, checkstyle" 
      description="Compile, create jars and apply checkstyle before commiting code"/>
 
   <target name="prepare-resources"
@@ -2843,6 +2835,7 @@ run JMeter unless all the JMeter jars ar
         <process_jarfile jarname="beanshell"/>
         <process_jarfile jarname="commons-codec"/>
         <process_jarfile jarname="commons-collections"/>
+    	<process_jarfile jarname="commons-dbcp2"/>
         <process_jarfile jarname="commons-httpclient"/>
         <process_jarfile jarname="commons-io"/>
         <process_jarfile jarname="commons-jexl"/>
@@ -2853,12 +2846,7 @@ run JMeter unless all the JMeter jars ar
         <process_jarfile jarname="commons-net"/>
     	<process_jarfile jarname="commons-pool2"/>
         <process_jarfile jarname="dnsjava"/>
-        <process_jarfile jarname="excalibur-datasource"/>
-        <process_jarfile jarname="excalibur-instrument"/>
         <process_jarfile jarname="excalibur-logger"/>
-        <process_jarfile jarname="excalibur-pool-api"/>
-        <process_jarfile jarname="excalibur-pool-impl"/>
-        <process_jarfile jarname="excalibur-pool-instrumented"/>
         <process_jarfile jarname="freemarker"/>
         <process_jarfile jarname="htmllexer"/>
         <process_jarfile jarname="htmlparser"/>
@@ -2925,7 +2913,6 @@ run JMeter unless all the JMeter jars ar
         <delete verbose="true">
           <fileset dir="${lib.api}" includes="bcmail-jdk15-*.jar bcprov-jdk15-*.jar"/>
           <!-- tidy up old pool jar -->
-          <fileset dir="${lib.dir}" includes="excalibur-pool-1.2.jar"/>
         </delete>
         <antcall target="_process_all_jars">
             <param name="_get_file" value="true"/>

Modified: jmeter/trunk/eclipse.classpath
URL: http://svn.apache.org/viewvc/jmeter/trunk/eclipse.classpath?rev=1722514&r1=1722513&r2=1722514&view=diff
==============================================================================
--- jmeter/trunk/eclipse.classpath (original)
+++ jmeter/trunk/eclipse.classpath Fri Jan  1 17:59:04 2016
@@ -48,6 +48,7 @@
 	<classpathentry kind="lib" path="lib/bsh-2.0b5.jar"/>
 	<classpathentry kind="lib" path="lib/commons-codec-1.10.jar"/>
 	<classpathentry kind="lib" path="lib/commons-collections-3.2.2.jar"/>
+	<classpathentry kind="lib" path="lib/commons-dbcp2-2.1.1.jar"/>
 	<classpathentry kind="lib" path="lib/commons-httpclient-3.1.jar"/>
 	<classpathentry kind="lib" path="lib/commons-io-2.4.jar"/>
 	<classpathentry kind="lib" path="lib/commons-jexl-1.1.jar"/>
@@ -58,12 +59,7 @@
 	<classpathentry kind="lib" path="lib/commons-net-3.4.jar"/>
 	<classpathentry kind="lib" path="lib/commons-pool2-2.4.2.jar"/>
 	<classpathentry kind="lib" path="lib/dnsjava-2.1.7.jar"/>
-	<classpathentry kind="lib" path="lib/excalibur-datasource-2.1.jar"/>
-	<classpathentry kind="lib" path="lib/excalibur-instrument-1.0.jar"/>
 	<classpathentry kind="lib" path="lib/excalibur-logger-1.1.jar"/>
-	<classpathentry kind="lib" path="lib/excalibur-pool-api-2.1.jar"/>
-	<classpathentry kind="lib" path="lib/excalibur-pool-impl-2.1.jar"/>
-	<classpathentry kind="lib" path="lib/excalibur-pool-instrumented-2.1.jar"/>
 	<classpathentry kind="lib" path="lib/freemarker-2.3.23.jar"/>
 	<classpathentry kind="lib" path="lib/geronimo-jms_1.1_spec-1.1.1.jar"/>
 	<classpathentry kind="lib" path="lib/htmllexer-2.1.jar"/>

Propchange: jmeter/trunk/lib/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Fri Jan  1 17:59:04 2016
@@ -6,6 +6,7 @@ bsh-2.0b5.jar
 bshclient.jar
 commons-codec-1.10.jar
 commons-collections-3.2.2.jar
+commons-dbcp2-2.1.1.jar
 commons-httpclient-3.1.jar
 commons-io-2.4.jar
 commons-jexl-1.1.jar
@@ -16,19 +17,14 @@ commons-math3-3.5.jar
 commons-net-3.4.jar
 commons-pool2-2.4.2.jar
 dnsjava-2.1.7.jar
-excalibur-instrument-1.0.jar
 excalibur-logger-1.1.jar
-excalibur-datasource-2.1.jar
-excalibur-pool-api-2.1.jar
-excalibur-pool-impl-2.1.jar
-excalibur-pool-instrumented-2.1.jar
 freemarker-2.3.23.jar
 geronimo*.jar
 htmllexer-2.1.jar
 htmlparser-2.1.jar
-httpclient-4.2.6.jar
-httpcore-4.2.5.jar
-httpmime-4.2.6.jar
+httpclient-4.5.1.jar
+httpcore-4.4.4.jar
+httpmime-4.5.1.jar
 jcharts-0.7.5.jar
 jdom-1.1.3.jar
 jms*.jar

Modified: jmeter/trunk/lib/aareadme.txt
URL: http://svn.apache.org/viewvc/jmeter/trunk/lib/aareadme.txt?rev=1722514&r1=1722513&r2=1722514&view=diff
==============================================================================
--- jmeter/trunk/lib/aareadme.txt (original)
+++ jmeter/trunk/lib/aareadme.txt Fri Jan  1 17:59:04 2016
@@ -91,22 +91,10 @@ dnsjava-2.1.7
 http://www.dnsjava.org/download/
 - DNSCacheManager
 
-excalibur-datasource-1.1.1 (org.apache.avalon.excalibur.datasource)
---------------------------
-- DataSourceElement (JDBC)
-
-excalibur-instrument-1.0 (org.apache.excalibur.instrument)
-------------------------
-- used by excalibur-datasource
-
 excalibur-logger-1.1 (org.apache.avalon.excalibur.logger)
 --------------------
 - LoggingManager
 
-excalibur-pool-1.2 (org.apache.avalon.excalibur.pool)
-------------------
-- used by excalibur-datasource
-
 freemarker-2.3.23.jar
 ----------------------
 - used by Report/Dashboard feature
@@ -227,6 +215,10 @@ tika-1.11
 http://tika.apache.org/
 - Regular Expression Extractor
 
+commons-dbcp2-2.1.1 (org.apache.commons.dbcp2)
+--------------------------
+- DataSourceElement (JDBC)
+
 velocity-1.7
 --------------
 http://velocity.apache.org/download.cgi

Modified: jmeter/trunk/licenses/bin/README.txt
URL: http://svn.apache.org/viewvc/jmeter/trunk/licenses/bin/README.txt?rev=1722514&r1=1722513&r2=1722514&view=diff
==============================================================================
--- jmeter/trunk/licenses/bin/README.txt (original)
+++ jmeter/trunk/licenses/bin/README.txt Fri Jan  1 17:59:04 2016
@@ -7,6 +7,7 @@ bsf-2.4.0.jar
 bshclient.jar (part of JMeter)
 commons-codec-1.10.jar
 commons-collections-3.2.2.jar
+commons-dbcp2-2.1.1.jar
 commons-httpclient-3.1.jar
 commons-io-2.4.jar
 commons-jexl-1.1.jar
@@ -16,12 +17,7 @@ commons-logging-1.2.jar
 commons-math3-3.5.jar
 commons-net-3.4.jar
 commons-pool2-2.4.2.jar
-excalibur-datasource-2.1.jar
-excalibur-instrument-1.0.jar
 excalibur-logger-1.1.jar
-excalibur-pool-api-2.1.jar
-excalibur-pool-impl-2.1.jar
-excalibur-pool-instrumented-2.1.jar
 geronimo-jms_1.1_spec-1.1.1.jar
 httpclient-4.5.1.jar
 httpcore-4.4.4.jar

Modified: jmeter/trunk/res/maven/ApacheJMeter_parent.pom
URL: http://svn.apache.org/viewvc/jmeter/trunk/res/maven/ApacheJMeter_parent.pom?rev=1722514&r1=1722513&r2=1722514&view=diff
==============================================================================
--- jmeter/trunk/res/maven/ApacheJMeter_parent.pom (original)
+++ jmeter/trunk/res/maven/ApacheJMeter_parent.pom Fri Jan  1 17:59:04 2016
@@ -60,6 +60,7 @@ under the License.
       <bcpkix.version>1.49</bcpkix.version>
       <commons-codec.version>1.10</commons-codec.version>
       <commons-collections.version>3.2.2</commons-collections.version>
+      <commons-dbcp2.version>2.1.1</commons-dbcp2.version>
       <commons-httpclient.version>3.1</commons-httpclient.version>
       <commons-io.version>2.4</commons-io.version>
       <commons-jexl.version>1.1</commons-jexl.version>
@@ -70,13 +71,7 @@ under the License.
       <commons-net.version>3.4</commons-net.version>
       <commons-pool2.version>2.4.2</commons-pool2.version>
       <dnsjava.version>2.1.7</dnsjava.version>
-      <excalibur-datasource.version>2.1</excalibur-datasource.version>
-      <excalibur-instrument.version>1.0</excalibur-instrument.version>
       <excalibur-logger.version>1.1</excalibur-logger.version>
-      <excalibur-pool.version>2.1</excalibur-pool.version>
-      <excalibur-pool-api.version>${excalibur-pool.version}</excalibur-pool-api.version>
-      <excalibur-pool-impl.version>${excalibur-pool.version}</excalibur-pool-impl.version>
-      <excalibur-pool-instrumented.version>${excalibur-pool.version}</excalibur-pool-instrumented.version>
       <freemarker.version>2.3.23</freemarker.version>
       <htmlparser.version>2.1</htmlparser.version>
       <httpclient.version>4.5.1</httpclient.version>
@@ -155,6 +150,11 @@ under the License.
         <version>${commons-collections.version}</version>
       </dependency>
       <dependency>
+        <groupId>org.apache.commons</groupId>
+        <artifactId>commons-dbcp2</artifactId>
+        <version>${commons-dbcp2.version}</version>
+      </dependency>
+      <dependency>
         <groupId>commons-httpclient</groupId>
         <artifactId>commons-httpclient</artifactId>
         <version>${commons-httpclient.version}</version>
@@ -205,46 +205,11 @@ under the License.
         <version>${dnsjava.version}</version>
       </dependency>
       <dependency>
-        <groupId>excalibur-datasource</groupId>
-        <artifactId>excalibur-datasource</artifactId>
-        <version>${excalibur-datasource.version}</version>
-        <exclusions>
-            <exclusion>
-                <groupId>excalibur-fortress</groupId>
-                <artifactId>excalibur-fortress-container-api</artifactId>
-            </exclusion>
-            <exclusion>
-                <groupId>excalibur-fortress</groupId>
-                <artifactId>excalibur-fortress-meta</artifactId>
-            </exclusion>
-        </exclusions>
-      </dependency>
-      <dependency>
-        <groupId>excalibur-instrument</groupId>
-        <artifactId>excalibur-instrument</artifactId>
-        <version>${excalibur-instrument.version}</version>
-      </dependency>
-      <dependency>
         <groupId>excalibur-logger</groupId>
         <artifactId>excalibur-logger</artifactId>
         <version>${excalibur-logger.version}</version>
       </dependency>
       <dependency>
-        <groupId>excalibur-pool</groupId>
-        <artifactId>excalibur-pool-api</artifactId>
-        <version>${excalibur-pool-api.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>excalibur-pool</groupId>
-        <artifactId>excalibur-pool-impl</artifactId>
-        <version>${excalibur-pool-impl.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>excalibur-pool</groupId>
-        <artifactId>excalibur-pool-instrumented</artifactId>
-        <version>${excalibur-pool-instrumented.version}</version>
-      </dependency>
-      <dependency>
         <groupId>org.htmlparser</groupId>
         <artifactId>htmllexer</artifactId>
         <version>${htmlparser.version}</version>

Modified: jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElement.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElement.java?rev=1722514&r1=1722513&r2=1722514&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElement.java
(original)
+++ jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/config/DataSourceElement.java
Fri Jan  1 17:59:04 2016
@@ -24,12 +24,7 @@ import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.avalon.excalibur.datasource.DataSourceComponent;
-import org.apache.avalon.excalibur.datasource.ResourceLimitingJdbcDataSource;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.configuration.DefaultConfiguration;
-import org.apache.avalon.framework.logger.LogKitLogger;
+import org.apache.commons.dbcp2.BasicDataSource;
 import org.apache.jmeter.config.ConfigElement;
 import org.apache.jmeter.testbeans.TestBean;
 import org.apache.jmeter.testbeans.TestBeanHelper;
@@ -42,26 +37,35 @@ import org.apache.jorphan.util.JOrphanUt
 import org.apache.log.Logger;
 
 public class DataSourceElement extends AbstractTestElement
-    implements ConfigElement, TestStateListener, TestBean
-    {
+    implements ConfigElement, TestStateListener, TestBean {
     private static final Logger log = LoggingManager.getLoggerForClass();
 
-    private static final long serialVersionUID = 233L;
+    private static final long serialVersionUID = 234L;
 
-    private transient String dataSource, driver, dbUrl, username, password, checkQuery, poolMax,
connectionAge, timeout,
-            trimInterval,transactionIsolation;
+    private transient String dataSource;
+    private transient String driver;
+    private transient String dbUrl;
+    private transient String username;
+    private transient String password;
+    private transient String checkQuery;
+    private transient String poolMax;
+    private transient String connectionAge;
+    private transient String timeout;
+    private transient String trimInterval;
+    private transient String transactionIsolation;
 
-    private transient boolean keepAlive, autocommit;
+    private transient boolean keepAlive;
+    private transient boolean autocommit;
 
     /*
      *  The datasource is set up by testStarted and cleared by testEnded.
      *  These are called from different threads, so access must be synchronized.
      *  The same instance is called in each case.
     */
-    private transient ResourceLimitingJdbcDataSource excaliburSource;
+    private transient BasicDataSource dbcpDataSource;
 
     // Keep a record of the pre-thread pools so that they can be disposed of at the end of
a test
-    private transient Set<ResourceLimitingJdbcDataSource> perThreadPoolSet;
+    private transient Set<BasicDataSource> perThreadPoolSet;
 
     public DataSourceElement() {
     }
@@ -69,15 +73,23 @@ public class DataSourceElement extends A
     @Override
     public void testEnded() {
         synchronized (this) {
-            if (excaliburSource != null) {
-                excaliburSource.dispose();
+            if (dbcpDataSource != null) {
+                try {
+                    dbcpDataSource.close();
+                } catch (SQLException ex) {
+                    log.error("Error closing pool:"+getName(), ex);
+                }
             }
-            excaliburSource = null;
+            dbcpDataSource = null;
         }
         if (perThreadPoolSet != null) {// in case
-            for(ResourceLimitingJdbcDataSource dsc : perThreadPoolSet){
-                log.debug("Disposing pool: "+dsc.getInstrumentableName()+" @"+System.identityHashCode(dsc));
-                dsc.dispose();
+            for(BasicDataSource dsc : perThreadPoolSet){
+                log.debug("Closing pool: "+ getDataSourceName()+" @"+System.identityHashCode(dsc));
+                try {
+                    dsc.close();
+                } catch (SQLException ex) {
+                    log.error("Error closing pool:"+getName(), ex);
+                }
             }
             perThreadPoolSet=null;
         }
@@ -100,14 +112,14 @@ public class DataSourceElement extends A
             log.error("JDBC data source already defined for: "+poolName);
         } else {
             String maxPool = getPoolMax();
-            perThreadPoolSet = Collections.synchronizedSet(new HashSet<ResourceLimitingJdbcDataSource>());
+            perThreadPoolSet = Collections.synchronizedSet(new HashSet<BasicDataSource>());
             if (maxPool.equals("0")){ // i.e. if we want per thread pooling
                 variables.putObject(poolName, new DataSourceComponentImpl()); // pool will
be created later
             } else {
-                ResourceLimitingJdbcDataSource src=initPool(maxPool);
+                BasicDataSource src = initPool(maxPool);
                 synchronized(this){
-                    excaliburSource = src;
-                    variables.putObject(poolName, new DataSourceComponentImpl(excaliburSource));
+                    dbcpDataSource = src;
+                    variables.putObject(poolName, new DataSourceComponentImpl(dbcpDataSource));
                 }
             }
         }
@@ -122,7 +134,7 @@ public class DataSourceElement extends A
     public Object clone() {
         DataSourceElement el = (DataSourceElement) super.clone();
         synchronized (this) {
-            el.excaliburSource = excaliburSource;
+            el.dbcpDataSource = dbcpDataSource;
             el.perThreadPoolSet = perThreadPoolSet;            
         }
         return el;
@@ -140,8 +152,8 @@ public class DataSourceElement extends A
         if (poolObject == null) {
             throw new SQLException("No pool found named: '" + poolName + "', ensure Variable
Name matches Variable Name of JDBC Connection Configuration");
         } else {
-            if(poolObject instanceof DataSourceComponent) {
-                DataSourceComponent pool = (DataSourceComponent) poolObject;
+            if(poolObject instanceof DataSourceComponentImpl) {
+                DataSourceComponentImpl pool = (DataSourceComponentImpl) poolObject;
                 return pool.getConnection();    
             } else {
                 String errorMsg = "Found object stored under variable:'"+poolName
@@ -156,10 +168,8 @@ public class DataSourceElement extends A
      * Set up the DataSource - maxPool is a parameter, so the same code can
      * also be used for setting up the per-thread pools.
     */
-    private ResourceLimitingJdbcDataSource initPool(String maxPool) {
-        ResourceLimitingJdbcDataSource source = null;
-        source = new ResourceLimitingJdbcDataSource();
-        DefaultConfiguration config = new DefaultConfiguration("rl-jdbc"); // $NON-NLS-1$
+    private BasicDataSource initPool(String maxPool) {
+        BasicDataSource dataSource = new BasicDataSource();
 
         if (log.isDebugEnabled()) {
             StringBuilder sb = new StringBuilder(40);
@@ -173,17 +183,14 @@ public class DataSourceElement extends A
             sb.append(isAutocommit());
             log.debug(sb.toString());
         }
-        DefaultConfiguration poolController = new DefaultConfiguration("pool-controller");
// $NON-NLS-1$
-        poolController.setAttribute("max", maxPool); // $NON-NLS-1$
-        poolController.setAttribute("max-strict", "true"); // $NON-NLS-1$ $NON-NLS-2$
-        poolController.setAttribute("blocking", "true"); // $NON-NLS-1$ $NON-NLS-2$
-        poolController.setAttribute("timeout", getTimeout()); // $NON-NLS-1$
-        poolController.setAttribute("trim-interval", getTrimInterval()); // $NON-NLS-1$
-        config.addChild(poolController);
-
-        DefaultConfiguration autoCommit = new DefaultConfiguration("auto-commit"); // $NON-NLS-1$
-        autoCommit.setValue(String.valueOf(isAutocommit()));
-        config.addChild(autoCommit);
+        int poolSize = Integer.parseInt(maxPool);
+        dataSource.setMinIdle(0);
+        dataSource.setInitialSize(poolSize);
+        dataSource.setMaxIdle(poolSize);
+        dataSource.setMaxTotal(poolSize);
+        dataSource.setMaxWaitMillis(Long.parseLong(getTimeout()));
+
+        dataSource.setDefaultAutoCommit(Boolean.valueOf(isAutocommit()));
 
         if (log.isDebugEnabled()) {
             StringBuilder sb = new StringBuilder(40);
@@ -195,11 +202,22 @@ public class DataSourceElement extends A
             sb.append(getCheckQuery());
             log.debug(sb.toString());
         }
-        DefaultConfiguration cfgKeepAlive = new DefaultConfiguration("keep-alive"); // $NON-NLS-1$
-        cfgKeepAlive.setAttribute("disable", String.valueOf(!isKeepAlive())); // $NON-NLS-1$
-        cfgKeepAlive.setAttribute("age", getConnectionAge()); // $NON-NLS-1$
-        cfgKeepAlive.setValue(getCheckQuery());
-        poolController.addChild(cfgKeepAlive);
+        dataSource.setTestOnBorrow(false);
+        dataSource.setTestOnReturn(false);
+        dataSource.setTestOnCreate(false);
+        dataSource.setTestWhileIdle(false);
+
+        if(isKeepAlive()) {
+            dataSource.setTestWhileIdle(true);
+            dataSource.setValidationQuery(getCheckQuery());
+            dataSource.setMaxConnLifetimeMillis(Long.parseLong(getConnectionAge()));    
       
+            dataSource.setTimeBetweenEvictionRunsMillis(Integer.parseInt(getTrimInterval()));
+        }
+
+        int transactionIsolation = DataSourceElementBeanInfo.getTransactionIsolationMode(getTransactionIsolation());
+        if (transactionIsolation >= 0) {
+            dataSource.setDefaultTransactionIsolation(transactionIsolation);
+        }
 
         String _username = getUsername();
         if (log.isDebugEnabled()) {
@@ -212,38 +230,27 @@ public class DataSourceElement extends A
             sb.append(_username);
             log.debug(sb.toString());
         }
-        DefaultConfiguration cfgDriver = new DefaultConfiguration("driver"); // $NON-NLS-1$
-        cfgDriver.setValue(getDriver());
-        config.addChild(cfgDriver);
-        DefaultConfiguration cfgDbUrl = new DefaultConfiguration("dburl"); // $NON-NLS-1$
-        cfgDbUrl.setValue(getDbUrl());
-        config.addChild(cfgDbUrl);
+        dataSource.setDriverClassName(getDriver());
+        dataSource.setUrl(getDbUrl());
 
         if (_username.length() > 0){
-            DefaultConfiguration cfgUsername = new DefaultConfiguration("user"); // $NON-NLS-1$
-            cfgUsername.setValue(_username);
-            config.addChild(cfgUsername);
-            DefaultConfiguration cfgPassword = new DefaultConfiguration("password"); // $NON-NLS-1$
-            cfgPassword.setValue(getPassword());
-            config.addChild(cfgPassword);
+            dataSource.setUsername(_username);
+            dataSource.setPassword(getPassword());
         }
 
         // log is required to ensure errors are available
-        source.enableLogging(new LogKitLogger(log));
-        try {
-            source.configure(config);
-            source.setInstrumentableName(getDataSource());
-        } catch (ConfigurationException e) {
-            log.error("Could not configure datasource for pool: "+getDataSource(),e);
+        //source.enableLogging(new LogKitLogger(log));
+        if(log.isDebugEnabled()) {
+            log.debug("PoolConfiguration:"+this.dataSource);
         }
-        return source;
+        return dataSource;
     }
 
     // used to hold per-thread singleton connection pools
-    private static final ThreadLocal<Map<String, ResourceLimitingJdbcDataSource>>
perThreadPoolMap =
-        new ThreadLocal<Map<String, ResourceLimitingJdbcDataSource>>(){
+    private static final ThreadLocal<Map<String, BasicDataSource>> perThreadPoolMap
=
+        new ThreadLocal<Map<String, BasicDataSource>>(){
         @Override
-        protected Map<String, ResourceLimitingJdbcDataSource> initialValue() {
+        protected Map<String, BasicDataSource> initialValue() {
             return new HashMap<>();
         }
     };
@@ -253,31 +260,34 @@ public class DataSourceElement extends A
      * and per-thread pools.
      *
      */
-    private class DataSourceComponentImpl implements DataSourceComponent{
+    private class DataSourceComponentImpl {
 
-        private final ResourceLimitingJdbcDataSource sharedDSC;
+        private final BasicDataSource sharedDSC;
 
         DataSourceComponentImpl(){
             sharedDSC=null;
         }
 
-        DataSourceComponentImpl(ResourceLimitingJdbcDataSource p_dsc){
+        DataSourceComponentImpl(BasicDataSource p_dsc){
             sharedDSC=p_dsc;
         }
 
-        @Override
+        /**
+         * @return Connection
+         * @throws SQLException
+         */
         public Connection getConnection() throws SQLException {
             Connection conn = null;
-            ResourceLimitingJdbcDataSource dsc = null;
+            BasicDataSource dsc = null;
             if (sharedDSC != null){ // i.e. shared pool
                 dsc = sharedDSC;
             } else {
-                Map<String, ResourceLimitingJdbcDataSource> poolMap = perThreadPoolMap.get();
-                dsc = poolMap.get(getDataSource());
+                Map<String, BasicDataSource> poolMap = perThreadPoolMap.get();
+                dsc = poolMap.get(getDataSourceName());
                 if (dsc == null){
                     dsc = initPool("1");
-                    poolMap.put(getDataSource(),dsc);
-                    log.debug("Storing pool: "+dsc.getInstrumentableName()+" @"+System.identityHashCode(dsc));
+                    poolMap.put(getDataSourceName(),dsc);
+                    log.debug("Storing pool: "+getName()+" @"+System.identityHashCode(dsc));
                     perThreadPoolSet.add(dsc);
                 }
             }
@@ -298,11 +308,6 @@ public class DataSourceElement extends A
             }
             return conn;
         }
-
-        @Override
-        public void configure(Configuration arg0) throws ConfigurationException {
-        }
-
     }
 
     @Override
@@ -358,6 +363,10 @@ public class DataSourceElement extends A
     public void setDataSource(String dataSource) {
         this.dataSource = dataSource;
     }
+    
+    private String getDataSourceName() {
+        return getDataSource();
+    }
 
     /**
      * @return Returns the dbUrl.

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1722514&r1=1722513&r2=1722514&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Fri Jan  1 17:59:04 2016
@@ -101,6 +101,7 @@ Summary
     <li><bug>57928</bug>Add ability to define protocol (http/https) to
AccessLogSampler GUI. Contributed by Jérémie Lesage (jeremie.lesage at jeci.fr)</li>
     <li><bug>58300</bug> Make existing Java Samplers implement Interruptible</li>
     <li><bug>58160</bug>JMS Publisher : reload file content if file name
changes. Based partly on a patch contributed by Maxime Chassagneux (maxime.chassagneux at
gmail.com)</li>
+    <li><bug>58786</bug>JDBC Sampler : Replace Excalibur DataSource by
more up to date library commons-dbcp2</li>
 </ul>
 
 <h3>Controllers</h3>

Modified: jmeter/trunk/xdocs/usermanual/component_reference.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/usermanual/component_reference.xml?rev=1722514&r1=1722513&r2=1722514&view=diff
==============================================================================
--- jmeter/trunk/xdocs/usermanual/component_reference.xml (original)
+++ jmeter/trunk/xdocs/usermanual/component_reference.xml Fri Jan  1 17:59:04 2016
@@ -4143,7 +4143,7 @@ instead. (see figures 12 and 13).</p>
         </property>
         <property name="Pool timeout" required="Yes">Pool throws an error if the timeout
period is exceeded in the 
         process of trying to retrieve a connection</property>
-        <property name="Idle Cleanup Interval (ms)" required="Yes">This is used to
specify how long idle connections will be maintained in the pool before being closed. For
a complete explanation on how this works, see <a href="http://excalibur.apache.org/apidocs/org/apache/avalon/excalibur/pool/ResourceLimitingPool.html#trim%28%29">ResourceLimitingPool.trim()</a>
(Defaults to "<code>60000</code>", 1 minute)</property>
+        <property name="Idle Cleanup Interval (ms)" required="Yes">This is used to
specify how long idle connections will be maintained in the pool before being closed. (Defaults
to "<code>60000</code>", 1 minute)</property>
         <property name="Auto Commit" required="Yes">Turn auto commit on or off for
the connections.</property>
         <property name="Keep-alive" required="Yes">The keep-alive is used enable a
mechanism to monitor the health of connections. If a connection has not been used for Max
Connection Age (ms) then before returning the connection from a call to <code>getConnection()</code>,
the connection is first used to ping the database to make sure that it is still alive. 
         Setting the age allows the 5 second age to be overridden. Validation Query will be
used to test it.</property>



Mime
View raw message