public class BoneCPConfig extends java.lang.Object implements BoneCPConfigMBean, java.lang.Cloneable, java.io.Serializable
限定符和类型 | 字段和说明 |
---|---|
private int |
acquireIncrement
Number of new connections to create in 1 batch.
|
private int |
acquireRetryAttempts
After attempting to acquire a connection and failing, try to connect these many times before giving up.
|
private long |
acquireRetryDelayInMs
After attempting to acquire a connection and failing, wait for this value before attempting to acquire a new connection again.
|
private java.lang.ClassLoader |
classLoader
Classloader to use when loading the JDBC driver.
|
private boolean |
closeConnectionWatch
If set to true, create a new thread that monitors a connection and displays warnings if application failed to
close the connection.
|
private long |
closeConnectionWatchTimeoutInMs
Time in ms to wait for close connection watch thread.
|
private static java.lang.String |
CONFIG_DS_TOSTRING
For toString().
|
private static java.lang.String |
CONFIG_TOSTRING
For toString().
|
private java.lang.String |
configFile
Config property.
|
private ConnectionHook |
connectionHook
Hook class (external).
|
private java.lang.String |
connectionHookClassName
Connection hook class name.
|
private java.lang.String |
connectionTestStatement
SQL statement to use for keep-alive/test of connection.
|
private long |
connectionTimeoutInMs
Time to wait before a call to getConnection() times out and returns an error.
|
private javax.sql.DataSource |
datasourceBean
If set, use datasourceBean.getConnection() to obtain a new connection.
|
private java.lang.Boolean |
defaultAutoCommit
The default auto-commit state of created connections.
|
private java.lang.String |
defaultCatalog
The default catalog state of created connections.
|
private java.lang.Boolean |
defaultReadOnly
The default read-only state of created connections.
|
private java.lang.String |
defaultTransactionIsolation
The default transaction isolation state of created connections.
|
private int |
defaultTransactionIsolationValue
The parsed transaction isolation value.
|
private boolean |
disableConnectionTracking
Disable connection tracking.
|
private boolean |
disableJMX
Set to true to disable JMX.
|
private java.util.Properties |
driverProperties
Used when the alternate way of obtaining a connection is required
|
private boolean |
externalAuth
If true, stop caring about username/password when obtaining raw connections.
|
private long |
idleConnectionTestPeriodInSeconds
Connections older than this are sent a keep-alive statement.
|
private long |
idleMaxAgeInSeconds
Maximum age of an unused connection before it is closed off.
|
private java.lang.String |
initSQL
Query to send once per connection to the database.
|
private java.lang.String |
jdbcUrl
DB connection string.
|
private boolean |
lazyInit
If set to true, the connection pool will remain empty until the first connection is obtained.
|
private static Logger |
logger
Logger class.
|
private boolean |
logStatementsEnabled
If set to true, log SQL statements being executed.
|
private long |
maxConnectionAgeInSeconds
A connection older than maxConnectionAge will be destroyed and purged from the pool.
|
private int |
maxConnectionsPerPartition
Max number of connections per partition.
|
private int |
minConnectionsPerPartition
Min number of connections per partition.
|
private int |
partitionCount
Number of partitions.
|
private java.lang.String |
password
Password to use.
|
private static java.lang.String |
PASSWORD
Constant.
|
private int |
poolAvailabilityThreshold
Create more connections when we hit x% of our possible number of connections.
|
private java.lang.String |
poolName
Name of the pool for JMX and thread names.
|
private long |
queryExecuteTimeLimitInMs
Queries taking longer than this limit to execute are logged.
|
private int |
releaseHelperThreads
Number of release-connection helper threads to create per partition.
|
private static long |
serialVersionUID
Serialization UID.
|
private java.lang.String |
serviceOrder
Queue mode.
|
private int |
statementReleaseHelperThreads
Number of statement release helper threads to create.
|
private int |
statementsCachedPerConnection
No of statements that can be cached per connection.
|
private int |
statementsCacheSize
Min no of prepared statements to cache.
|
private boolean |
statisticsEnabled
If true, keep track of some statistics.
|
private boolean |
transactionRecoveryEnabled
If set to true, stores all activity on this connection to allow for replaying it again.
|
private static java.lang.String |
USER
Constant.
|
private java.lang.String |
username
User name to use.
|
构造器和说明 |
---|
BoneCPConfig()
Default constructor.
|
BoneCPConfig(java.io.InputStream xmlConfigFile,
java.lang.String sectionName)
Initialise the configuration by loading an XML file containing the settings.
|
BoneCPConfig(java.util.Properties props)
Creates a new config using the given properties.
|
BoneCPConfig(java.lang.String sectionName)
Initialize the configuration by loading bonecp-config.xml containing the settings.
|
限定符和类型 | 方法和说明 |
---|---|
BoneCPConfig |
clone() |
int |
getAcquireIncrement()
Gets the acquireIncrement property.
|
int |
getAcquireRetryAttempts()
After attempting to acquire a connection and failing, try to connect these many times before giving up.
|
long |
getAcquireRetryDelay()
已过时。
Use
getAcquireRetryDelayInMs() instead. |
long |
getAcquireRetryDelay(java.util.concurrent.TimeUnit timeUnit)
Returns the acquireRetryDelay setting with the specified granularity.
|
long |
getAcquireRetryDelayInMs()
Returns the number of ms to wait before attempting to obtain a connection again after a failure.
|
java.lang.ClassLoader |
getClassLoader()
Returns the currently active classloader.
|
long |
getCloseConnectionWatchTimeout()
已过时。
Use
getCloseConnectionWatchTimeoutInMs() instead |
long |
getCloseConnectionWatchTimeout(java.util.concurrent.TimeUnit timeUnit)
Returns the closeConnectionWatchTimeout with the specified granularity.
|
long |
getCloseConnectionWatchTimeoutInMs()
Returns the no of ms to wait when close connection watch threads are enabled. 0 = wait forever.
|
java.lang.String |
getConfigFile()
Returns the configFile field.
|
ConnectionHook |
getConnectionHook()
Returns the connection hook class.
|
java.lang.String |
getConnectionHookClassName()
Returns the connection hook class name as passed via the setter
|
java.lang.String |
getConnectionTestStatement()
Gets connectionTestStatement
|
long |
getConnectionTimeout()
已过时。
Use
getConnectionTimeoutInMs() instead. |
long |
getConnectionTimeout(java.util.concurrent.TimeUnit timeUnit)
Returns the connectionTimeout with the specified granularity.
|
long |
getConnectionTimeoutInMs()
Returns the maximum time (in milliseconds) to wait before a call to getConnection is timed out.
|
javax.sql.DataSource |
getDatasourceBean()
Returns the bean being used to return a connection.
|
java.lang.Boolean |
getDefaultAutoCommit()
Returns the defaultAutoCommit field.
|
java.lang.String |
getDefaultCatalog()
Returns the defaultCatalog field.
|
java.lang.Boolean |
getDefaultReadOnly()
Returns the defaultReadOnly field.
|
java.lang.String |
getDefaultTransactionIsolation()
Returns the defaultTransactionIsolation field.
|
protected int |
getDefaultTransactionIsolationValue()
Returns the defaultTransactionIsolationValue field.
|
java.util.Properties |
getDriverProperties()
Returns the currently configured driver properties.
|
long |
getIdleConnectionTestPeriod()
已过时。
Please use
getIdleConnectionTestPeriodInMinutes() instead. |
long |
getIdleConnectionTestPeriod(java.util.concurrent.TimeUnit timeUnit)
Returns the idleConnectionTestPeriod with the specified granularity.
|
long |
getIdleConnectionTestPeriodInMinutes()
Gets the currently set idleConnectionTestPeriodInMinutes.
|
long |
getIdleMaxAge()
已过时。
Use
getIdleMaxAgeInMinutes() instead |
long |
getIdleMaxAge(java.util.concurrent.TimeUnit timeUnit)
Returns the idleMaxAge with the specified granularity.
|
long |
getIdleMaxAgeInMinutes()
Returns the idleMaxAge currently set.
|
java.lang.String |
getInitSQL()
Returns the initSQL parameter.
|
java.lang.String |
getJdbcUrl()
Gets the configured JDBC URL
|
long |
getMaxConnectionAge()
已过时。
Please use
getMaxConnectionAgeInSeconds() instead. |
long |
getMaxConnectionAge(java.util.concurrent.TimeUnit timeUnit)
Returns the maxConnectionAge with the specified granularity.
|
long |
getMaxConnectionAgeInSeconds()
Returns the maxConnectionAge field in seconds
|
int |
getMaxConnectionsPerPartition()
Gets the maximum number of connections that will be contained in every partition.
|
int |
getMinConnectionsPerPartition()
Gets the minimum number of connections that will be contained in every partition.
|
int |
getPartitionCount()
Gets the number of currently defined partitions.
|
java.lang.String |
getPassword()
Gets password to use for connections
|
int |
getPoolAvailabilityThreshold()
Returns the pool watch connection threshold value.
|
java.lang.String |
getPoolName()
Returns the name of the pool for JMX and thread names.
|
int |
getPreparedStatementCacheSize()
已过时。
|
int |
getPreparedStatementsCacheSize()
已过时。
|
long |
getQueryExecuteTimeLimit()
已过时。
Use
getQueryExecuteTimeLimitInMs() instead. |
long |
getQueryExecuteTimeLimit(java.util.concurrent.TimeUnit timeUnit)
Returns the queryExecuteTimeLimit setting with the specified granularity.
|
long |
getQueryExecuteTimeLimitInMs()
Return the query execute time limit.
|
int |
getReleaseHelperThreads()
Gets number of release-connection helper threads to create per partition.
|
java.lang.String |
getServiceOrder()
Returns the serviceOrder field.
|
int |
getStatementCacheSize()
已过时。
|
int |
getStatementReleaseHelperThreads()
Returns the statementHelperThreads field.
|
int |
getStatementsCachedPerConnection()
已过时。
|
int |
getStatementsCacheSize()
Gets statementsCacheSize setting.
|
java.lang.String |
getUsername()
Gets username to use for the connections.
|
boolean |
hasSameConfiguration(BoneCPConfig that)
Returns true if this instance has the same config as a given config.
|
boolean |
isCloseConnectionWatch()
Returns if BoneCP is configured to create a helper thread to watch over connection acquires that are never released (or released
twice).
|
boolean |
isDisableConnectionTracking()
Returns true if connection tracking has been disabled.
|
boolean |
isDisableJMX()
Return true if JMX is disabled.
|
boolean |
isExternalAuth()
Returns the current externalAuth setting.
|
boolean |
isLazyInit()
Returns true if connection pool is to be initialized lazily.
|
boolean |
isLogStatementsEnabled()
Returns true if SQL logging is currently enabled, false otherwise.
|
boolean |
isStatisticsEnabled()
Returns the statisticsEnabled field.
|
boolean |
isTransactionRecoveryEnabled()
Returns true if the pool is configured to record all transaction activity and replay the transaction automatically in case
of connection failures.
|
protected java.lang.Class<?> |
loadClass(java.lang.String clazz)
Loads the given class, respecting the given classloader.
|
protected void |
loadProperties(java.lang.String filename)
Loads the given properties file using the classloader.
|
private java.lang.String |
lowerFirst(java.lang.String name)
Lowercases the first character.
|
private java.util.Properties |
parseXML(org.w3c.dom.Document doc,
java.lang.String sectionName)
Parses the given XML doc to extract the properties and return them into a java.util.Properties.
|
void |
sanitize()
Performs validation on the config object.
|
void |
setAcquireIncrement(int acquireIncrement)
Sets the acquireIncrement property.
|
void |
setAcquireRetryAttempts(int acquireRetryAttempts)
After attempting to acquire a connection and failing, try to connect these many times before giving up.
|
void |
setAcquireRetryDelay(int acquireRetryDelayInMs)
已过时。
|
void |
setAcquireRetryDelay(long acquireRetryDelay,
java.util.concurrent.TimeUnit timeUnit)
Sets the number of ms to wait before attempting to obtain a connection again after a failure.
|
void |
setAcquireRetryDelayInMs(long acquireRetryDelay)
Sets the number of ms to wait before attempting to obtain a connection again after a failure.
|
void |
setClassLoader(java.lang.ClassLoader classLoader)
Sets the classloader to use to load JDBC driver and hooks (set to null to use default).
|
void |
setCloseConnectionWatch(boolean closeConnectionWatch)
Instruct the pool to create a helper thread to watch over connection acquires that are never released (or released twice).
|
void |
setCloseConnectionWatchTimeout(long closeConnectionWatchTimeout)
已过时。
Use
setCloseConnectionWatchTimeoutInMs(long) instead |
void |
setCloseConnectionWatchTimeout(long closeConnectionWatchTimeout,
java.util.concurrent.TimeUnit timeUnit)
Sets the time to wait when close connection watch threads are enabled. 0 = wait forever.
|
void |
setCloseConnectionWatchTimeoutInMs(long closeConnectionWatchTimeout)
Sets the no of ms to wait when close connection watch threads are enabled. 0 = wait forever.
|
void |
setConfigFile(java.lang.String configFile)
Sets the configFile.
|
void |
setConnectionHook(ConnectionHook connectionHook)
Sets the connection hook.
|
void |
setConnectionHookClassName(java.lang.String connectionHookClassName)
Sets the connection hook class name.
|
void |
setConnectionTestStatement(java.lang.String connectionTestStatement)
Sets the connection test statement.
|
void |
setConnectionTimeout(long connectionTimeout)
已过时。
Use
setConnectionTimeoutInMs(long) instead. |
void |
setConnectionTimeout(long connectionTimeout,
java.util.concurrent.TimeUnit timeUnit)
Sets the maximum time to wait before a call to getConnection is timed out.
|
void |
setConnectionTimeoutInMs(long connectionTimeoutinMs)
Sets the maximum time (in milliseconds) to wait before a call to getConnection is timed out.
|
void |
setDatasourceBean(javax.sql.DataSource datasourceBean)
If set, use datasourceBean.getConnection() to obtain a new connection instead of Driver.getConnection().
|
void |
setDefaultAutoCommit(java.lang.Boolean defaultAutoCommit)
Sets the defaultAutoCommit setting for newly created connections.
|
void |
setDefaultCatalog(java.lang.String defaultCatalog)
Sets the defaultCatalog setting for newly created connections.
|
void |
setDefaultReadOnly(java.lang.Boolean defaultReadOnly)
Sets the defaultReadOnly setting for newly created connections.
|
void |
setDefaultTransactionIsolation(java.lang.String defaultTransactionIsolation)
Sets the defaultTransactionIsolation.
|
protected void |
setDefaultTransactionIsolationValue(int defaultTransactionIsolationValue)
Sets the defaultTransactionIsolationValue.
|
void |
setDisableConnectionTracking(boolean disableConnectionTracking)
If set to true, the pool will not monitor connections for proper closure.
|
void |
setDisableJMX(boolean disableJMX)
Set to true to disable JMX.
|
void |
setDriverProperties(java.util.Properties driverProperties)
Sets properties that will be passed on to the driver.
|
void |
setExternalAuth(boolean externalAuth)
If set to true, no attempts at passing in a username/password will be attempted
when trying to obtain a raw (driver) connection.
|
void |
setIdleConnectionTestPeriod(long idleConnectionTestPeriod)
已过时。
Please use
setIdleConnectionTestPeriodInMinutes(long) or setIdleConnectionTestPeriod(long, TimeUnit) instead |
void |
setIdleConnectionTestPeriod(long idleConnectionTestPeriod,
java.util.concurrent.TimeUnit timeUnit)
Wrapper method for idleConnectionTestPeriod for easier programmatic access.
|
void |
setIdleConnectionTestPeriodInMinutes(long idleConnectionTestPeriod)
Sets the idleConnectionTestPeriod.
|
void |
setIdleConnectionTestPeriodInSeconds(long idleConnectionTestPeriod)
Sets the idleConnectionTestPeriod.
|
void |
setIdleMaxAge(long idleMaxAge)
已过时。
Use
setIdleMaxAgeInMinutes(long) or setIdleMaxAge(long, TimeUnit) instead. |
void |
setIdleMaxAge(long idleMaxAge,
java.util.concurrent.TimeUnit timeUnit)
Sets Idle max age.
|
void |
setIdleMaxAgeInMinutes(long idleMaxAge)
Sets Idle max age (in min).
|
void |
setIdleMaxAgeInSeconds(long idleMaxAge)
Sets Idle max age (in seconds).
|
void |
setInitSQL(java.lang.String initSQL)
Specifies an initial SQL statement that is run only when a connection is first created.
|
void |
setJdbcUrl(java.lang.String jdbcUrl)
Sets the JDBC connection URL.
|
void |
setLazyInit(boolean lazyInit)
Set to true to force the connection pool to obtain the initial connections lazily.
|
void |
setLogStatementsEnabled(boolean logStatementsEnabled)
If enabled, log SQL statements being executed.
|
void |
setMaxConnectionAge(long maxConnectionAgeInSeconds)
已过时。
Please use {
setMaxConnectionAgeInSeconds(long) instead. |
void |
setMaxConnectionAge(long maxConnectionAge,
java.util.concurrent.TimeUnit timeUnit)
Sets the maxConnectionAge.
|
void |
setMaxConnectionAgeInSeconds(long maxConnectionAgeInSeconds)
Sets the maxConnectionAge in seconds.
|
void |
setMaxConnectionsPerPartition(int maxConnectionsPerPartition)
Sets the maximum number of connections that will be contained in every partition.
|
void |
setMinConnectionsPerPartition(int minConnectionsPerPartition)
Sets the minimum number of connections that will be contained in every partition.
|
void |
setPartitionCount(int partitionCount)
Sets number of partitions to use.
|
void |
setPassword(java.lang.String password)
Sets password to use for connections.
|
void |
setPoolAvailabilityThreshold(int poolAvailabilityThreshold)
Sets the Pool Watch thread threshold.
|
void |
setPoolName(java.lang.String poolName)
Sets the name of the pool for JMX and thread names.
|
void |
setPreparedStatementsCacheSize(int preparedStatementsCacheSize)
已过时。
|
void |
setProperties(java.util.Properties props)
Sets the properties by reading off entries in the given parameter (where each key is equivalent to the field name)
|
void |
setQueryExecuteTimeLimit(int queryExecuteTimeLimit)
已过时。
Use
setQueryExecuteTimeLimitInMs(long) instead. |
void |
setQueryExecuteTimeLimit(long queryExecuteTimeLimit,
java.util.concurrent.TimeUnit timeUnit)
Queries taking longer than this limit to execute are logged.
|
void |
setQueryExecuteTimeLimitInMs(long queryExecuteTimeLimit)
Queries taking longer than this limit to execute are logged.
|
void |
setReleaseHelperThreads(int releaseHelperThreads)
Sets number of helper threads to create that will handle releasing a connection.
|
void |
setServiceOrder(java.lang.String serviceOrder)
Sets the queue serviceOrder.
|
void |
setStatementCacheSize(int statementsCacheSize)
已过时。
|
void |
setStatementReleaseHelperThreads(int statementReleaseHelperThreads)
Sets number of statement helper threads to create that will handle releasing a statement.
|
void |
setStatementsCachedPerConnection(int statementsCachedPerConnection)
已过时。
|
void |
setStatementsCacheSize(int statementsCacheSize)
Sets statementsCacheSize setting.
|
void |
setStatisticsEnabled(boolean statisticsEnabled)
If set to true, keep track of some more statistics for exposure via JMX.
|
void |
setTransactionRecoveryEnabled(boolean transactionRecoveryEnabled)
Set to true to enable recording of all transaction activity and replay the transaction automatically in case
of a connection failure.
|
void |
setUsername(java.lang.String username)
Sets username to use for connections.
|
private void |
setXMLProperties(java.io.InputStream xmlConfigFile,
java.lang.String sectionName) |
java.lang.String |
toString() |
private static final java.lang.String USER
private static final java.lang.String PASSWORD
private static final long serialVersionUID
private static final java.lang.String CONFIG_TOSTRING
private static final java.lang.String CONFIG_DS_TOSTRING
private static final Logger logger
private int minConnectionsPerPartition
private int maxConnectionsPerPartition
private int acquireIncrement
private int partitionCount
private java.lang.String jdbcUrl
private java.lang.String username
private java.lang.String password
private long idleConnectionTestPeriodInSeconds
private long idleMaxAgeInSeconds
private java.lang.String connectionTestStatement
private int statementsCacheSize
private int statementsCachedPerConnection
private int releaseHelperThreads
private int statementReleaseHelperThreads
private ConnectionHook connectionHook
private java.lang.String initSQL
private boolean closeConnectionWatch
private boolean logStatementsEnabled
private long acquireRetryDelayInMs
private int acquireRetryAttempts
private boolean lazyInit
private boolean transactionRecoveryEnabled
private java.lang.String connectionHookClassName
private java.lang.ClassLoader classLoader
private java.lang.String poolName
private boolean disableJMX
private javax.sql.DataSource datasourceBean
private long queryExecuteTimeLimitInMs
private int poolAvailabilityThreshold
private boolean disableConnectionTracking
private java.util.Properties driverProperties
private long connectionTimeoutInMs
private long closeConnectionWatchTimeoutInMs
private long maxConnectionAgeInSeconds
private java.lang.String configFile
private java.lang.String serviceOrder
private boolean statisticsEnabled
private java.lang.Boolean defaultAutoCommit
private java.lang.Boolean defaultReadOnly
private java.lang.String defaultTransactionIsolation
private java.lang.String defaultCatalog
private int defaultTransactionIsolationValue
private boolean externalAuth
public BoneCPConfig()
public BoneCPConfig(java.util.Properties props) throws java.lang.Exception
props
- properties to set.java.lang.Exception
- on errorpublic BoneCPConfig(java.lang.String sectionName) throws java.lang.Exception
sectionName
- section to loadjava.lang.Exception
- on parse errorspublic BoneCPConfig(java.io.InputStream xmlConfigFile, java.lang.String sectionName) throws java.lang.Exception
xmlConfigFile
- file to loadsectionName
- section to loadjava.lang.Exception
public java.lang.String getPoolName()
getPoolName
在接口中 BoneCPConfigMBean
public void setPoolName(java.lang.String poolName)
poolName
- to set.public int getMinConnectionsPerPartition()
getMinConnectionsPerPartition
在接口中 BoneCPConfigMBean
BoneCPConfigMBean.getMinConnectionsPerPartition()
public void setMinConnectionsPerPartition(int minConnectionsPerPartition)
minConnectionsPerPartition
- number of connectionspublic int getMaxConnectionsPerPartition()
getMaxConnectionsPerPartition
在接口中 BoneCPConfigMBean
BoneCPConfigMBean.getMaxConnectionsPerPartition()
public void setMaxConnectionsPerPartition(int maxConnectionsPerPartition)
maxConnectionsPerPartition
- number of connections.public int getAcquireIncrement()
getAcquireIncrement
在接口中 BoneCPConfigMBean
BoneCPConfigMBean.getAcquireIncrement()
public void setAcquireIncrement(int acquireIncrement)
Note: This is a per partition setting.
acquireIncrement
- value to set.public int getPartitionCount()
getPartitionCount
在接口中 BoneCPConfigMBean
BoneCPConfigMBean.getPartitionCount()
public void setPartitionCount(int partitionCount)
Default: 1, minimum: 1, recommended: 2-4 (but very app specific)
partitionCount
- to setpublic java.lang.String getJdbcUrl()
getJdbcUrl
在接口中 BoneCPConfigMBean
BoneCPConfigMBean.getJdbcUrl()
public void setJdbcUrl(java.lang.String jdbcUrl)
jdbcUrl
- to setpublic java.lang.String getUsername()
getUsername
在接口中 BoneCPConfigMBean
BoneCPConfigMBean.getUsername()
public void setUsername(java.lang.String username)
username
- to setpublic java.lang.String getPassword()
public void setPassword(java.lang.String password)
password
- to set.@Deprecated public long getIdleConnectionTestPeriod()
getIdleConnectionTestPeriodInMinutes()
instead.@Deprecated public void setIdleConnectionTestPeriod(long idleConnectionTestPeriod)
setIdleConnectionTestPeriodInMinutes(long)
or setIdleConnectionTestPeriod(long, TimeUnit)
insteadidleConnectionTestPeriod
- to set in minutespublic long getIdleConnectionTestPeriodInMinutes()
getIdleConnectionTestPeriodInMinutes
在接口中 BoneCPConfigMBean
BoneCPConfigMBean.getIdleConnectionTestPeriodInMinutes()
public long getIdleConnectionTestPeriod(java.util.concurrent.TimeUnit timeUnit)
timeUnit
- time granularitypublic void setIdleConnectionTestPeriodInMinutes(long idleConnectionTestPeriod)
Default: 240 min, set to 0 to disable
idleConnectionTestPeriod
- to setpublic void setIdleConnectionTestPeriodInSeconds(long idleConnectionTestPeriod)
Default: 240 min, set to 0 to disable
idleConnectionTestPeriod
- to setpublic void setIdleConnectionTestPeriod(long idleConnectionTestPeriod, java.util.concurrent.TimeUnit timeUnit)
idleConnectionTestPeriod
- time for a connection to remain idle before sending a test
query to the DB.timeUnit
- Time granularity of given parameter.@Deprecated public long getIdleMaxAge()
getIdleMaxAgeInMinutes()
insteadpublic long getIdleMaxAge(java.util.concurrent.TimeUnit timeUnit)
timeUnit
- time granularitypublic long getIdleMaxAgeInMinutes()
getIdleMaxAgeInMinutes
在接口中 BoneCPConfigMBean
@Deprecated public void setIdleMaxAge(long idleMaxAge)
idleMaxAge
- to setpublic void setIdleMaxAgeInMinutes(long idleMaxAge)
Default: 60 minutes, set to 0 to disable.
idleMaxAge
- to setpublic void setIdleMaxAgeInSeconds(long idleMaxAge)
Default: 60 minutes, set to 0 to disable.
idleMaxAge
- to setpublic void setIdleMaxAge(long idleMaxAge, java.util.concurrent.TimeUnit timeUnit)
idleMaxAge
- time after which a connection is closed offtimeUnit
- idleMaxAge time granularity.public java.lang.String getConnectionTestStatement()
getConnectionTestStatement
在接口中 BoneCPConfigMBean
BoneCPConfigMBean.getConnectionTestStatement()
public void setConnectionTestStatement(java.lang.String connectionTestStatement)
Default: Use metadata request
connectionTestStatement
- to set.@Deprecated public int getPreparedStatementsCacheSize()
@Deprecated public int getPreparedStatementCacheSize()
@Deprecated public void setPreparedStatementsCacheSize(int preparedStatementsCacheSize)
preparedStatementsCacheSize
- to set.public void setStatementsCacheSize(int statementsCacheSize)
statementsCacheSize
- to set.public int getStatementsCacheSize()
getStatementsCacheSize
在接口中 BoneCPConfigMBean
BoneCPConfigMBean.getStatementsCacheSize()
@Deprecated public void setStatementCacheSize(int statementsCacheSize)
statementsCacheSize
- to set.@Deprecated public int getStatementCacheSize()
public int getReleaseHelperThreads()
getReleaseHelperThreads
在接口中 BoneCPConfigMBean
BoneCPConfigMBean.getReleaseHelperThreads()
public void setReleaseHelperThreads(int releaseHelperThreads)
releaseHelperThreads
- no to release@Deprecated public int getStatementsCachedPerConnection()
getStatementsCachedPerConnection
在接口中 BoneCPConfigMBean
BoneCPConfigMBean.getStatementsCachedPerConnection()
@Deprecated public void setStatementsCachedPerConnection(int statementsCachedPerConnection)
statementsCachedPerConnection
- to setpublic ConnectionHook getConnectionHook()
getConnectionHook
在接口中 BoneCPConfigMBean
BoneCPConfigMBean.getConnectionHook()
public void setConnectionHook(ConnectionHook connectionHook)
connectionHook
- the connectionHook to setpublic java.lang.String getInitSQL()
getInitSQL
在接口中 BoneCPConfigMBean
BoneCPConfigMBean.getInitSQL()
public void setInitSQL(java.lang.String initSQL)
initSQL
- the initSQL to setpublic boolean isCloseConnectionWatch()
public void setCloseConnectionWatch(boolean closeConnectionWatch)
closeConnectionWatch
- set to true to enable thread monitoring.public boolean isLogStatementsEnabled()
isLogStatementsEnabled
在接口中 BoneCPConfigMBean
public void setLogStatementsEnabled(boolean logStatementsEnabled)
logStatementsEnabled
- the logStatementsEnabled to set@Deprecated public long getAcquireRetryDelay()
getAcquireRetryDelayInMs()
instead.@Deprecated public void setAcquireRetryDelay(int acquireRetryDelayInMs)
setAcquireRetryDelayInMs(long)
.acquireRetryDelayInMs
- the acquireRetryDelay to setpublic long getAcquireRetryDelayInMs()
getAcquireRetryDelayInMs
在接口中 BoneCPConfigMBean
public long getAcquireRetryDelay(java.util.concurrent.TimeUnit timeUnit)
timeUnit
- time granularitypublic void setAcquireRetryDelayInMs(long acquireRetryDelay)
acquireRetryDelay
- the acquireRetryDelay to setpublic void setAcquireRetryDelay(long acquireRetryDelay, java.util.concurrent.TimeUnit timeUnit)
acquireRetryDelay
- the acquireRetryDelay to settimeUnit
- time granularitypublic boolean isLazyInit()
isLazyInit
在接口中 BoneCPConfigMBean
public void setLazyInit(boolean lazyInit)
lazyInit
- the lazyInit setting to setpublic boolean isTransactionRecoveryEnabled()
isTransactionRecoveryEnabled
在接口中 BoneCPConfigMBean
public void setTransactionRecoveryEnabled(boolean transactionRecoveryEnabled)
transactionRecoveryEnabled
- the transactionRecoveryEnabled status to setpublic int getAcquireRetryAttempts()
getAcquireRetryAttempts
在接口中 BoneCPConfigMBean
public void setAcquireRetryAttempts(int acquireRetryAttempts)
acquireRetryAttempts
- the acquireRetryAttempts to setpublic void setConnectionHookClassName(java.lang.String connectionHookClassName)
connectionHookClassName
- the connectionHook class name to setpublic java.lang.String getConnectionHookClassName()
getConnectionHookClassName
在接口中 BoneCPConfigMBean
public boolean isDisableJMX()
isDisableJMX
在接口中 BoneCPConfigMBean
public void setDisableJMX(boolean disableJMX)
disableJMX
- the disableJMX to setpublic javax.sql.DataSource getDatasourceBean()
public void setDatasourceBean(javax.sql.DataSource datasourceBean)
datasourceBean
- the datasourceBean to set@Deprecated public long getQueryExecuteTimeLimit()
getQueryExecuteTimeLimitInMs()
instead.@Deprecated public void setQueryExecuteTimeLimit(int queryExecuteTimeLimit)
setQueryExecuteTimeLimitInMs(long)
instead.queryExecuteTimeLimit
- the limit to set in milliseconds.public long getQueryExecuteTimeLimitInMs()
getQueryExecuteTimeLimitInMs
在接口中 BoneCPConfigMBean
public long getQueryExecuteTimeLimit(java.util.concurrent.TimeUnit timeUnit)
timeUnit
- time granularitypublic void setQueryExecuteTimeLimitInMs(long queryExecuteTimeLimit)
queryExecuteTimeLimit
- the limit to set in milliseconds.public void setQueryExecuteTimeLimit(long queryExecuteTimeLimit, java.util.concurrent.TimeUnit timeUnit)
queryExecuteTimeLimit
- the limit to set in milliseconds.timeUnit
- public int getPoolAvailabilityThreshold()
getPoolAvailabilityThreshold
在接口中 BoneCPConfigMBean
public void setPoolAvailabilityThreshold(int poolAvailabilityThreshold)
poolAvailabilityThreshold
- the poolAvailabilityThreshold to setpublic boolean isDisableConnectionTracking()
isDisableConnectionTracking
在接口中 BoneCPConfigMBean
public void setDisableConnectionTracking(boolean disableConnectionTracking)
disableConnectionTracking
- set to true to disable. Default: false.@Deprecated public long getConnectionTimeout()
getConnectionTimeoutInMs()
instead.@Deprecated public void setConnectionTimeout(long connectionTimeout)
setConnectionTimeoutInMs(long)
instead.connectionTimeout
- the connectionTimeout to setpublic long getConnectionTimeoutInMs()
getConnectionTimeoutInMs
在接口中 BoneCPConfigMBean
public long getConnectionTimeout(java.util.concurrent.TimeUnit timeUnit)
timeUnit
- time granularitypublic void setConnectionTimeoutInMs(long connectionTimeoutinMs)
connectionTimeoutinMs
- the connectionTimeout to setpublic void setConnectionTimeout(long connectionTimeout, java.util.concurrent.TimeUnit timeUnit)
connectionTimeout
- timeUnit
- the unit of the connectionTimeout argumentpublic java.util.Properties getDriverProperties()
public void setDriverProperties(java.util.Properties driverProperties)
driverProperties
- the driverProperties to set@Deprecated public long getCloseConnectionWatchTimeout()
getCloseConnectionWatchTimeoutInMs()
instead@Deprecated public void setCloseConnectionWatchTimeout(long closeConnectionWatchTimeout)
setCloseConnectionWatchTimeoutInMs(long)
insteadcloseConnectionWatchTimeout
- the watchTimeout to setpublic long getCloseConnectionWatchTimeoutInMs()
getCloseConnectionWatchTimeoutInMs
在接口中 BoneCPConfigMBean
public long getCloseConnectionWatchTimeout(java.util.concurrent.TimeUnit timeUnit)
timeUnit
- time granularitypublic void setCloseConnectionWatchTimeoutInMs(long closeConnectionWatchTimeout)
closeConnectionWatchTimeout
- the watchTimeout to setpublic void setCloseConnectionWatchTimeout(long closeConnectionWatchTimeout, java.util.concurrent.TimeUnit timeUnit)
closeConnectionWatchTimeout
- the watchTimeout to settimeUnit
- Time granularitypublic int getStatementReleaseHelperThreads()
getStatementReleaseHelperThreads
在接口中 BoneCPConfigMBean
public void setStatementReleaseHelperThreads(int statementReleaseHelperThreads)
statementReleaseHelperThreads
- no to release@Deprecated public long getMaxConnectionAge()
getMaxConnectionAgeInSeconds()
instead.getMaxConnectionAgeInSeconds()
instead.public long getMaxConnectionAgeInSeconds()
getMaxConnectionAgeInSeconds
在接口中 BoneCPConfigMBean
public long getMaxConnectionAge(java.util.concurrent.TimeUnit timeUnit)
timeUnit
- time granularity@Deprecated public void setMaxConnectionAge(long maxConnectionAgeInSeconds)
setMaxConnectionAgeInSeconds(long)
instead.setMaxConnectionAgeInSeconds(long)
instead.maxConnectionAgeInSeconds
- the maxConnectionAge to setpublic void setMaxConnectionAgeInSeconds(long maxConnectionAgeInSeconds)
maxConnectionAgeInSeconds
- the maxConnectionAge to setpublic void setMaxConnectionAge(long maxConnectionAge, java.util.concurrent.TimeUnit timeUnit)
maxConnectionAge
- the maxConnectionAge to set.timeUnit
- the unit of the maxConnectionAge argument.public java.lang.String getConfigFile()
getConfigFile
在接口中 BoneCPConfigMBean
public void setConfigFile(java.lang.String configFile)
configFile
- the configFile to setpublic java.lang.String getServiceOrder()
getServiceOrder
在接口中 BoneCPConfigMBean
public void setServiceOrder(java.lang.String serviceOrder)
serviceOrder
- the serviceOrder to setpublic boolean isStatisticsEnabled()
isStatisticsEnabled
在接口中 BoneCPConfigMBean
public void setStatisticsEnabled(boolean statisticsEnabled)
statisticsEnabled
- set to true to enablepublic java.lang.Boolean getDefaultAutoCommit()
public void setDefaultAutoCommit(java.lang.Boolean defaultAutoCommit)
defaultAutoCommit
- the defaultAutoCommit to setpublic java.lang.Boolean getDefaultReadOnly()
public void setDefaultReadOnly(java.lang.Boolean defaultReadOnly)
defaultReadOnly
- the defaultReadOnly to setpublic java.lang.String getDefaultCatalog()
public void setDefaultCatalog(java.lang.String defaultCatalog)
defaultCatalog
- the defaultCatalog to setpublic java.lang.String getDefaultTransactionIsolation()
public void setDefaultTransactionIsolation(java.lang.String defaultTransactionIsolation)
defaultTransactionIsolation
- the defaultTransactionIsolation to setprotected int getDefaultTransactionIsolationValue()
protected void setDefaultTransactionIsolationValue(int defaultTransactionIsolationValue)
defaultTransactionIsolationValue
- the defaultTransactionIsolationValue to setprivate void setXMLProperties(java.io.InputStream xmlConfigFile, java.lang.String sectionName) throws java.lang.Exception
xmlConfigFile
- sectionName
- java.lang.Exception
private java.lang.String lowerFirst(java.lang.String name)
name
- public void setProperties(java.util.Properties props) throws java.lang.Exception
props
- Parameter list to setjava.lang.Exception
- on errorprivate java.util.Properties parseXML(org.w3c.dom.Document doc, java.lang.String sectionName)
doc
- to parsesectionName
- which section to extractpublic boolean isExternalAuth()
public void setExternalAuth(boolean externalAuth)
externalAuth
- True to enable external auth.public void sanitize()
protected void loadProperties(java.lang.String filename)
filename
- Config filename to loadpublic java.lang.String toString()
toString
在类中 java.lang.Object
protected java.lang.Class<?> loadClass(java.lang.String clazz) throws java.lang.ClassNotFoundException
clazz
- class to loadjava.lang.ClassNotFoundException
public java.lang.ClassLoader getClassLoader()
public void setClassLoader(java.lang.ClassLoader classLoader)
classLoader
- the classLoader to setpublic BoneCPConfig clone() throws java.lang.CloneNotSupportedException
clone
在类中 java.lang.Object
java.lang.CloneNotSupportedException
public boolean hasSameConfiguration(BoneCPConfig that)
that
-