org.rimudb.configuration
Class C3P0PoolConfiguration

java.lang.Object
  extended by org.rimudb.configuration.C3P0PoolConfiguration
All Implemented Interfaces:
IConnectablePool, IPoolConfiguration

public class C3P0PoolConfiguration
extends java.lang.Object
implements IPoolConfiguration, IConnectablePool

This class is a JavaBean to hold the C3P0 pool configuration parameters loaded from the compounddatabase.xml document.

Author:
Simon Ritchie

Field Summary
 
Fields inherited from interface org.rimudb.configuration.IPoolConfiguration
NO_ISOLATION_SPECIFIED, UNDEFINED
 
Constructor Summary
C3P0PoolConfiguration()
           
 
Method Summary
 IPoolConfiguration copy()
          Make a copy of the configuration.
 int getAcquireIncrement()
          Determines how many connections at a time c3p0 will try to acquire when the pool is exhausted.
 int getAcquireRetryAttempts()
          Defines how many times c3p0 will try to acquire a new Connection from the database before giving up.
 int getAcquireRetryDelay()
          The time in ms that c3p0 will wait between acquire attempts.
 int getCheckoutTimeout()
          The number of milliseconds a client calling getConnection() will wait for a Connection to be checked-in or acquired when the pool is exhausted.
 AutoCommit getDefaultAutoCommit()
           
 TransactionIsolation getDefaultTransactionIsolation()
           
 int getInitialPoolSize()
          Number of Connections a pool will try to acquire upon startup.
 java.lang.String getJdbcDriver()
           
 java.lang.String getJdbcURL()
           
 int getLoginTimeout()
           
 int getMaxConnectionAge()
          Seconds, effectively a time to live.
 int getMaxIdleTime()
          Seconds a Connection can remain pooled but unused before being discarded.
 int getMaxIdleTimeExcessConnections()
          Number of seconds that Connections in excess of minPoolSize should be permitted to remain idle in the pool before being culled.
 int getMaxPoolSize()
          Maximum number of Connections a pool will maintain at any given time.
 int getMaxStatements()
          The size of c3p0's global PreparedStatement cache.
 int getMaxStatementsPerConnection()
          The number of PreparedStatements c3p0 will cache for a single pooled Connection.
 int getMinPoolSize()
          Minimum number of Connections a pool will maintain at any given time.
 int getNumHelperThreads()
          c3p0 is very asynchronous.
 java.lang.String getPassword()
           
 int getPropertyCycle()
          Maximum time in seconds before user configuration constraints are enforced.
 java.lang.String getUserID()
           
 boolean isUseQuotes()
           
 void setAcquireIncrement(int acquireIncrement)
          Determines how many connections at a time c3p0 will try to acquire when the pool is exhausted.
 void setAcquireRetryAttempts(int acquireRetryAttempts)
          Defines how many times c3p0 will try to acquire a new Connection from the database before giving up.
 void setAcquireRetryDelay(int acquireRetryDelay)
          The time in ms that c3p0 will wait between acquire attempts.
 void setCheckoutTimeout(int checkoutTimeout)
          The number of milliseconds a client calling getConnection() will wait for a Connection to be checked-in or acquired when the pool is exhausted.
 void setDefaultAutoCommit(AutoCommit defaultAutoCommit)
           
 void setDefaultTransactionIsolation(TransactionIsolation defaultTransactionIsolation)
           
 void setInitialPoolSize(int initialPoolSize)
          Number of Connections a pool will try to acquire upon startup.
 void setJdbcDriver(java.lang.String jdbcDriver)
           
 void setJdbcURL(java.lang.String jdbcURL)
           
 void setLoginTimeout(int loginTimeout)
           
 void setMaxConnectionAge(int maxConnectionAge)
          Seconds, effectively a time to live.
 void setMaxIdleTime(int maxIdleTime)
          Seconds a Connection can remain pooled but unused before being discarded.
 void setMaxIdleTimeExcessConnections(int maxIdleTimeExcessConnections)
          Number of seconds that Connections in excess of minPoolSize should be permitted to remain idle in the pool before being culled.
 void setMaxPoolSize(int maxPoolSize)
          Maximum number of Connections a pool will maintain at any given time.
 void setMaxStatements(int maxStatements)
          The size of c3p0's global PreparedStatement cache.
 void setMaxStatementsPerConnection(int maxStatementsPerConnection)
          The number of PreparedStatements c3p0 will cache for a single pooled Connection.
 void setMinPoolSize(int minPoolSize)
          Minimum number of Connections a pool will maintain at any given time.
 void setNumHelperThreads(int numHelperThreads)
          c3p0 is very asynchronous.
 void setPassword(java.lang.String password)
           
 void setPropertyCycle(int propertyCycle)
          Maximum time in seconds before user configuration constraints are enforced.
 void setUseQuotes(boolean useQuotes)
           
 void setUserID(java.lang.String userID)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

C3P0PoolConfiguration

public C3P0PoolConfiguration()
Method Detail

copy

public IPoolConfiguration copy()
Make a copy of the configuration.

Specified by:
copy in interface IPoolConfiguration
See Also:
IPoolConfiguration.copy()

getAcquireIncrement

public int getAcquireIncrement()
Determines how many connections at a time c3p0 will try to acquire when the pool is exhausted.

Returns:
int

getAcquireRetryAttempts

public int getAcquireRetryAttempts()
Defines how many times c3p0 will try to acquire a new Connection from the database before giving up. If this value is less than or equal to zero, c3p0 will keep trying to fetch a Connection indefinitely.

Returns:
the acquireRetryAttempts

getAcquireRetryDelay

public int getAcquireRetryDelay()
The time in ms that c3p0 will wait between acquire attempts.

Returns:
int

getCheckoutTimeout

public int getCheckoutTimeout()
The number of milliseconds a client calling getConnection() will wait for a Connection to be checked-in or acquired when the pool is exhausted. Zero means wait indefinitely. Setting any positive value will cause the getConnection() call to time-out and break with an SQLException after the specified number of milliseconds.

Returns:
int

getInitialPoolSize

public int getInitialPoolSize()
Number of Connections a pool will try to acquire upon startup. Should be between minPoolSize and maxPoolSize.

Returns:
int

getLoginTimeout

public int getLoginTimeout()
Returns:
int

getMaxConnectionAge

public int getMaxConnectionAge()
Seconds, effectively a time to live. A Connection older than maxConnectionAge will be destroyed and purged from the pool. This differs from maxIdleTime in that it refers to absolute age. Even a Connection which has not been much idle will be purged from the pool if it exceeds maxConnectionAge. Zero means no maximum absolute age is enforced.

Returns:
int

getMaxIdleTime

public int getMaxIdleTime()
Seconds a Connection can remain pooled but unused before being discarded. Zero means idle connections never expire.

Returns:
int

getMaxIdleTimeExcessConnections

public int getMaxIdleTimeExcessConnections()
Number of seconds that Connections in excess of minPoolSize should be permitted to remain idle in the pool before being culled. Intended for applications that wish to aggressively minimize the number of open Connections, shrinking the pool back towards minPoolSize if, following a spike, the load level diminishes and Connections acquired are no longer needed. If maxIdleTime is set, maxIdleTimeExcessConnections should be smaller if the parameter is to have any effect. Zero means no enforcement, excess Connections are not idled out.

Returns:
int

getMaxPoolSize

public int getMaxPoolSize()
Maximum number of Connections a pool will maintain at any given time.

Returns:
int

getMaxStatements

public int getMaxStatements()
The size of c3p0's global PreparedStatement cache. If both maxStatements and maxStatementsPerConnection are zero, statement caching will not be enabled. If maxStatements is zero but maxStatementsPerConnection is a non-zero value, statement caching will be enabled, but no global limit will be enforced, only the per-connection maximum. maxStatements controls the total number of Statements cached, for all Connections. If set, it should be a fairly large number, as each pooled Connection requires its own, distinct flock of cached statements. As a guide, consider how many distinct PreparedStatements are used frequently in your application, and multiply that number by maxPoolSize to arrive at an appropriate value. Though maxStatements is the JDBC standard parameter for controlling statement caching, users may find c3p0's alternative maxStatementsPerConnection more intuitive to use.

Returns:
int

getMaxStatementsPerConnection

public int getMaxStatementsPerConnection()
The number of PreparedStatements c3p0 will cache for a single pooled Connection. If both maxStatements and maxStatementsPerConnection are zero, statement caching will not be enabled. If maxStatementsPerConnection is zero but maxStatements is a non-zero value, statement caching will be enabled, and a global limit enforced, but otherwise no limit will be set on the number of cached statements for a single Connection. If set, maxStatementsPerConnection should be set to about the number distinct PreparedStatements that are used frequently in your application, plus two or three extra so infrequently statements don't force the more common cached statements to be culled. Though maxStatements is the JDBC standard parameter for controlling statement caching, users may find maxStatementsPerConnection more intuitive to use.

Returns:
int

getMinPoolSize

public int getMinPoolSize()
Minimum number of Connections a pool will maintain at any given time.

Returns:
int

getPropertyCycle

public int getPropertyCycle()
Maximum time in seconds before user configuration constraints are enforced. Determines how frequently maxConnectionAge, maxIdleTime, maxIdleTimeExcessConnections, unreturnedConnectionTimeout are enforced. c3p0 periodically checks the age of Connections to see whether they've timed out. This parameter determines the period. Zero means automatic: A suitable period will be determined by c3p0.

Returns:
int

setAcquireIncrement

public void setAcquireIncrement(int acquireIncrement)
Determines how many connections at a time c3p0 will try to acquire when the pool is exhausted.

Parameters:
acquireIncrement -

setAcquireRetryAttempts

public void setAcquireRetryAttempts(int acquireRetryAttempts)
Defines how many times c3p0 will try to acquire a new Connection from the database before giving up. If this value is less than or equal to zero, c3p0 will keep trying to fetch a Connection indefinitely.

Parameters:
acquireRetryAttempts - the acquireRetryAttempts to set

setAcquireRetryDelay

public void setAcquireRetryDelay(int acquireRetryDelay)
The time in ms that c3p0 will wait between acquire attempts.

Parameters:
acquireRetryDelay - int

setCheckoutTimeout

public void setCheckoutTimeout(int checkoutTimeout)
The number of milliseconds a client calling getConnection() will wait for a Connection to be checked-in or acquired when the pool is exhausted. Zero means wait indefinitely. Setting any positive value will cause the getConnection() call to time-out and break with an SQLException after the specified number of milliseconds.

Parameters:
checkoutTimeout - int

setInitialPoolSize

public void setInitialPoolSize(int initialPoolSize)
Number of Connections a pool will try to acquire upon startup. Should be between minPoolSize and maxPoolSize.

Parameters:
initialPoolSize -

setLoginTimeout

public void setLoginTimeout(int loginTimeout)

setMaxConnectionAge

public void setMaxConnectionAge(int maxConnectionAge)
Seconds, effectively a time to live. A Connection older than maxConnectionAge will be destroyed and purged from the pool. This differs from maxIdleTime in that it refers to absolute age. Even a Connection which has not been much idle will be purged from the pool if it exceeds maxConnectionAge. Zero means no maximum absolute age is enforced.

Parameters:
maxConnectionAge - int

setMaxIdleTime

public void setMaxIdleTime(int maxIdleTime)
Seconds a Connection can remain pooled but unused before being discarded. Zero means idle connections never expire.

Parameters:
maxIdleTime - int

setMaxIdleTimeExcessConnections

public void setMaxIdleTimeExcessConnections(int maxIdleTimeExcessConnections)
Number of seconds that Connections in excess of minPoolSize should be permitted to remain idle in the pool before being culled. Intended for applications that wish to aggressively minimize the number of open Connections, shrinking the pool back towards minPoolSize if, following a spike, the load level diminishes and Connections acquired are no longer needed. If maxIdleTime is set, maxIdleTimeExcessConnections should be smaller if the parameter is to have any effect. Zero means no enforcement, excess Connections are not idled out.

Parameters:
maxIdleTimeExcessConnections - int

setMaxPoolSize

public void setMaxPoolSize(int maxPoolSize)
Maximum number of Connections a pool will maintain at any given time.

Parameters:
maxPoolSize - int

setMaxStatements

public void setMaxStatements(int maxStatements)
The size of c3p0's global PreparedStatement cache. If both maxStatements and maxStatementsPerConnection are zero, statement caching will not be enabled. If maxStatements is zero but maxStatementsPerConnection is a non-zero value, statement caching will be enabled, but no global limit will be enforced, only the per-connection maximum. maxStatements controls the total number of Statements cached, for all Connections. If set, it should be a fairly large number, as each pooled Connection requires its own, distinct flock of cached statements. As a guide, consider how many distinct PreparedStatements are used frequently in your application, and multiply that number by maxPoolSize to arrive at an appropriate value. Though maxStatements is the JDBC standard parameter for controlling statement caching, users may find c3p0's alternative maxStatementsPerConnection more intuitive to use.

Parameters:
maxStatements - int

setMaxStatementsPerConnection

public void setMaxStatementsPerConnection(int maxStatementsPerConnection)
The number of PreparedStatements c3p0 will cache for a single pooled Connection. If both maxStatements and maxStatementsPerConnection are zero, statement caching will not be enabled. If maxStatementsPerConnection is zero but maxStatements is a non-zero value, statement caching will be enabled, and a global limit enforced, but otherwise no limit will be set on the number of cached statements for a single Connection. If set, maxStatementsPerConnection should be set to about the number distinct PreparedStatements that are used frequently in your application, plus two or three extra so infrequently statements don't force the more common cached statements to be culled. Though maxStatements is the JDBC standard parameter for controlling statement caching, users may find maxStatementsPerConnection more intuitive to use.

Parameters:
maxStatementsPerConnection - int

setMinPoolSize

public void setMinPoolSize(int minPoolSize)
Minimum number of Connections a pool will maintain at any given time.

Parameters:
minPoolSize - int

setPropertyCycle

public void setPropertyCycle(int propertyCycle)
Maximum time in seconds before user configuration constraints are enforced. Determines how frequently maxConnectionAge, maxIdleTime, maxIdleTimeExcessConnections, unreturnedConnectionTimeout are enforced. c3p0 periodically checks the age of Connections to see whether they've timed out. This parameter determines the period. Zero means automatic: A suitable period will be determined by c3p0.

Parameters:
propertyCycle - int

setNumHelperThreads

public void setNumHelperThreads(int numHelperThreads)
c3p0 is very asynchronous. Slow JDBC operations are generally performed by helper threads that don't hold contended locks. Spreading these operations over multiple threads can significantly improve performance by allowing multiple operations to be performed simultaneously.

Parameters:
numHelperThreads - int The numHelperThreads to set

getNumHelperThreads

public int getNumHelperThreads()
c3p0 is very asynchronous. Slow JDBC operations are generally performed by helper threads that don't hold contended locks. Spreading these operations over multiple threads can significantly improve performance by allowing multiple operations to be performed simultaneously.

Returns:
numHelperThreads int

setDefaultTransactionIsolation

public void setDefaultTransactionIsolation(TransactionIsolation defaultTransactionIsolation)

getDefaultTransactionIsolation

public TransactionIsolation getDefaultTransactionIsolation()

setDefaultAutoCommit

public void setDefaultAutoCommit(AutoCommit defaultAutoCommit)

getDefaultAutoCommit

public AutoCommit getDefaultAutoCommit()

setUseQuotes

public void setUseQuotes(boolean useQuotes)

isUseQuotes

public boolean isUseQuotes()
Specified by:
isUseQuotes in interface IPoolConfiguration

setJdbcDriver

public void setJdbcDriver(java.lang.String jdbcDriver)

getJdbcDriver

public java.lang.String getJdbcDriver()
Specified by:
getJdbcDriver in interface IConnectablePool

setJdbcURL

public void setJdbcURL(java.lang.String jdbcURL)

getJdbcURL

public java.lang.String getJdbcURL()
Specified by:
getJdbcURL in interface IConnectablePool

setUserID

public void setUserID(java.lang.String userID)

getUserID

public java.lang.String getUserID()
Specified by:
getUserID in interface IConnectablePool

setPassword

public void setPassword(java.lang.String password)

getPassword

public java.lang.String getPassword()
Specified by:
getPassword in interface IConnectablePool


Copyright © 2008-2011 Simon Ritchie. All Rights Reserved.