org.apache.commons.performance.dbcp
Class DBCPSoak

java.lang.Object
  extended by org.apache.commons.performance.LoadGenerator
      extended by org.apache.commons.performance.dbcp.DBCPSoak

public class DBCPSoak
extends LoadGenerator

Configurable load / performance tester for commons dbcp. Uses Commons Digester to parse and load configuration and spawns DBCPClientThread instances to generate load and gather statistics.


Field Summary
 
Fields inherited from class org.apache.commons.performance.LoadGenerator
configFile, cycleType, delayType, digester, logger, maxDelay, minDelay, peakPeriod, rampPeriod, rampType, sigma, troughPeriod
 
Constructor Summary
DBCPSoak()
           
 
Method Summary
protected  void checkDatabase()
           
protected  void cleanUp()
          Close connection pool
protected  void configure()
          Add dbcp configuration to parameters loaded by super.
 void configureAbandonedConfig(String logAbandoned, String removeAbandoned, String abandonedTimeout)
           
 void configureConnectionFactory(String type, String autoCommit, String readOnly, String validationQuery)
           
 void configureDataBase(String driver, String url, String username, String password, String queryType)
           
 void configureDataSource(String type)
           
 void configurePool(String maxActive, String maxIdle, String minIdle, String maxWait, String exhaustedAction, String testOnBorrow, String testOnReturn, String timeBetweenEvictions, String testsPerEviction, String idleTimeout, String testWhileIdle, String type)
           
 void configurePoolableConnectionFactory(String type, String poolPreparedStatements, String maxOpenStatements)
           
 GenericObjectPool getConnectionPool()
           
protected  void init()
          Create connection pool and, if necessary, test table.
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)
           
protected  void makeTable()
          Creates and populates the test table (test_table) used in the load tests.
 
Methods inherited from class org.apache.commons.performance.LoadGenerator
configureRun, execute, getConfigFile, getDigester, getStatistics, parseConfigFile, setConfigFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBCPSoak

public DBCPSoak()
Method Detail

init

protected void init()
             throws Exception
Create connection pool and, if necessary, test table.

Overrides:
init in class LoadGenerator
Throws:
Exception

checkDatabase

protected void checkDatabase()
                      throws Exception
Throws:
Exception

cleanUp

protected void cleanUp()
                throws Exception
Close connection pool

Overrides:
cleanUp in class LoadGenerator
Throws:
Exception

makeClientThread

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)
Specified by:
makeClientThread in class LoadGenerator

configureDataBase

public void configureDataBase(String driver,
                              String url,
                              String username,
                              String password,
                              String queryType)

configureDataSource

public void configureDataSource(String type)

configureConnectionFactory

public void configureConnectionFactory(String type,
                                       String autoCommit,
                                       String readOnly,
                                       String validationQuery)

configurePoolableConnectionFactory

public void configurePoolableConnectionFactory(String type,
                                               String poolPreparedStatements,
                                               String maxOpenStatements)

configurePool

public void configurePool(String maxActive,
                          String maxIdle,
                          String minIdle,
                          String maxWait,
                          String exhaustedAction,
                          String testOnBorrow,
                          String testOnReturn,
                          String timeBetweenEvictions,
                          String testsPerEviction,
                          String idleTimeout,
                          String testWhileIdle,
                          String type)
                   throws ConfigurationException
Throws:
ConfigurationException

configureAbandonedConfig

public void configureAbandonedConfig(String logAbandoned,
                                     String removeAbandoned,
                                     String abandonedTimeout)

makeTable

protected void makeTable()
                  throws Exception
Creates and populates the test table (test_table) used in the load tests. The created table will have 10,000 rows and 3 columns, populated with random data:

Throws:
Exception

configure

protected void configure()
                  throws Exception
Add dbcp configuration to parameters loaded by super. Also set config file name.

Overrides:
configure in class LoadGenerator
Throws:
Exception

getConnectionPool

public GenericObjectPool getConnectionPool()


Copyright © 2007-2010 The Apache Software Foundation. All Rights Reserved.