Author: psteitz Date: Fri Apr 2 22:09:22 2021 New Revision: 1888319 URL: http://svn.apache.org/viewvc?rev=1888319&view=rev Log: Drop unused field, reformat.
Modified: commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/dbcp/DBCPClientThread.java 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=1888319&r1=1888318&r2=1888319&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 Fri Apr 2 22:09:22 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.dbcp; @@ -24,45 +21,52 @@ import java.util.logging.Logger; import javax.sql.DataSource; -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; /** - * Client thread that executes requests in a loop using a configured DataSource, with the number of - * requests, time between requests and query strings governed by constructor parameters. See - * {@link ClientThread ClientThread javadoc} for a description of how times between requests are - * computed. - * + * Client thread that executes requests in a loop using a configured DataSource, + * with the number of requests, time between requests and query strings governed + * by constructor parameters. See {@link ClientThread ClientThread javadoc} for + * a description of how times between requests are computed. */ public class DBCPClientThread - extends ClientThread { + extends + ClientThread { /** Initial segment of query string */ private String queryString = null; + /** Whether or not the query is on the text column */ private boolean textQuery = false; + /** DataSource used to connect */ private DataSource dataSource = null; + /** Type of DataSource */ private DataSourceType type; + /** Database connection */ Connection conn = null; + /** Current query */ String currentQuery = null; /** Statistics on numActive */ private SummaryStatistics numActiveStats = new SummaryStatistics(); + /** Statistics on numIdle */ private SummaryStatistics numIdleStats = new SummaryStatistics(); + /** Sampling rate for numActive, numIdle */ private double samplingRate; - private final RandomDataGenerator random = new RandomDataGenerator(); // Cast targets to query for stats org.apache.commons.dbcp.BasicDataSource dbcp1DS = null; + org.apache.commons.dbcp2.BasicDataSource dbcp2DS = null; + org.apache.tomcat.jdbc.pool.DataSource tomcatDS = null; /** @@ -83,12 +87,15 @@ public class DBCPClientThread * @param dataSource DataSource for connections * @param stats Statistics container */ - public DBCPClientThread(long iterations, long minDelay, long maxDelay, double sigma, String delayType, - String queryType, long rampPeriod, long peakPeriod, long troughPeriod, String cycleType, - String rampType, Logger logger, DataSource dataSource, Statistics stats, double samplingRate) { + public DBCPClientThread(long iterations, long minDelay, long maxDelay, + double sigma, String delayType, String queryType, + long rampPeriod, long peakPeriod, long troughPeriod, + String cycleType, String rampType, Logger logger, + DataSource dataSource, Statistics stats, + 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.dataSource = dataSource; @@ -191,12 +198,14 @@ public class DBCPClientThread 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(numIdleStats, Thread.currentThread().getName(), + "numIdle"); + stats.addStatistics(numActiveStats, Thread.currentThread().getName(), + "numActive"); } private enum DataSourceType { - DBCP1, DBCP2, TOMCAT + DBCP1, DBCP2, TOMCAT } }