Class PerUserPoolDataSource
- All Implemented Interfaces:
Serializable, AutoCloseable, Wrapper, Referenceable, CommonDataSource, DataSource
A pooling DataSource appropriate for deployment within
J2EE environment. There are many configuration options, most of which are
defined in the parent class. This datasource uses individual pools per
user, and some properties can be set specifically for a given user, if the
deployment environment can support initialization of mapped properties.
So for example, a pool of admin or write-access Connections can be
guaranteed a certain number of connections, separate from a maximum
set for users with read-only connections.
User passwords can be changed without re-initializing the datasource.
When a getConnection(username, password) request is processed
with a password that is different from those used to create connections in
the pool associated with username, an attempt is made to create
a new connection using the supplied password and if this succeeds, the
existing pool is cleared and a new pool is created for connections using the
new password.
- Since:
- 2.0
- Version:
- $Id: PerUserPoolDataSource.java 1649430 2015-01-04 21:29:32Z tn $
- Author:
- John D. McNally
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close pool(s) being maintained by this datasource.intGet the number of active connections in the default pool.intgetNumActive(String username) Get the number of active connections in the pool for a given user.intGet the number of idle connections in the default pool.intgetNumIdle(String username) Get the number of idle connections in the pool for a given user.booleanGets the user specific value forBaseGenericObjectPool.getBlockWhenExhausted()for the specified user's pool or the default if no user specific value is defined.Gets the user specific default value forConnection.setAutoCommit(boolean)for the specified user's pool.Gets the user specific default value forConnection.setReadOnly(boolean)for the specified user's pool.Gets the user specific default value forConnection.setTransactionIsolation(int)for the specified user's pool.Gets the user specific value forBaseGenericObjectPool.getEvictionPolicyClassName()for the specified user's pool or the default if no user specific value is defined.booleangetPerUserLifo(String key) Gets the user specific value forBaseGenericObjectPool.getLifo()for the specified user's pool or the default if no user specific value is defined.intgetPerUserMaxIdle(String key) Gets the user specific value forGenericObjectPool.getMaxIdle()for the specified user's pool or the default if no user specific value is defined.intgetPerUserMaxTotal(String key) Gets the user specific value forBaseGenericObjectPool.getMaxTotal()for the specified user's pool or the default if no user specific value is defined.longGets the user specific value forBaseGenericObjectPool.getMaxWaitMillis()for the specified user's pool or the default if no user specific value is defined.longGets the user specific value forBaseGenericObjectPool.getMinEvictableIdleTimeMillis()for the specified user's pool or the default if no user specific value is defined.intgetPerUserMinIdle(String key) Gets the user specific value forGenericObjectPool.getMinIdle()for the specified user's pool or the default if no user specific value is defined.intGets the user specific value forBaseGenericObjectPool.getNumTestsPerEvictionRun()for the specified user's pool or the default if no user specific value is defined.longGets the user specific value forBaseGenericObjectPool.getSoftMinEvictableIdleTimeMillis()for the specified user's pool or the default if no user specific value is defined.booleanGets the user specific value forBaseGenericObjectPool.getTestOnBorrow()for the specified user's pool or the default if no user specific value is defined.booleanGets the user specific value forBaseGenericObjectPool.getTestOnCreate()for the specified user's pool or the default if no user specific value is defined.booleanGets the user specific value forBaseGenericObjectPool.getTestOnReturn()for the specified user's pool or the default if no user specific value is defined.booleanGets the user specific value forBaseGenericObjectPool.getTestWhileIdle()for the specified user's pool or the default if no user specific value is defined.longGets the user specific value forBaseGenericObjectPool.getTimeBetweenEvictionRunsMillis()for the specified user's pool or the default if no user specific value is defined.Returns aPerUserPoolDataSourceReference.voidsetPerUserBlockWhenExhausted(String username, Boolean value) Sets a user specific value forBaseGenericObjectPool.getBlockWhenExhausted()for the specified user's pool.voidsetPerUserDefaultAutoCommit(String username, Boolean value) Sets a user specific default value forConnection.setAutoCommit(boolean)for the specified user's pool.voidsetPerUserDefaultReadOnly(String username, Boolean value) Sets a user specific default value forConnection.setReadOnly(boolean)for the specified user's pool.voidsetPerUserDefaultTransactionIsolation(String username, Integer value) Sets a user specific default value forConnection.setTransactionIsolation(int)for the specified user's pool.voidsetPerUserEvictionPolicyClassName(String username, String value) Sets a user specific value forBaseGenericObjectPool.getEvictionPolicyClassName()for the specified user's pool.voidsetPerUserLifo(String username, Boolean value) Sets a user specific value forBaseGenericObjectPool.getLifo()for the specified user's pool.voidsetPerUserMaxIdle(String username, Integer value) Sets a user specific value forGenericObjectPool.getMaxIdle()for the specified user's pool.voidsetPerUserMaxTotal(String username, Integer value) Sets a user specific value forBaseGenericObjectPool.getMaxTotal()for the specified user's pool.voidsetPerUserMaxWaitMillis(String username, Long value) Sets a user specific value forBaseGenericObjectPool.getMaxWaitMillis()for the specified user's pool.voidsetPerUserMinEvictableIdleTimeMillis(String username, Long value) Sets a user specific value forBaseGenericObjectPool.getMinEvictableIdleTimeMillis()for the specified user's pool.voidsetPerUserMinIdle(String username, Integer value) Sets a user specific value forGenericObjectPool.getMinIdle()for the specified user's pool.voidsetPerUserNumTestsPerEvictionRun(String username, Integer value) Sets a user specific value forBaseGenericObjectPool.getNumTestsPerEvictionRun()for the specified user's pool.voidsetPerUserSoftMinEvictableIdleTimeMillis(String username, Long value) Sets a user specific value forBaseGenericObjectPool.getSoftMinEvictableIdleTimeMillis()for the specified user's pool.voidsetPerUserTestOnBorrow(String username, Boolean value) Sets a user specific value forBaseGenericObjectPool.getTestOnBorrow()for the specified user's pool.voidsetPerUserTestOnCreate(String username, Boolean value) Sets a user specific value forBaseGenericObjectPool.getTestOnCreate()for the specified user's pool.voidsetPerUserTestOnReturn(String username, Boolean value) Sets a user specific value forBaseGenericObjectPool.getTestOnReturn()for the specified user's pool.voidsetPerUserTestWhileIdle(String username, Boolean value) Sets a user specific value forBaseGenericObjectPool.getTestWhileIdle()for the specified user's pool.voidsetPerUserTimeBetweenEvictionRunsMillis(String username, Long value) Sets a user specific value for()for the specified user's pool.Methods inherited from class InstanceKeyDataSource
getConnection, getConnection, getConnectionPoolDataSource, getDataSourceName, getDefaultBlockWhenExhausted, getDefaultEvictionPolicyClassName, getDefaultLifo, getDefaultMaxIdle, getDefaultMaxTotal, getDefaultMaxWaitMillis, getDefaultMinEvictableIdleTimeMillis, getDefaultMinIdle, getDefaultNumTestsPerEvictionRun, getDefaultSoftMinEvictableIdleTimeMillis, getDefaultTestOnBorrow, getDefaultTestOnCreate, getDefaultTestOnReturn, getDefaultTestWhileIdle, getDefaultTimeBetweenEvictionRunsMillis, getDefaultTransactionIsolation, getDescription, getJndiEnvironment, getLoginTimeout, getLogWriter, getMaxConnLifetimeMillis, getParentLogger, getValidationQuery, getValidationQueryTimeout, isDefaultAutoCommit, isDefaultReadOnly, isRollbackAfterValidation, isWrapperFor, setConnectionPoolDataSource, setDataSourceName, setDefaultAutoCommit, setDefaultBlockWhenExhausted, setDefaultEvictionPolicyClassName, setDefaultLifo, setDefaultMaxIdle, setDefaultMaxTotal, setDefaultMaxWaitMillis, setDefaultMinEvictableIdleTimeMillis, setDefaultMinIdle, setDefaultNumTestsPerEvictionRun, setDefaultReadOnly, setDefaultSoftMinEvictableIdleTimeMillis, setDefaultTestOnBorrow, setDefaultTestOnCreate, setDefaultTestOnReturn, setDefaultTestWhileIdle, setDefaultTimeBetweenEvictionRunsMillis, setDefaultTransactionIsolation, setDescription, setJndiEnvironment, setLoginTimeout, setLogWriter, setMaxConnLifetimeMillis, setRollbackAfterValidation, setValidationQuery, setValidationQueryTimeout, unwrapMethods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface CommonDataSource
createShardingKeyBuilderMethods inherited from interface DataSource
createConnectionBuilder
-
Constructor Details
-
PerUserPoolDataSource
public PerUserPoolDataSource()Default no-arg constructor for Serialization
-
-
Method Details
-
close
public void close()Close pool(s) being maintained by this datasource.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein classInstanceKeyDataSource
-
getPerUserBlockWhenExhausted
Gets the user specific value forBaseGenericObjectPool.getBlockWhenExhausted()for the specified user's pool or the default if no user specific value is defined. -
setPerUserBlockWhenExhausted
-
getPerUserEvictionPolicyClassName
-
setPerUserEvictionPolicyClassName
-
getPerUserLifo
Gets the user specific value forBaseGenericObjectPool.getLifo()for the specified user's pool or the default if no user specific value is defined. -
setPerUserLifo
-
getPerUserMaxIdle
Gets the user specific value forGenericObjectPool.getMaxIdle()for the specified user's pool or the default if no user specific value is defined. -
setPerUserMaxIdle
-
getPerUserMaxTotal
Gets the user specific value forBaseGenericObjectPool.getMaxTotal()for the specified user's pool or the default if no user specific value is defined. -
setPerUserMaxTotal
-
getPerUserMaxWaitMillis
Gets the user specific value forBaseGenericObjectPool.getMaxWaitMillis()for the specified user's pool or the default if no user specific value is defined. -
setPerUserMaxWaitMillis
-
getPerUserMinEvictableIdleTimeMillis
Gets the user specific value forBaseGenericObjectPool.getMinEvictableIdleTimeMillis()for the specified user's pool or the default if no user specific value is defined. -
setPerUserMinEvictableIdleTimeMillis
-
getPerUserMinIdle
Gets the user specific value forGenericObjectPool.getMinIdle()for the specified user's pool or the default if no user specific value is defined. -
setPerUserMinIdle
-
getPerUserNumTestsPerEvictionRun
Gets the user specific value forBaseGenericObjectPool.getNumTestsPerEvictionRun()for the specified user's pool or the default if no user specific value is defined. -
setPerUserNumTestsPerEvictionRun
-
getPerUserSoftMinEvictableIdleTimeMillis
Gets the user specific value forBaseGenericObjectPool.getSoftMinEvictableIdleTimeMillis()for the specified user's pool or the default if no user specific value is defined. -
setPerUserSoftMinEvictableIdleTimeMillis
-
getPerUserTestOnCreate
Gets the user specific value forBaseGenericObjectPool.getTestOnCreate()for the specified user's pool or the default if no user specific value is defined. -
setPerUserTestOnCreate
-
getPerUserTestOnBorrow
Gets the user specific value forBaseGenericObjectPool.getTestOnBorrow()for the specified user's pool or the default if no user specific value is defined. -
setPerUserTestOnBorrow
-
getPerUserTestOnReturn
Gets the user specific value forBaseGenericObjectPool.getTestOnReturn()for the specified user's pool or the default if no user specific value is defined. -
setPerUserTestOnReturn
-
getPerUserTestWhileIdle
Gets the user specific value forBaseGenericObjectPool.getTestWhileIdle()for the specified user's pool or the default if no user specific value is defined. -
setPerUserTestWhileIdle
-
getPerUserTimeBetweenEvictionRunsMillis
Gets the user specific value forBaseGenericObjectPool.getTimeBetweenEvictionRunsMillis()for the specified user's pool or the default if no user specific value is defined. -
setPerUserTimeBetweenEvictionRunsMillis
-
getPerUserDefaultAutoCommit
Gets the user specific default value forConnection.setAutoCommit(boolean)for the specified user's pool. -
setPerUserDefaultAutoCommit
Sets a user specific default value forConnection.setAutoCommit(boolean)for the specified user's pool. -
getPerUserDefaultReadOnly
Gets the user specific default value forConnection.setReadOnly(boolean)for the specified user's pool. -
setPerUserDefaultReadOnly
Sets a user specific default value forConnection.setReadOnly(boolean)for the specified user's pool. -
getPerUserDefaultTransactionIsolation
Gets the user specific default value forConnection.setTransactionIsolation(int)for the specified user's pool. -
setPerUserDefaultTransactionIsolation
Sets a user specific default value forConnection.setTransactionIsolation(int)for the specified user's pool. -
getNumActive
public int getNumActive()Get the number of active connections in the default pool. -
getNumActive
Get the number of active connections in the pool for a given user. -
getNumIdle
public int getNumIdle()Get the number of idle connections in the default pool. -
getNumIdle
Get the number of idle connections in the pool for a given user. -
getReference
Returns aPerUserPoolDataSourceReference.- Throws:
NamingException
-