com.mchange.v2.c3p0

Class PoolConfig


public final class PoolConfig
extends java.lang.Object

Encapsulates all the configuration information required by a c3p0 pooled DataSource.

Newly constructed PoolConfig objects are preset with default values, which you can define yourself (see below), or you can rely on c3p0's built-in defaults. Just create a PoolConfig object, and change only the properties you care about. Then pass it to the com.mchange.v2.c3p0.DataSources.pooledDataSource(javax.sql.DataSource, com.mchange.v2.c3p0.PoolConfig) method, and you're off!

For those interested in the details, configuration properties can be specified in several ways:

  1. Any property can be set explicitly by calling the corresponding method on a PoolConfig object.
  2. Any property will default to a value defined by a System Property, using the property name shown the table below.
  3. Any property not set in either of the above ways will default to a value found in a user-supplied Java properties file, which may be placed in the resource path of the ClassLoader that loaded the c3p0 libraries under the name /c3p0.properties.
  4. Any property not set in any of the above ways will be defined according c3p0's built-in defaults.

Please see c3p0's main documentation for a description of all available parameters.

Field Summary

static String
ACQUIRE_INCREMENT
static String
ACQUIRE_RETRY_ATTEMPTS
static String
ACQUIRE_RETRY_DELAY
static String
AUTOMATIC_TEST_TABLE
static String
AUTO_COMMIT_ON_CLOSE
static String
BREAK_AFTER_ACQUIRE_FAILURE
static String
CHECKOUT_TIMEOUT
static String
CONNECTION_TESTER_CLASS_NAME
static String
DEFAULT_CONFIG_RSRC_PATH
static String
FACTORY_CLASS_LOCATION
static String
FORCE_IGNORE_UNRESOLVED_TRANSACTIONS
static String
IDLE_CONNECTION_TEST_PERIOD
static String
INITIAL_POOL_SIZE
static String
MAX_IDLE_TIME
static String
MAX_POOL_SIZE
static String
MAX_STATEMENTS
static String
MAX_STATEMENTS_PER_CONNECTION
static String
MIN_POOL_SIZE
static String
NUM_HELPER_THREADS
static String
PREFERRED_TEST_QUERY
static String
PROPERTY_CYCLE
static String
TEST_CONNECTION_ON_CHECKIN
static String
TEST_CONNECTION_ON_CHECKOUT
static String
USES_TRADITIONAL_REFLECTIVE_PROXIES

Constructor Summary

PoolConfig()
PoolConfig(Properties props)

Method Summary

static int
defaultAcquireIncrement()
static int
defaultAcquireRetryAttempts()
static int
defaultAcquireRetryDelay()
static boolean
defaultAutoCommitOnClose()
static String
defaultAutomaticTestTable()
static boolean
defaultBreakAfterAcquireFailure()
static int
defaultCheckoutTimeout()
static String
defaultConnectionTesterClassName()
static String
defaultFactoryClassLocation()
static boolean
defaultForceIgnoreUnresolvedTransactions()
static int
defaultIdleConnectionTestPeriod()
static int
defaultInitialPoolSize()
static int
defaultMaxIdleTime()
static int
defaultMaxPoolSize()
static int
defaultMaxStatements()
static int
defaultMaxStatementsPerConnection()
static int
defaultMinPoolSize()
static int
defaultNumHelperThreads()
static String
defaultPreferredTestQuery()
static int
defaultPropertyCycle()
static boolean
defaultTestConnectionOnCheckin()
static boolean
defaultTestConnectionOnCheckout()
static boolean
defaultUsesTraditionalReflectiveProxies()
int
getAcquireIncrement()
int
getAcquireRetryAttempts()
int
getAcquireRetryDelay()
String
getAutomaticTestTable()
int
getCheckoutTimeout()
String
getConnectionTesterClassName()
String
getFactoryClassLocation()
int
getIdleConnectionTestPeriod()
int
getInitialPoolSize()
int
getMaxIdleTime()
int
getMaxPoolSize()
int
getMaxStatements()
int
getMaxStatementsPerConnection()
int
getMinPoolSize()
int
getNumHelperThreads()
String
getPreferredTestQuery()
int
getPropertyCycle()
boolean
getTestConnectionOnCheckout()
Deprecated. use isTestConnectionOnCheckout
boolean
isAutoCommitOnClose()
boolean
isBreakAfterAcquireFailure()
boolean
isForceIgnoreUnresolvedTransactions()
boolean
isTestConnectionOnCheckin()
boolean
isTestConnectionOnCheckout()
boolean
isUsesTraditionalReflectiveProxies()
void
setAcquireIncrement(int acquireIncrement)
void
setAcquireRetryAttempts(int acquireRetryAttempts)
void
setAcquireRetryDelay(int acquireRetryDelay)
void
setAutoCommitOnClose(boolean autoCommitOnClose)
void
setAutomaticTestTable(String automaticTestTable)
void
setBreakAfterAcquireFailure(boolean breakAfterAcquireFailure)
void
setCheckoutTimeout(int checkoutTimeout)
void
setConnectionTesterClassName(String connectionTesterClassName)
void
setFactoryClassLocation(String factoryClassLocation)
void
setForceIgnoreUnresolvedTransactions(boolean forceIgnoreUnresolvedTransactions)
void
setIdleConnectionTestPeriod(int idleConnectionTestPeriod)
void
setInitialPoolSize(int initialPoolSize)
void
setMaxIdleTime(int maxIdleTime)
void
setMaxPoolSize(int maxPoolSize)
void
setMaxStatements(int maxStatements)
void
setMaxStatementsPerConnection(int maxStatementsPerConnection)
void
setMinPoolSize(int minPoolSize)
void
setNumHelperThreads(int numHelperThreads)
void
setPreferredTestQuery(String preferredTestQuery)
void
setPropertyCycle(int propertyCycle)
void
setTestConnectionOnCheckin(boolean testConnectionOnCheckin)
void
setTestConnectionOnCheckout(boolean testConnectionOnCheckout)
void
setUsesTraditionalReflectiveProxies(boolean usesTraditionalReflectiveProxies)

Field Details

ACQUIRE_INCREMENT

public static final String ACQUIRE_INCREMENT

ACQUIRE_RETRY_ATTEMPTS

public static final String ACQUIRE_RETRY_ATTEMPTS

ACQUIRE_RETRY_DELAY

public static final String ACQUIRE_RETRY_DELAY

AUTOMATIC_TEST_TABLE

public static final String AUTOMATIC_TEST_TABLE

AUTO_COMMIT_ON_CLOSE

public static final String AUTO_COMMIT_ON_CLOSE

BREAK_AFTER_ACQUIRE_FAILURE

public static final String BREAK_AFTER_ACQUIRE_FAILURE

CHECKOUT_TIMEOUT

public static final String CHECKOUT_TIMEOUT

CONNECTION_TESTER_CLASS_NAME

public static final String CONNECTION_TESTER_CLASS_NAME

DEFAULT_CONFIG_RSRC_PATH

public static final String DEFAULT_CONFIG_RSRC_PATH

FACTORY_CLASS_LOCATION

public static final String FACTORY_CLASS_LOCATION

FORCE_IGNORE_UNRESOLVED_TRANSACTIONS

public static final String FORCE_IGNORE_UNRESOLVED_TRANSACTIONS

IDLE_CONNECTION_TEST_PERIOD

public static final String IDLE_CONNECTION_TEST_PERIOD

INITIAL_POOL_SIZE

public static final String INITIAL_POOL_SIZE

MAX_IDLE_TIME

public static final String MAX_IDLE_TIME

MAX_POOL_SIZE

public static final String MAX_POOL_SIZE

MAX_STATEMENTS

public static final String MAX_STATEMENTS

MAX_STATEMENTS_PER_CONNECTION

public static final String MAX_STATEMENTS_PER_CONNECTION

MIN_POOL_SIZE

public static final String MIN_POOL_SIZE

NUM_HELPER_THREADS

public static final String NUM_HELPER_THREADS

PREFERRED_TEST_QUERY

public static final String PREFERRED_TEST_QUERY

PROPERTY_CYCLE

public static final String PROPERTY_CYCLE

TEST_CONNECTION_ON_CHECKIN

public static final String TEST_CONNECTION_ON_CHECKIN

TEST_CONNECTION_ON_CHECKOUT

public static final String TEST_CONNECTION_ON_CHECKOUT

USES_TRADITIONAL_REFLECTIVE_PROXIES

public static final String USES_TRADITIONAL_REFLECTIVE_PROXIES

Constructor Details

PoolConfig

public PoolConfig()
            throws NumberFormatException

PoolConfig

public PoolConfig(Properties props)
            throws NumberFormatException

Method Details

defaultAcquireIncrement

public static int defaultAcquireIncrement()

defaultAcquireRetryAttempts

public static int defaultAcquireRetryAttempts()

defaultAcquireRetryDelay

public static int defaultAcquireRetryDelay()

defaultAutoCommitOnClose

public static boolean defaultAutoCommitOnClose()

defaultAutomaticTestTable

public static String defaultAutomaticTestTable()

defaultBreakAfterAcquireFailure

public static boolean defaultBreakAfterAcquireFailure()

defaultCheckoutTimeout

public static int defaultCheckoutTimeout()

defaultConnectionTesterClassName

public static String defaultConnectionTesterClassName()

defaultFactoryClassLocation

public static String defaultFactoryClassLocation()

defaultForceIgnoreUnresolvedTransactions

public static boolean defaultForceIgnoreUnresolvedTransactions()

defaultIdleConnectionTestPeriod

public static int defaultIdleConnectionTestPeriod()

defaultInitialPoolSize

public static int defaultInitialPoolSize()

defaultMaxIdleTime

public static int defaultMaxIdleTime()

defaultMaxPoolSize

public static int defaultMaxPoolSize()

defaultMaxStatements

public static int defaultMaxStatements()

defaultMaxStatementsPerConnection

public static int defaultMaxStatementsPerConnection()

defaultMinPoolSize

public static int defaultMinPoolSize()

defaultNumHelperThreads

public static int defaultNumHelperThreads()

defaultPreferredTestQuery

public static String defaultPreferredTestQuery()

defaultPropertyCycle

public static int defaultPropertyCycle()

defaultTestConnectionOnCheckin

public static boolean defaultTestConnectionOnCheckin()

defaultTestConnectionOnCheckout

public static boolean defaultTestConnectionOnCheckout()

defaultUsesTraditionalReflectiveProxies

public static boolean defaultUsesTraditionalReflectiveProxies()

getAcquireIncrement

public int getAcquireIncrement()

getAcquireRetryAttempts

public int getAcquireRetryAttempts()

getAcquireRetryDelay

public int getAcquireRetryDelay()

getAutomaticTestTable

public String getAutomaticTestTable()

getCheckoutTimeout

public int getCheckoutTimeout()

getConnectionTesterClassName

public String getConnectionTesterClassName()

getFactoryClassLocation

public String getFactoryClassLocation()

getIdleConnectionTestPeriod

public int getIdleConnectionTestPeriod()

getInitialPoolSize

public int getInitialPoolSize()

getMaxIdleTime

public int getMaxIdleTime()

getMaxPoolSize

public int getMaxPoolSize()

getMaxStatements

public int getMaxStatements()

getMaxStatementsPerConnection

public int getMaxStatementsPerConnection()

getMinPoolSize

public int getMinPoolSize()

getNumHelperThreads

public int getNumHelperThreads()

getPreferredTestQuery

public String getPreferredTestQuery()

getPropertyCycle

public int getPropertyCycle()

getTestConnectionOnCheckout

public boolean getTestConnectionOnCheckout()

Deprecated. use isTestConnectionOnCheckout


isAutoCommitOnClose

public boolean isAutoCommitOnClose()

isBreakAfterAcquireFailure

public boolean isBreakAfterAcquireFailure()

isForceIgnoreUnresolvedTransactions

public boolean isForceIgnoreUnresolvedTransactions()

isTestConnectionOnCheckin

public boolean isTestConnectionOnCheckin()

isTestConnectionOnCheckout

public boolean isTestConnectionOnCheckout()

isUsesTraditionalReflectiveProxies

public boolean isUsesTraditionalReflectiveProxies()

setAcquireIncrement

public void setAcquireIncrement(int acquireIncrement)

setAcquireRetryAttempts

public void setAcquireRetryAttempts(int acquireRetryAttempts)

setAcquireRetryDelay

public void setAcquireRetryDelay(int acquireRetryDelay)

setAutoCommitOnClose

public void setAutoCommitOnClose(boolean autoCommitOnClose)

setAutomaticTestTable

public void setAutomaticTestTable(String automaticTestTable)

setBreakAfterAcquireFailure

public void setBreakAfterAcquireFailure(boolean breakAfterAcquireFailure)

setCheckoutTimeout

public void setCheckoutTimeout(int checkoutTimeout)

setConnectionTesterClassName

public void setConnectionTesterClassName(String connectionTesterClassName)

setFactoryClassLocation

public void setFactoryClassLocation(String factoryClassLocation)

setForceIgnoreUnresolvedTransactions

public void setForceIgnoreUnresolvedTransactions(boolean forceIgnoreUnresolvedTransactions)

setIdleConnectionTestPeriod

public void setIdleConnectionTestPeriod(int idleConnectionTestPeriod)

setInitialPoolSize

public void setInitialPoolSize(int initialPoolSize)

setMaxIdleTime

public void setMaxIdleTime(int maxIdleTime)

setMaxPoolSize

public void setMaxPoolSize(int maxPoolSize)

setMaxStatements

public void setMaxStatements(int maxStatements)

setMaxStatementsPerConnection

public void setMaxStatementsPerConnection(int maxStatementsPerConnection)

setMinPoolSize

public void setMinPoolSize(int minPoolSize)

setNumHelperThreads

public void setNumHelperThreads(int numHelperThreads)

setPreferredTestQuery

public void setPreferredTestQuery(String preferredTestQuery)

setPropertyCycle

public void setPropertyCycle(int propertyCycle)

setTestConnectionOnCheckin

public void setTestConnectionOnCheckin(boolean testConnectionOnCheckin)

setTestConnectionOnCheckout

public void setTestConnectionOnCheckout(boolean testConnectionOnCheckout)

setUsesTraditionalReflectiveProxies

public void setUsesTraditionalReflectiveProxies(boolean usesTraditionalReflectiveProxies)