public interface PoolConfiguration
DataSource
object also implements this interface so that it can be easily configured through
an IoC container without having to specify a secondary object with a setter method.Modifier and Type | Field and Description |
---|---|
static String |
PKG_PREFIX
JMX prefix for interceptors that register themselves with JMX
|
Modifier and Type | Method and Description |
---|---|
int |
getAbandonWhenPercentageFull()
Connections that have been abandoned (timed out) wont get closed and reported up unless the number of connections in use are
above the percentage defined by abandonWhenPercentageFull.
|
boolean |
getCommitOnReturn() |
String |
getConnectionProperties()
The connection properties that will be sent to the JDBC driver when establishing new connections.
|
Object |
getDataSource()
Returns a datasource, if one exists that is being used to create connections.
|
String |
getDataSourceJNDI()
Returns the JNDI string configured for data source usage.
|
Properties |
getDbProperties()
Returns the database properties that are passed into the
Driver.connect(String, Properties) method. |
Boolean |
getDefaultAutoCommit()
The default auto-commit state of connections created by this pool.
|
String |
getDefaultCatalog()
If non null, during connection creation the method
Connection.setCatalog(String) will be called with the set value. |
Boolean |
getDefaultReadOnly()
If non null, during connection creation the method
Connection.setReadOnly(boolean) will be called with the set value. |
int |
getDefaultTransactionIsolation()
Returns the default transaction isolation level.
|
String |
getDriverClassName()
The fully qualified Java class name of the JDBC driver to be used.
|
int |
getInitialSize()
Returns the number of connections that will be established when the connection pool is started.
|
String |
getInitSQL()
A custom query to be run when a connection is first created.
|
String |
getJdbcInterceptors()
A semicolon separated list of classnames extending
JdbcInterceptor class. |
PoolProperties.InterceptorDefinition[] |
getJdbcInterceptorsAsArray()
Returns the
getJdbcInterceptors() as an array of objects with properties and the classes. |
boolean |
getLogValidationErrors()
Returns true if errors that happen during validation will be logged
|
int |
getMaxActive()
The maximum number of active connections that can be allocated from this pool at the same time.
|
long |
getMaxAge()
Time in milliseconds to keep this connection alive even when used.
|
int |
getMaxIdle()
The maximum number of connections that should be kept in the idle pool if
isPoolSweeperEnabled() returns false. |
int |
getMaxWait()
The maximum number of milliseconds that the pool will wait (when there are no available connections and the
getMaxActive() has been reached) for a connection to be returned
before throwing an exception. |
int |
getMinEvictableIdleTimeMillis()
The minimum amount of time an object must sit idle in the pool before it is eligible for eviction.
|
int |
getMinIdle()
The minimum number of established connections that should be kept in the pool at all times.
|
String |
getName()
Returns the name of the connection pool.
|
int |
getNumTestsPerEvictionRun()
Property not used
|
String |
getPassword()
Returns the password used when establishing connections to the database.
|
String |
getPoolName() |
boolean |
getPropagateInterruptState()
Returns true if the pool is configured to propagate interrupt state of a thread.
|
int |
getRemoveAbandonedTimeout()
The time in seconds before a connection can be considered abandoned.
|
boolean |
getRollbackOnReturn() |
int |
getSuspectTimeout()
Returns the time in seconds to pass before a connection is marked an abanoned suspect.
|
int |
getTimeBetweenEvictionRunsMillis()
The number of milliseconds to sleep between runs of the idle connection validation, abandoned cleaner
and idle pool resizing.
|
String |
getUrl()
The URL used to connect to the database
|
boolean |
getUseDisposableConnectionFacade()
Returns
true if this connection pool is configured to use a connection facade to prevent re-use of connection after
Connection.close() has been invoked |
boolean |
getUseLock()
Return true if a lock should be used when operations are performed on the connection object.
|
String |
getUsername()
Returns the username used to establish the connection with
|
long |
getValidationInterval()
avoid excess validation, only run validation at most at this frequency - time in milliseconds.
|
String |
getValidationQuery()
The SQL query that will be used to validate connections from this
pool before returning them to the caller or pool.
|
int |
getValidationQueryTimeout()
The timeout in seconds before a connection validation queries fail.
|
Validator |
getValidator() |
String |
getValidatorClassName()
Return the name of the optional validator class - may be null.
|
boolean |
isAccessToUnderlyingConnectionAllowed()
Property not used.
|
boolean |
isAlternateUsernameAllowed()
Returns true if the call
getConnection(username,password) is
allowed. |
Boolean |
isDefaultAutoCommit()
The default auto-commit state of connections created by this pool.
|
Boolean |
isDefaultReadOnly()
If non null, during connection creation the method
Connection.setReadOnly(boolean) will be called with the set value. |
boolean |
isFairQueue()
Returns
true if a fair queue is being used by the connection pool |
boolean |
isIgnoreExceptionOnPreLoad() |
boolean |
isJmxEnabled()
If set to true, the connection pool creates a
ConnectionPoolMBean object
that can be registered with JMX to receive notifications and state about the pool. |
boolean |
isLogAbandoned()
boolean flag to set if stack traces should be logged for application code which abandoned a Connection.
|
boolean |
isPoolSweeperEnabled()
Returns true if the pool sweeper is enabled for the connection pool.
|
boolean |
isRemoveAbandoned()
boolean flag to remove abandoned connections if they exceed the removeAbandonedTimout.
|
boolean |
isTestOnBorrow()
The indication of whether objects will be validated before being borrowed from the pool.
|
boolean |
isTestOnConnect()
Returns true if we should run the validation query when connecting to the database for the first time on a connection.
|
boolean |
isTestOnReturn()
The indication of whether objects will be validated after being returned to the pool.
|
boolean |
isTestWhileIdle()
Set to true if query validation should take place while the connection is idle.
|
boolean |
isUseEquals()
Set to true if you wish the
ProxyConnection class to use String.equals instead of
== when comparing method names. |
void |
setAbandonWhenPercentageFull(int percentage)
Connections that have been abandoned (timed out) wont get closed and reported up unless the number of connections in use are
above the percentage defined by abandonWhenPercentageFull.
|
void |
setAccessToUnderlyingConnectionAllowed(boolean accessToUnderlyingConnectionAllowed)
No-op
|
void |
setAlternateUsernameAllowed(boolean alternateUsernameAllowed)
Set to true if the call
getConnection(username,password) is
allowed and honored.. |
void |
setCommitOnReturn(boolean commitOnReturn)
Set to true if you want the connection pool to commit any pending transaction when a connection is returned.
|
void |
setConnectionProperties(String connectionProperties)
The properties that will be passed into
Driver.connect(String, Properties) method. |
void |
setDataSource(Object ds)
Injects a datasource that will be used to retrieve/create connections.
|
void |
setDataSourceJNDI(String jndiDS)
Configure the connection pool to use a DataSource according to
setDataSource(Object)
But instead of injecting the object, specify the JNDI location. |
void |
setDbProperties(Properties dbProperties)
Overrides the database properties passed into the
Driver.connect(String, Properties) method. |
void |
setDefaultAutoCommit(Boolean defaultAutoCommit)
The default auto-commit state of connections created by this pool.
|
void |
setDefaultCatalog(String defaultCatalog)
If non null, during connection creation the method
Connection.setCatalog(String) will be called with the set value. |
void |
setDefaultReadOnly(Boolean defaultReadOnly)
If non null, during connection creation the method
Connection.setReadOnly(boolean) will be called with the set value. |
void |
setDefaultTransactionIsolation(int defaultTransactionIsolation)
If set to
DataSourceFactory.UNKNOWN_TRANSACTIONISOLATION the method
Connection.setTransactionIsolation(int) will not be called during connection creation. |
void |
setDriverClassName(String driverClassName)
The fully qualified Java class name of the JDBC driver to be used.
|
void |
setFairQueue(boolean fairQueue)
Set to true if you wish that calls to getConnection
should be treated fairly in a true FIFO fashion.
|
void |
setIgnoreExceptionOnPreLoad(boolean ignoreExceptionOnPreLoad)
Set to true if you want to ignore error of connection creation while initializing the pool.
|
void |
setInitialSize(int initialSize)
Set the number of connections that will be established when the connection pool is started.
|
void |
setInitSQL(String initSQL)
A custom query to be run when a connection is first created.
|
void |
setJdbcInterceptors(String jdbcInterceptors)
A semicolon separated list of classnames extending
JdbcInterceptor class. |
void |
setJmxEnabled(boolean jmxEnabled)
If set to true, the connection pool creates a
ConnectionPoolMBean object
that can be registered with JMX to receive notifications and state about the pool. |
void |
setLogAbandoned(boolean logAbandoned)
boolean flag to set if stack traces should be logged for application code which abandoned a Connection.
|
void |
setLogValidationErrors(boolean logValidationErrors)
Set to true if you wish that errors from validation should be logged as error messages.
|
void |
setMaxActive(int maxActive)
The maximum number of active connections that can be allocated from this pool at the same time.
|
void |
setMaxAge(long maxAge)
Time in milliseconds to keep this connection alive even when used.
|
void |
setMaxIdle(int maxIdle)
The maximum number of connections that should be kept in the idle pool if
isPoolSweeperEnabled() returns false. |
void |
setMaxWait(int maxWait)
The maximum number of milliseconds that the pool will wait (when there are no available connections and the
getMaxActive() has been reached) for a connection to be returned
before throwing an exception. |
void |
setMinEvictableIdleTimeMillis(int minEvictableIdleTimeMillis)
The minimum amount of time an object must sit idle in the pool before it is eligible for eviction.
|
void |
setMinIdle(int minIdle)
The minimum number of established connections that should be kept in the pool at all times.
|
void |
setName(String name)
Sets the name of the connection pool
|
void |
setNumTestsPerEvictionRun(int numTestsPerEvictionRun)
Property not used
|
void |
setPassword(String password)
Sets the password to establish the connection with.
|
void |
setPropagateInterruptState(boolean propagateInterruptState)
Configure the pool to propagate interrupt state for interrupted threads waiting for a connection
A thread waiting for a connection, can have its wait interrupted, and by default
will clear the interrupt flag and throw a
PoolExhaustedException
If set to true, this behavior will change, while the PoolExhaustedException is still thrown, the threads interrupted state is still set. |
void |
setRemoveAbandoned(boolean removeAbandoned)
boolean flag to remove abandoned connections if they exceed the removeAbandonedTimout.
|
void |
setRemoveAbandonedTimeout(int removeAbandonedTimeout)
The time in seconds before a connection can be considered abandoned.
|
void |
setRollbackOnReturn(boolean rollbackOnReturn)
Set to true if you want the connection pool to rollback any pending transaction when a connection is returned.
|
void |
setSuspectTimeout(int seconds)
Similar to
setRemoveAbandonedTimeout(int) but instead of treating the connection
as abandoned, and potentially closing the connection, this simply logs the warning if
isLogAbandoned() returns true. |
void |
setTestOnBorrow(boolean testOnBorrow)
The indication of whether objects will be validated before being borrowed from the pool.
|
void |
setTestOnConnect(boolean testOnConnect)
Set to true if we should run the validation query when connecting to the database for the first time on a connection.
|
void |
setTestOnReturn(boolean testOnReturn)
The indication of whether objects will be validated after being returned to the pool.
|
void |
setTestWhileIdle(boolean testWhileIdle)
Set to true if query validation should take place while the connection is idle.
|
void |
setTimeBetweenEvictionRunsMillis(int timeBetweenEvictionRunsMillis)
The number of milliseconds to sleep between runs of the idle connection validation, abandoned cleaner
and idle pool resizing.
|
void |
setUrl(String url)
Sets the URL used to connect to the database
|
void |
setUseDisposableConnectionFacade(boolean useDisposableConnectionFacade)
If set to
true , the connection will be wrapped with facade that will disallow the connection to be used after
Connection.close() is called. |
void |
setUseEquals(boolean useEquals)
Set to true if you wish the
ProxyConnection class to use String.equals instead of
== when comparing method names. |
void |
setUseLock(boolean useLock)
Set to true if a lock should be used when operations are performed on the connection object.
|
void |
setUsername(String username)
Sets the username used to establish the connection with
It will also be a property called 'user' in the database properties.
|
void |
setValidationInterval(long validationInterval)
avoid excess validation, only run validation at most at this frequency - time in milliseconds.
|
void |
setValidationQuery(String validationQuery)
The SQL query that will be used to validate connections from this
pool before returning them to the caller or pool.
|
void |
setValidationQueryTimeout(int validationQueryTimeout)
The timeout in seconds before a connection validation queries fail.
|
void |
setValidator(Validator validator)
Sets the validator object
If this is a non null object, it will be used as a validator instead of the validationQuery
If this is null, remove the usage of the validator.
|
void |
setValidatorClassName(String className)
Set the name for an optional validator class which will be used in place of test queries.
|
static final String PKG_PREFIX
void setAbandonWhenPercentageFull(int percentage)
percentage
- a value between 0 and 100 to indicate when connections that have been abandoned/timed out are considered abandonedint getAbandonWhenPercentageFull()
boolean isFairQueue()
true
if a fair queue is being used by the connection pooltrue
if a fair waiting queue is being usedvoid setFairQueue(boolean fairQueue)
FairBlockingQueue
implementation for the list of the idle connections.
The default value is true.
This flag is required when you want to use asynchronous connection retrieval.fairQueue
- true
to use a fair queueboolean isAccessToUnderlyingConnectionAllowed()
DataSource
interface
or call getConnection through reflection or cast the object as PooledConnection
true
void setAccessToUnderlyingConnectionAllowed(boolean accessToUnderlyingConnectionAllowed)
accessToUnderlyingConnectionAllowed
- parameter ignoredString getConnectionProperties()
void setConnectionProperties(String connectionProperties)
Driver.connect(String, Properties)
method.
Username and password do not need to be stored here, they will be passed into the properties right before the connection is established.connectionProperties
- properties - Format of the string is [propertyName=property;]*
Example: prop1=value1;prop2=value2Properties getDbProperties()
Driver.connect(String, Properties)
method.Driver.connect(String, Properties)
method.void setDbProperties(Properties dbProperties)
Driver.connect(String, Properties)
method.dbProperties
- The database propertiesBoolean isDefaultAutoCommit()
Connection.setAutoCommit(boolean)
method will not be called.)Boolean getDefaultAutoCommit()
Connection.setAutoCommit(boolean)
method will not be called.)void setDefaultAutoCommit(Boolean defaultAutoCommit)
Connection.setAutoCommit(boolean)
method will not be called.)defaultAutoCommit
- default auto commit setting, null is Driver default.String getDefaultCatalog()
Connection.setCatalog(String)
will be called with the set value.void setDefaultCatalog(String defaultCatalog)
Connection.setCatalog(String)
will be called with the set value.defaultCatalog
- null if not set and accepting the driver default.Boolean isDefaultReadOnly()
Connection.setReadOnly(boolean)
will be called with the set value.Boolean getDefaultReadOnly()
Connection.setReadOnly(boolean)
will be called with the set value.void setDefaultReadOnly(Boolean defaultReadOnly)
Connection.setReadOnly(boolean)
will be called with the set value.defaultReadOnly
- null if not set and accepting the driver default.int getDefaultTransactionIsolation()
DataSourceFactory.UNKNOWN_TRANSACTIONISOLATION
the method
Connection.setTransactionIsolation(int)
will not be called during connection creation.DataSourceFactory.UNKNOWN_TRANSACTIONISOLATION
if not set.void setDefaultTransactionIsolation(int defaultTransactionIsolation)
DataSourceFactory.UNKNOWN_TRANSACTIONISOLATION
the method
Connection.setTransactionIsolation(int)
will not be called during connection creation. Otherwise the method
will be called with the isolation level set by this property.defaultTransactionIsolation
- a value of Connection.TRANSACTION_NONE
, Connection.TRANSACTION_READ_COMMITTED
,
Connection.TRANSACTION_READ_UNCOMMITTED
, Connection.TRANSACTION_REPEATABLE_READ
,
Connection.TRANSACTION_SERIALIZABLE
or DataSourceFactory.UNKNOWN_TRANSACTIONISOLATION
The last value will not be set on the connection.String getDriverClassName()
void setDriverClassName(String driverClassName)
driverClassName
- a fully qualified Java class name of a Driver
implementation.int getInitialSize()
void setInitialSize(int initialSize)
setMaxActive(int)
it will automatically be lowered.initialSize
- the number of connections to be established.boolean isLogAbandoned()
void setLogAbandoned(boolean logAbandoned)
logAbandoned
- set to true if stack traces should be recorded when DataSourceProxy.getConnection()
is called.int getMaxActive()
void setMaxActive(int maxActive)
maxActive
- hard limit for number of managed connections by this poolint getMaxIdle()
isPoolSweeperEnabled()
returns false.
If the If isPoolSweeperEnabled()
returns true, then the idle pool can grow up to getMaxActive()
and will be shrunk according to getMinEvictableIdleTimeMillis()
setting.
Default value is maxActive:100void setMaxIdle(int maxIdle)
isPoolSweeperEnabled()
returns false.
If the If isPoolSweeperEnabled()
returns true, then the idle pool can grow up to getMaxActive()
and will be shrunk according to getMinEvictableIdleTimeMillis()
setting.
Default value is maxActive:100maxIdle
- the maximum size of the idle poolint getMaxWait()
getMaxActive()
has been reached) for a connection to be returned
before throwing an exception. Default value is 30000 (30 seconds)void setMaxWait(int maxWait)
getMaxActive()
has been reached) for a connection to be returned
before throwing an exception. Default value is 30000 (30 seconds)maxWait
- the maximum number of milliseconds to wait.int getMinEvictableIdleTimeMillis()
void setMinEvictableIdleTimeMillis(int minEvictableIdleTimeMillis)
minEvictableIdleTimeMillis
- the number of milliseconds a connection must be idle to be eligible for eviction.int getMinIdle()
getInitialSize()
(also see setTestWhileIdle(boolean)
The idle pool will not shrink below this value during an eviction run, hence the number of actual connections
can be between getMinIdle()
and somewhere between getMaxIdle()
and getMaxActive()
void setMinIdle(int minIdle)
getInitialSize()
(also see setTestWhileIdle(boolean)
The idle pool will not shrink below this value during an eviction run, hence the number of actual connections
can be between getMinIdle()
and somewhere between getMaxIdle()
and getMaxActive()
minIdle
- the minimum number of idle or established connectionsString getName()
void setName(String name)
name
- the name of the pool, should be unique in a runtime JVMint getNumTestsPerEvictionRun()
void setNumTestsPerEvictionRun(int numTestsPerEvictionRun)
numTestsPerEvictionRun
- parameter ignored.String getPassword()
void setPassword(String password)
password
- The passwordgetDbProperties()
String getUsername()
void setUsername(String username)
username
- The user namegetDbProperties()
boolean isRemoveAbandoned()
getRemoveAbandonedTimeout()
and the condition for
getAbandonWhenPercentageFull()
is met.
Setting this to true can recover db connections from applications that fail to close a connection.
See also isLogAbandoned()
The default value is false.void setRemoveAbandoned(boolean removeAbandoned)
getRemoveAbandonedTimeout()
and the condition for
getAbandonWhenPercentageFull()
is met.
Setting this to true can recover db connections from applications that fail to close a connection.
See also isLogAbandoned()
The default value is false.removeAbandoned
- set to true if abandoned connections can be closed and expelled out of the poolvoid setRemoveAbandonedTimeout(int removeAbandonedTimeout)
removeAbandonedTimeout
- the time in seconds before a used connection can be considered abandonedResetAbandonedTimer
int getRemoveAbandonedTimeout()
ResetAbandonedTimer
boolean isTestOnBorrow()
setValidationInterval(long)
getValidationInterval()
void setTestOnBorrow(boolean testOnBorrow)
setValidationInterval(long)
testOnBorrow
- set to true if validation should take place before a connection is handed out to the applicationgetValidationInterval()
boolean isTestOnReturn()
setValidationInterval(long)
getValidationInterval()
void setTestOnReturn(boolean testOnReturn)
setValidationInterval(long)
testOnReturn
- true if validation should take place after a connection is returned to the poolgetValidationInterval()
boolean isTestWhileIdle()
setTimeBetweenEvictionRunsMillis(int)
void setTestWhileIdle(boolean testWhileIdle)
testWhileIdle
- true if validation should take place during idle checkssetTimeBetweenEvictionRunsMillis(int)
int getTimeBetweenEvictionRunsMillis()
void setTimeBetweenEvictionRunsMillis(int timeBetweenEvictionRunsMillis)
timeBetweenEvictionRunsMillis
- the sleep time in between validations in millisecondsString getUrl()
Driver.connect(String, Properties)
void setUrl(String url)
url
- the configured URL for this connection poolDriver.connect(String, Properties)
String getValidationQuery()
void setValidationQuery(String validationQuery)
validationQuery
- the query used for validation or null if no validation is performedint getValidationQueryTimeout()
void setValidationQueryTimeout(int validationQueryTimeout)
validationQueryTimeout
- The timeout valueString getValidatorClassName()
void setValidatorClassName(String className)
className
- the name of the optional validator classValidator getValidator()
void setValidator(Validator validator)
validator
- The validator objectlong getValidationInterval()
void setValidationInterval(long validationInterval)
validationInterval
- the validation interval in millisecondsString getInitSQL()
void setInitSQL(String initSQL)
initSQL
- the init SQL used to run against the DB or null if no query should be executedboolean isTestOnConnect()
void setTestOnConnect(boolean testOnConnect)
setInitSQL(String)
will override this setting, as the init SQL will be used instead of the validation querytestOnConnect
- set to true if we should run the validation query upon connectString getJdbcInterceptors()
JdbcInterceptor
class.
These interceptors will be inserted as an interceptor into the chain of operations on a java.sql.Connection object.
Example interceptors are StatementFinalizer
to close all
used statements during the session.
ResetAbandonedTimer
resets the timer upon every operation
on the connection or a statement.
ConnectionState
caches the auto commit, read only and catalog settings to avoid round trips to the DB.
The default value is null.void setJdbcInterceptors(String jdbcInterceptors)
JdbcInterceptor
class.
These interceptors will be inserted as an interceptor into the chain of operations on a java.sql.Connection object.
Example interceptors are StatementFinalizer
to close all
used statements during the session.
ResetAbandonedTimer
resets the timer upon every operation
on the connection or a statement.
ConnectionState
caches the auto commit, read only and catalog settings to avoid round trips to the DB.
The default value is null.jdbcInterceptors
- the interceptors that are used for connections.
Example format: 'ConnectionState(useEquals=true,fast=yes);ResetAbandonedTimer'PoolProperties.InterceptorDefinition[] getJdbcInterceptorsAsArray()
getJdbcInterceptors()
as an array of objects with properties and the classes.boolean isJmxEnabled()
ConnectionPoolMBean
object
that can be registered with JMX to receive notifications and state about the pool.
The ConnectionPool object doesn't register itself, as there is no way to keep a static non changing ObjectName across JVM restarts.void setJmxEnabled(boolean jmxEnabled)
ConnectionPoolMBean
object
that can be registered with JMX to receive notifications and state about the pool.
The ConnectionPool object doesn't register itself, as there is no way to keep a static non changing ObjectName across JVM restarts.jmxEnabled
- set to to if the mbean object should be created upon startup.boolean isPoolSweeperEnabled()
boolean result = getTimeBetweenEvictionRunsMillis()>0;
result = result && (isRemoveAbandoned() && getRemoveAbandonedTimeout()>0);
result = result || (isTestWhileIdle() && getValidationQuery()!=null);
return result;
boolean isUseEquals()
ProxyConnection
class to use String.equals
instead of
==
when comparing method names.
This property does not apply to added interceptors as those are configured individually.
The default value is false
.String.equals(Object)
instead of == when comparing method names on Connection
methodsvoid setUseEquals(boolean useEquals)
ProxyConnection
class to use String.equals
instead of
==
when comparing method names.
This property does not apply to added interceptors as those are configured individually.
The default value is false
.useEquals
- set to true if the pool should use String.equals(Object)
instead of ==
when comparing method names on Connection
methodslong getMaxAge()
void setMaxAge(long maxAge)
maxAge
- the time in milliseconds a connection will be open for when usedboolean getUseLock()
void setUseLock(boolean useLock)
useLock
- set to true if a lock should be used on connection operationsvoid setSuspectTimeout(int seconds)
setRemoveAbandonedTimeout(int)
but instead of treating the connection
as abandoned, and potentially closing the connection, this simply logs the warning if
isLogAbandoned()
returns true. If this value is equal or less than 0, no suspect
checking will be performed. Suspect checking only takes place if the timeout value is larger than 0 and
the connection was not abandoned or if abandon check is disabled. If a connection is suspect a WARN message gets
logged and a JMX notification gets sent once.seconds
- - the amount of time in seconds that has to pass before a connection is marked suspect.int getSuspectTimeout()
void setDataSource(Object ds)
getUrl()
and getDriverClassName()
methods are ignored
and not used by the pool. If the getUsername()
and getPassword()
values are set, the method DataSource.getConnection(String, String)
method will be called instead of the
DataSource.getConnection()
method.
If the data source implements XADataSource
the methods
XADataSource.getXAConnection()
and XADataSource.getXAConnection(String,String)
will be invoked.ds
- the DataSource
to be used for creating connections to be pooled.Object getDataSource()
Driver
DataSource
to be used for creating connections to be pooled or null if a Driver is used.void setDataSourceJNDI(String jndiDS)
setDataSource(Object)
But instead of injecting the object, specify the JNDI location.
After a successful JNDI look, the getDataSource()
will not return null.jndiDS
- -the JNDI string @TODO specify the rules here.String getDataSourceJNDI()
boolean isAlternateUsernameAllowed()
getConnection(username,password)
is
allowed. This is used for when the pool is used by an application accessing multiple schemas.
There is a performance impact turning this option on.getConnection(username,password)
is honored, false if it is ignored.void setAlternateUsernameAllowed(boolean alternateUsernameAllowed)
getConnection(username,password)
is
allowed and honored.. This is used for when the pool is used by an application accessing multiple schemas.
There is a performance impact turning this option on, even when not used due to username checks.alternateUsernameAllowed
- - set true if getConnection(username,password)
is honored,
false if it is to be ignored.void setCommitOnReturn(boolean commitOnReturn)
getDefaultAutoCommit()
returns falsecommitOnReturn
- set to true if the pool should call Connection.commit()
when a connection is returned to the pool.
Default is falseboolean getCommitOnReturn()
true
if the pool should commit when a connection is returned to itsetCommitOnReturn(boolean)
void setRollbackOnReturn(boolean rollbackOnReturn)
getDefaultAutoCommit()
returns falserollbackOnReturn
- set to true if the pool should call Connection.rollback()
when a connection is returned to the pool.
Default is falseboolean getRollbackOnReturn()
true
if the pool should rollback when a connection is returned to itsetRollbackOnReturn(boolean)
void setUseDisposableConnectionFacade(boolean useDisposableConnectionFacade)
true
, the connection will be wrapped with facade that will disallow the connection to be used after
Connection.close()
is called. If set to true
, after Connection.close()
all calls except
Connection.close()
and Connection.isClosed()
will throw an exception.useDisposableConnectionFacade
- true
to use a facadeboolean getUseDisposableConnectionFacade()
true
if this connection pool is configured to use a connection facade to prevent re-use of connection after
Connection.close()
has been invokedtrue
if Connection.close()
has been invoked.void setLogValidationErrors(boolean logValidationErrors)
logValidationErrors
- set to true to log validation errorsboolean getLogValidationErrors()
boolean getPropagateInterruptState()
PoolExhaustedException
void setPropagateInterruptState(boolean propagateInterruptState)
PoolExhaustedException
If set to true, this behavior will change, while the PoolExhaustedException
is still thrown, the threads interrupted state is still set.propagateInterruptState
- - set to true to not clear, but propagate, a threads interrupted state.void setIgnoreExceptionOnPreLoad(boolean ignoreExceptionOnPreLoad)
ignoreExceptionOnPreLoad
- set to true if you want to ignore error of connection creation while initializing the pool.boolean isIgnoreExceptionOnPreLoad()
true
to ignore exceptionssetIgnoreExceptionOnPreLoad(boolean)
Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.