com.protomatter.jdbc.pool
Class PoolTest
java.lang.Object
|
+--com.protomatter.jdbc.pool.PoolTest
- public class PoolTest
- extends java.lang.Object
A standalone connection pool testing application. Here is an
example config file that will hammer a MySQL database:
#####################################################
##
## Protomatter JDBC Connection Pool test
## harness config file.
##
##
## The classname of the underlying JDBC driver that the
## pool driver will use.
##
jdbc.driver = org.gjt.mm.mysql.Driver
##
## The URL used to connect the underlying driver to
## the database.
##
jdbc.URL = jdbc:mysql://hostname:3306/mysql
##
## Properties for the underlying driver and it's
## connection. The format is "name=val,name=val,..."
##
jdbc.properties = user=root,password=secret
##
## A statement to execute. It doesn't matter what it
## is, it should just not throw an error when executed
## with Statement.executeQuery(...)
##
jdbc.statement = select * from user
##
## A statement that is guaranteed to return at least 1
## row from the database. (for Oracle, this is
## "select 1 from dual", for Sybase and MySQL it's
## "select 1")
##
jdbc.validityCheckStatement = select 1
##
## Number of seconds between pool refreshes by the
## low priority pool refresh thread.
##
pool.refreshThreadCheckInterval = 10
##
## Should the refresh operation be verbose?
##
pool.verboseRefresh = true
##
## Should the pre-checkout validate operation be verbose?
##
pool.verboseValidate = true
##
## The initial size of the pool
##
pool.initialSize = 1
##
## The maximum size that the pool should grow to.
##
pool.maxSize = 5
##
## The time (in milliseconds) to sleep between tries
## to create multiple connections to the database
## (some databases can be overwhelmed by trying to
## open a group of connections too fast)
##
pool.createWaitTime = 2000
##
## If the pool needs to be grown, this is the number of
## connections to allocate at a time.
##
pool.growBlock = 2
##
## Should the pool validate connectione before handing them out?
##
pool.validateOnCheckout = true
##
## For the test, the min and max times (in milliseconds)
## to sleep between tries to access the database. A random
## interval between these times is picked by each thread.
##
test.minSleepTime = 1000
test.maxSleepTime = 2000
##
## The number of test threads to spawn.
##
test.numThreads = 10
##
## Number of times each thread should checkout a
## connection and use it. If this number is -1, the
## test will run forever. If this is set to something
## other than -1, when the run is complete, each thread
## will display statistics about how long it had to
## wait for connections from the pool.
##
test.numRuns = -1
Modify this config file or write your own, and then pass it to
PoolTest as it's first commandline argument, like this:
java com.protomatter.jdbc.pool.PoolTest config.properties
Method Summary |
static void |
main(java.lang.String[] args)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
main
public static void main(java.lang.String[] args)