Class PerUserPoolDataSource
- java.lang.Object
-
- org.datanucleus.store.rdbms.datasource.dbcp2.datasources.InstanceKeyDataSource
-
- org.datanucleus.store.rdbms.datasource.dbcp2.datasources.PerUserPoolDataSource
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.AutoCloseable
,java.sql.Wrapper
,javax.naming.Referenceable
,javax.sql.CommonDataSource
,javax.sql.DataSource
public class PerUserPoolDataSource extends InstanceKeyDataSource
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 withuserName
, 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
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static org.datanucleus.util.NucleusLogger
log
private java.util.Map<PoolKey,PooledConnectionManager>
managers
Map to keep track of Pools for a given user.private java.util.Map<java.lang.String,java.lang.Boolean>
perUserBlockWhenExhausted
private java.util.Map<java.lang.String,java.lang.Boolean>
perUserDefaultAutoCommit
private java.util.Map<java.lang.String,java.lang.Boolean>
perUserDefaultReadOnly
private java.util.Map<java.lang.String,java.lang.Integer>
perUserDefaultTransactionIsolation
private java.util.Map<java.lang.String,java.lang.String>
perUserEvictionPolicyClassName
private java.util.Map<java.lang.String,java.lang.Boolean>
perUserLifo
private java.util.Map<java.lang.String,java.lang.Integer>
perUserMaxIdle
private java.util.Map<java.lang.String,java.lang.Integer>
perUserMaxTotal
private java.util.Map<java.lang.String,java.lang.Long>
perUserMaxWaitMillis
private java.util.Map<java.lang.String,java.lang.Long>
perUserMinEvictableIdleTimeMillis
private java.util.Map<java.lang.String,java.lang.Integer>
perUserMinIdle
private java.util.Map<java.lang.String,java.lang.Integer>
perUserNumTestsPerEvictionRun
private java.util.Map<java.lang.String,java.lang.Long>
perUserSoftMinEvictableIdleTimeMillis
private java.util.Map<java.lang.String,java.lang.Boolean>
perUserTestOnBorrow
private java.util.Map<java.lang.String,java.lang.Boolean>
perUserTestOnCreate
private java.util.Map<java.lang.String,java.lang.Boolean>
perUserTestOnReturn
private java.util.Map<java.lang.String,java.lang.Boolean>
perUserTestWhileIdle
private java.util.Map<java.lang.String,java.lang.Long>
perUserTimeBetweenEvictionRunsMillis
private static long
serialVersionUID
-
Fields inherited from class org.datanucleus.store.rdbms.datasource.dbcp2.datasources.InstanceKeyDataSource
UNKNOWN_TRANSACTIONISOLATION
-
-
Constructor Summary
Constructors Constructor Description PerUserPoolDataSource()
Default no-arg constructor for Serialization.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clears pool(s) maintained by this data source.void
close()
Closes pool(s) maintained by this data source.private java.util.HashMap<java.lang.String,java.lang.Boolean>
createMap()
protected PooledConnectionManager
getConnectionManager(UserPassKey upKey)
private ObjectPool<PooledConnectionAndInfo>
getCPDSConnectionFactoryPool(PooledConnectionManager manager)
int
getNumActive()
Gets the number of active connections in the default pool.int
getNumActive(java.lang.String userName)
Gets the number of active connections in the pool for a given user.int
getNumIdle()
Gets the number of idle connections in the default pool.int
getNumIdle(java.lang.String userName)
Gets the number of idle connections in the pool for a given user.boolean
getPerUserBlockWhenExhausted(java.lang.String userName)
Gets the user specific value forBaseGenericObjectPool.getBlockWhenExhausted()
for the specified user's pool or the default if no user specific value is defined.java.lang.Boolean
getPerUserDefaultAutoCommit(java.lang.String userName)
Gets the user specific default value forConnection.setAutoCommit(boolean)
for the specified user's pool.java.lang.Boolean
getPerUserDefaultReadOnly(java.lang.String userName)
Gets the user specific default value forConnection.setReadOnly(boolean)
for the specified user's pool.java.lang.Integer
getPerUserDefaultTransactionIsolation(java.lang.String userName)
Gets the user specific default value forConnection.setTransactionIsolation(int)
for the specified user's pool.java.lang.String
getPerUserEvictionPolicyClassName(java.lang.String userName)
Gets the user specific value forBaseGenericObjectPool.getEvictionPolicyClassName()
for the specified user's pool or the default if no user specific value is defined.boolean
getPerUserLifo(java.lang.String userName)
Gets the user specific value forBaseGenericObjectPool.getLifo()
for the specified user's pool or the default if no user specific value is defined.int
getPerUserMaxIdle(java.lang.String userName)
Gets the user specific value forGenericObjectPool.getMaxIdle()
for the specified user's pool or the default if no user specific value is defined.int
getPerUserMaxTotal(java.lang.String userName)
Gets the user specific value forBaseGenericObjectPool.getMaxTotal()
for the specified user's pool or the default if no user specific value is defined.long
getPerUserMaxWaitMillis(java.lang.String userName)
Gets the user specific value forBaseGenericObjectPool.getMaxWaitMillis()
for the specified user's pool or the default if no user specific value is defined.long
getPerUserMinEvictableIdleTimeMillis(java.lang.String userName)
Gets the user specific value forBaseGenericObjectPool.getMinEvictableIdleTimeMillis()
for the specified user's pool or the default if no user specific value is defined.int
getPerUserMinIdle(java.lang.String userName)
Gets the user specific value forGenericObjectPool.getMinIdle()
for the specified user's pool or the default if no user specific value is defined.int
getPerUserNumTestsPerEvictionRun(java.lang.String userName)
Gets the user specific value forBaseGenericObjectPool.getNumTestsPerEvictionRun()
for the specified user's pool or the default if no user specific value is defined.long
getPerUserSoftMinEvictableIdleTimeMillis(java.lang.String userName)
Gets the user specific value forBaseGenericObjectPool.getSoftMinEvictableIdleTimeMillis()
for the specified user's pool or the default if no user specific value is defined.boolean
getPerUserTestOnBorrow(java.lang.String userName)
Gets the user specific value forBaseGenericObjectPool.getTestOnBorrow()
for the specified user's pool or the default if no user specific value is defined.boolean
getPerUserTestOnCreate(java.lang.String userName)
Gets the user specific value forBaseGenericObjectPool.getTestOnCreate()
for the specified user's pool or the default if no user specific value is defined.boolean
getPerUserTestOnReturn(java.lang.String userName)
Gets the user specific value forBaseGenericObjectPool.getTestOnReturn()
for the specified user's pool or the default if no user specific value is defined.boolean
getPerUserTestWhileIdle(java.lang.String userName)
Gets the user specific value forBaseGenericObjectPool.getTestWhileIdle()
for the specified user's pool or the default if no user specific value is defined.long
getPerUserTimeBetweenEvictionRunsMillis(java.lang.String userName)
Gets the user specific value forBaseGenericObjectPool.getTimeBetweenEvictionRunsMillis()
for the specified user's pool or the default if no user specific value is defined.private ObjectPool<PooledConnectionAndInfo>
getPool(PoolKey poolKey)
Returns the object pool associated with the given PoolKey.protected PooledConnectionAndInfo
getPooledConnectionAndInfo(java.lang.String userName, java.lang.String password)
private PoolKey
getPoolKey(java.lang.String userName)
Creates a pool key from the provided parameters.javax.naming.Reference
getReference()
Returns aPerUserPoolDataSource
Reference
.private void
readObject(java.io.ObjectInputStream in)
Supports Serialization interface.private void
registerPool(java.lang.String userName, java.lang.String password)
void
setPerUserBlockWhenExhausted(java.lang.String userName, java.lang.Boolean value)
Sets a user specific value forBaseGenericObjectPool.getBlockWhenExhausted()
for the specified user's pool.(package private) void
setPerUserBlockWhenExhausted(java.util.Map<java.lang.String,java.lang.Boolean> userDefaultBlockWhenExhausted)
void
setPerUserDefaultAutoCommit(java.lang.String userName, java.lang.Boolean value)
Sets a user specific default value forConnection.setAutoCommit(boolean)
for the specified user's pool.(package private) void
setPerUserDefaultAutoCommit(java.util.Map<java.lang.String,java.lang.Boolean> userDefaultAutoCommit)
void
setPerUserDefaultReadOnly(java.lang.String userName, java.lang.Boolean value)
Sets a user specific default value forConnection.setReadOnly(boolean)
for the specified user's pool.(package private) void
setPerUserDefaultReadOnly(java.util.Map<java.lang.String,java.lang.Boolean> userDefaultReadOnly)
void
setPerUserDefaultTransactionIsolation(java.lang.String userName, java.lang.Integer value)
Sets a user specific default value forConnection.setTransactionIsolation(int)
for the specified user's pool.(package private) void
setPerUserDefaultTransactionIsolation(java.util.Map<java.lang.String,java.lang.Integer> userDefaultTransactionIsolation)
void
setPerUserEvictionPolicyClassName(java.lang.String userName, java.lang.String value)
Sets a user specific value forBaseGenericObjectPool.getEvictionPolicyClassName()
for the specified user's pool.(package private) void
setPerUserEvictionPolicyClassName(java.util.Map<java.lang.String,java.lang.String> userDefaultEvictionPolicyClassName)
void
setPerUserLifo(java.lang.String userName, java.lang.Boolean value)
Sets a user specific value forBaseGenericObjectPool.getLifo()
for the specified user's pool.(package private) void
setPerUserLifo(java.util.Map<java.lang.String,java.lang.Boolean> userDefaultLifo)
void
setPerUserMaxIdle(java.lang.String userName, java.lang.Integer value)
Sets a user specific value forGenericObjectPool.getMaxIdle()
for the specified user's pool.(package private) void
setPerUserMaxIdle(java.util.Map<java.lang.String,java.lang.Integer> userDefaultMaxIdle)
void
setPerUserMaxTotal(java.lang.String userName, java.lang.Integer value)
Sets a user specific value forBaseGenericObjectPool.getMaxTotal()
for the specified user's pool.(package private) void
setPerUserMaxTotal(java.util.Map<java.lang.String,java.lang.Integer> userDefaultMaxTotal)
void
setPerUserMaxWaitMillis(java.lang.String userName, java.lang.Long value)
Sets a user specific value forBaseGenericObjectPool.getMaxWaitMillis()
for the specified user's pool.(package private) void
setPerUserMaxWaitMillis(java.util.Map<java.lang.String,java.lang.Long> userDefaultMaxWaitMillis)
void
setPerUserMinEvictableIdleTimeMillis(java.lang.String userName, java.lang.Long value)
Sets a user specific value forBaseGenericObjectPool.getMinEvictableIdleTimeMillis()
for the specified user's pool.(package private) void
setPerUserMinEvictableIdleTimeMillis(java.util.Map<java.lang.String,java.lang.Long> userDefaultMinEvictableIdleTimeMillis)
void
setPerUserMinIdle(java.lang.String userName, java.lang.Integer value)
Sets a user specific value forGenericObjectPool.getMinIdle()
for the specified user's pool.(package private) void
setPerUserMinIdle(java.util.Map<java.lang.String,java.lang.Integer> userDefaultMinIdle)
void
setPerUserNumTestsPerEvictionRun(java.lang.String userName, java.lang.Integer value)
Sets a user specific value forBaseGenericObjectPool.getNumTestsPerEvictionRun()
for the specified user's pool.(package private) void
setPerUserNumTestsPerEvictionRun(java.util.Map<java.lang.String,java.lang.Integer> userDefaultNumTestsPerEvictionRun)
void
setPerUserSoftMinEvictableIdleTimeMillis(java.lang.String userName, java.lang.Long value)
Sets a user specific value forBaseGenericObjectPool.getSoftMinEvictableIdleTimeMillis()
for the specified user's pool.(package private) void
setPerUserSoftMinEvictableIdleTimeMillis(java.util.Map<java.lang.String,java.lang.Long> userDefaultSoftMinEvictableIdleTimeMillis)
void
setPerUserTestOnBorrow(java.lang.String userName, java.lang.Boolean value)
Sets a user specific value forBaseGenericObjectPool.getTestOnBorrow()
for the specified user's pool.(package private) void
setPerUserTestOnBorrow(java.util.Map<java.lang.String,java.lang.Boolean> userDefaultTestOnBorrow)
void
setPerUserTestOnCreate(java.lang.String userName, java.lang.Boolean value)
Sets a user specific value forBaseGenericObjectPool.getTestOnCreate()
for the specified user's pool.(package private) void
setPerUserTestOnCreate(java.util.Map<java.lang.String,java.lang.Boolean> userDefaultTestOnCreate)
void
setPerUserTestOnReturn(java.lang.String userName, java.lang.Boolean value)
Sets a user specific value forBaseGenericObjectPool.getTestOnReturn()
for the specified user's pool.(package private) void
setPerUserTestOnReturn(java.util.Map<java.lang.String,java.lang.Boolean> userDefaultTestOnReturn)
void
setPerUserTestWhileIdle(java.lang.String userName, java.lang.Boolean value)
Sets a user specific value forBaseGenericObjectPool.getTestWhileIdle()
for the specified user's pool.(package private) void
setPerUserTestWhileIdle(java.util.Map<java.lang.String,java.lang.Boolean> userDefaultTestWhileIdle)
void
setPerUserTimeBetweenEvictionRunsMillis(java.lang.String userName, java.lang.Long value)
Sets a user specific value for()
for the specified user's pool.(package private) void
setPerUserTimeBetweenEvictionRunsMillis(java.util.Map<java.lang.String,java.lang.Long> userDefaultTimeBetweenEvictionRunsMillis)
protected void
setupDefaults(java.sql.Connection con, java.lang.String userName)
-
Methods inherited from class org.datanucleus.store.rdbms.datasource.dbcp2.datasources.InstanceKeyDataSource
assertInitializationAllowed, getConnection, getConnection, getConnectionPoolDataSource, getDataSourceName, getDefaultBlockWhenExhausted, getDefaultEvictionPolicyClassName, getDefaultLifo, getDefaultMaxIdle, getDefaultMaxTotal, getDefaultMaxWaitMillis, getDefaultMinEvictableIdleTimeMillis, getDefaultMinIdle, getDefaultNumTestsPerEvictionRun, getDefaultSoftMinEvictableIdleTimeMillis, getDefaultTestOnBorrow, getDefaultTestOnCreate, getDefaultTestOnReturn, getDefaultTestWhileIdle, getDefaultTimeBetweenEvictionRunsMillis, getDefaultTransactionIsolation, getDescription, getInstanceKey, 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, setJndiEnvironment, setLoginTimeout, setLogWriter, setMaxConnLifetimeMillis, setRollbackAfterValidation, setValidationQuery, setValidationQueryTimeout, testCPDS, toString, toStringFields, unwrap
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
log
private static final org.datanucleus.util.NucleusLogger log
-
perUserBlockWhenExhausted
private java.util.Map<java.lang.String,java.lang.Boolean> perUserBlockWhenExhausted
-
perUserEvictionPolicyClassName
private java.util.Map<java.lang.String,java.lang.String> perUserEvictionPolicyClassName
-
perUserLifo
private java.util.Map<java.lang.String,java.lang.Boolean> perUserLifo
-
perUserMaxIdle
private java.util.Map<java.lang.String,java.lang.Integer> perUserMaxIdle
-
perUserMaxTotal
private java.util.Map<java.lang.String,java.lang.Integer> perUserMaxTotal
-
perUserMaxWaitMillis
private java.util.Map<java.lang.String,java.lang.Long> perUserMaxWaitMillis
-
perUserMinEvictableIdleTimeMillis
private java.util.Map<java.lang.String,java.lang.Long> perUserMinEvictableIdleTimeMillis
-
perUserMinIdle
private java.util.Map<java.lang.String,java.lang.Integer> perUserMinIdle
-
perUserNumTestsPerEvictionRun
private java.util.Map<java.lang.String,java.lang.Integer> perUserNumTestsPerEvictionRun
-
perUserSoftMinEvictableIdleTimeMillis
private java.util.Map<java.lang.String,java.lang.Long> perUserSoftMinEvictableIdleTimeMillis
-
perUserTestOnCreate
private java.util.Map<java.lang.String,java.lang.Boolean> perUserTestOnCreate
-
perUserTestOnBorrow
private java.util.Map<java.lang.String,java.lang.Boolean> perUserTestOnBorrow
-
perUserTestOnReturn
private java.util.Map<java.lang.String,java.lang.Boolean> perUserTestOnReturn
-
perUserTestWhileIdle
private java.util.Map<java.lang.String,java.lang.Boolean> perUserTestWhileIdle
-
perUserTimeBetweenEvictionRunsMillis
private java.util.Map<java.lang.String,java.lang.Long> perUserTimeBetweenEvictionRunsMillis
-
perUserDefaultAutoCommit
private java.util.Map<java.lang.String,java.lang.Boolean> perUserDefaultAutoCommit
-
perUserDefaultTransactionIsolation
private java.util.Map<java.lang.String,java.lang.Integer> perUserDefaultTransactionIsolation
-
perUserDefaultReadOnly
private java.util.Map<java.lang.String,java.lang.Boolean> perUserDefaultReadOnly
-
managers
private transient java.util.Map<PoolKey,PooledConnectionManager> managers
Map to keep track of Pools for a given user.
-
-
Method Detail
-
clear
public void clear()
Clears pool(s) maintained by this data source.- Since:
- 2.3.0
- See Also:
ObjectPool.clear()
-
close
public void close()
Closes pool(s) maintained by this data source.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in classInstanceKeyDataSource
- See Also:
ObjectPool.close()
-
createMap
private java.util.HashMap<java.lang.String,java.lang.Boolean> createMap()
-
getConnectionManager
protected PooledConnectionManager getConnectionManager(UserPassKey upKey)
- Specified by:
getConnectionManager
in classInstanceKeyDataSource
-
getCPDSConnectionFactoryPool
private ObjectPool<PooledConnectionAndInfo> getCPDSConnectionFactoryPool(PooledConnectionManager manager)
-
getNumActive
public int getNumActive()
Gets the number of active connections in the default pool.- Returns:
- The number of active connections in the default pool.
-
getNumActive
public int getNumActive(java.lang.String userName)
Gets the number of active connections in the pool for a given user.- Parameters:
userName
- The user name key.- Returns:
- The user specific value.
-
getNumIdle
public int getNumIdle()
Gets the number of idle connections in the default pool.- Returns:
- The number of idle connections in the default pool.
-
getNumIdle
public int getNumIdle(java.lang.String userName)
Gets the number of idle connections in the pool for a given user.- Parameters:
userName
- The user name key.- Returns:
- The user specific value.
-
getPerUserBlockWhenExhausted
public boolean getPerUserBlockWhenExhausted(java.lang.String userName)
Gets the user specific value forBaseGenericObjectPool.getBlockWhenExhausted()
for the specified user's pool or the default if no user specific value is defined.- Parameters:
userName
- The user name key.- Returns:
- The user specific value.
-
getPerUserDefaultAutoCommit
public java.lang.Boolean getPerUserDefaultAutoCommit(java.lang.String userName)
Gets the user specific default value forConnection.setAutoCommit(boolean)
for the specified user's pool.- Parameters:
userName
- The user name key.- Returns:
- The user specific value.
-
getPerUserDefaultReadOnly
public java.lang.Boolean getPerUserDefaultReadOnly(java.lang.String userName)
Gets the user specific default value forConnection.setReadOnly(boolean)
for the specified user's pool.- Parameters:
userName
- The user name key.- Returns:
- The user specific value.
-
getPerUserDefaultTransactionIsolation
public java.lang.Integer getPerUserDefaultTransactionIsolation(java.lang.String userName)
Gets the user specific default value forConnection.setTransactionIsolation(int)
for the specified user's pool.- Parameters:
userName
- The user name key.- Returns:
- The user specific value.
-
getPerUserEvictionPolicyClassName
public java.lang.String getPerUserEvictionPolicyClassName(java.lang.String userName)
Gets the user specific value forBaseGenericObjectPool.getEvictionPolicyClassName()
for the specified user's pool or the default if no user specific value is defined.- Parameters:
userName
- The user name key.- Returns:
- The user specific value.
-
getPerUserLifo
public boolean getPerUserLifo(java.lang.String userName)
Gets the user specific value forBaseGenericObjectPool.getLifo()
for the specified user's pool or the default if no user specific value is defined.- Parameters:
userName
- The user name key.- Returns:
- The user specific value.
-
getPerUserMaxIdle
public int getPerUserMaxIdle(java.lang.String userName)
Gets the user specific value forGenericObjectPool.getMaxIdle()
for the specified user's pool or the default if no user specific value is defined.- Parameters:
userName
- The user name key.- Returns:
- The user specific value.
-
getPerUserMaxTotal
public int getPerUserMaxTotal(java.lang.String userName)
Gets the user specific value forBaseGenericObjectPool.getMaxTotal()
for the specified user's pool or the default if no user specific value is defined.- Parameters:
userName
- The user name key.- Returns:
- The user specific value.
-
getPerUserMaxWaitMillis
public long getPerUserMaxWaitMillis(java.lang.String userName)
Gets the user specific value forBaseGenericObjectPool.getMaxWaitMillis()
for the specified user's pool or the default if no user specific value is defined.- Parameters:
userName
- The user name key.- Returns:
- The user specific value.
-
getPerUserMinEvictableIdleTimeMillis
public long getPerUserMinEvictableIdleTimeMillis(java.lang.String userName)
Gets the user specific value forBaseGenericObjectPool.getMinEvictableIdleTimeMillis()
for the specified user's pool or the default if no user specific value is defined.- Parameters:
userName
- The user name key.- Returns:
- The user specific value.
-
getPerUserMinIdle
public int getPerUserMinIdle(java.lang.String userName)
Gets the user specific value forGenericObjectPool.getMinIdle()
for the specified user's pool or the default if no user specific value is defined.- Parameters:
userName
- The user name key.- Returns:
- The user specific value.
-
getPerUserNumTestsPerEvictionRun
public int getPerUserNumTestsPerEvictionRun(java.lang.String userName)
Gets the user specific value forBaseGenericObjectPool.getNumTestsPerEvictionRun()
for the specified user's pool or the default if no user specific value is defined.- Parameters:
userName
- The user name key.- Returns:
- The user specific value.
-
getPerUserSoftMinEvictableIdleTimeMillis
public long getPerUserSoftMinEvictableIdleTimeMillis(java.lang.String userName)
Gets the user specific value forBaseGenericObjectPool.getSoftMinEvictableIdleTimeMillis()
for the specified user's pool or the default if no user specific value is defined.- Parameters:
userName
- The user name key.- Returns:
- The user specific value.
-
getPerUserTestOnBorrow
public boolean getPerUserTestOnBorrow(java.lang.String userName)
Gets the user specific value forBaseGenericObjectPool.getTestOnBorrow()
for the specified user's pool or the default if no user specific value is defined.- Parameters:
userName
- The user name key.- Returns:
- The user specific value.
-
getPerUserTestOnCreate
public boolean getPerUserTestOnCreate(java.lang.String userName)
Gets the user specific value forBaseGenericObjectPool.getTestOnCreate()
for the specified user's pool or the default if no user specific value is defined.- Parameters:
userName
- The user name key.- Returns:
- The user specific value.
-
getPerUserTestOnReturn
public boolean getPerUserTestOnReturn(java.lang.String userName)
Gets the user specific value forBaseGenericObjectPool.getTestOnReturn()
for the specified user's pool or the default if no user specific value is defined.- Parameters:
userName
- The user name key.- Returns:
- The user specific value.
-
getPerUserTestWhileIdle
public boolean getPerUserTestWhileIdle(java.lang.String userName)
Gets the user specific value forBaseGenericObjectPool.getTestWhileIdle()
for the specified user's pool or the default if no user specific value is defined.- Parameters:
userName
- The user name key.- Returns:
- The user specific value.
-
getPerUserTimeBetweenEvictionRunsMillis
public long getPerUserTimeBetweenEvictionRunsMillis(java.lang.String userName)
Gets the user specific value forBaseGenericObjectPool.getTimeBetweenEvictionRunsMillis()
for the specified user's pool or the default if no user specific value is defined.- Parameters:
userName
- The user name key.- Returns:
- The user specific value.
-
getPool
private ObjectPool<PooledConnectionAndInfo> getPool(PoolKey poolKey)
Returns the object pool associated with the given PoolKey.- Parameters:
poolKey
- PoolKey identifying the pool- Returns:
- the GenericObjectPool pooling connections for the userName and datasource specified by the PoolKey
-
getPooledConnectionAndInfo
protected PooledConnectionAndInfo getPooledConnectionAndInfo(java.lang.String userName, java.lang.String password) throws java.sql.SQLException
- Specified by:
getPooledConnectionAndInfo
in classInstanceKeyDataSource
- Throws:
java.sql.SQLException
-
getPoolKey
private PoolKey getPoolKey(java.lang.String userName)
Creates a pool key from the provided parameters.- Parameters:
userName
- User name- Returns:
- The pool key
-
getReference
public javax.naming.Reference getReference() throws javax.naming.NamingException
Returns aPerUserPoolDataSource
Reference
.- Throws:
javax.naming.NamingException
-
readObject
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
Supports Serialization interface.- Parameters:
in
- ajava.io.ObjectInputStream
value- Throws:
java.io.IOException
- if an error occursjava.lang.ClassNotFoundException
- if an error occurs
-
registerPool
private void registerPool(java.lang.String userName, java.lang.String password) throws javax.naming.NamingException, java.sql.SQLException
- Throws:
javax.naming.NamingException
java.sql.SQLException
-
setPerUserBlockWhenExhausted
void setPerUserBlockWhenExhausted(java.util.Map<java.lang.String,java.lang.Boolean> userDefaultBlockWhenExhausted)
-
setPerUserBlockWhenExhausted
public void setPerUserBlockWhenExhausted(java.lang.String userName, java.lang.Boolean value)
Sets a user specific value forBaseGenericObjectPool.getBlockWhenExhausted()
for the specified user's pool.- Parameters:
userName
- The user name key.value
- The user specific value.
-
setPerUserDefaultAutoCommit
void setPerUserDefaultAutoCommit(java.util.Map<java.lang.String,java.lang.Boolean> userDefaultAutoCommit)
-
setPerUserDefaultAutoCommit
public void setPerUserDefaultAutoCommit(java.lang.String userName, java.lang.Boolean value)
Sets a user specific default value forConnection.setAutoCommit(boolean)
for the specified user's pool.- Parameters:
userName
- The user name key.value
- The user specific value.
-
setPerUserDefaultReadOnly
void setPerUserDefaultReadOnly(java.util.Map<java.lang.String,java.lang.Boolean> userDefaultReadOnly)
-
setPerUserDefaultReadOnly
public void setPerUserDefaultReadOnly(java.lang.String userName, java.lang.Boolean value)
Sets a user specific default value forConnection.setReadOnly(boolean)
for the specified user's pool.- Parameters:
userName
- The user name key.value
- The user specific value.
-
setPerUserDefaultTransactionIsolation
void setPerUserDefaultTransactionIsolation(java.util.Map<java.lang.String,java.lang.Integer> userDefaultTransactionIsolation)
-
setPerUserDefaultTransactionIsolation
public void setPerUserDefaultTransactionIsolation(java.lang.String userName, java.lang.Integer value)
Sets a user specific default value forConnection.setTransactionIsolation(int)
for the specified user's pool.- Parameters:
userName
- The user name key.value
- The user specific value.
-
setPerUserEvictionPolicyClassName
void setPerUserEvictionPolicyClassName(java.util.Map<java.lang.String,java.lang.String> userDefaultEvictionPolicyClassName)
-
setPerUserEvictionPolicyClassName
public void setPerUserEvictionPolicyClassName(java.lang.String userName, java.lang.String value)
Sets a user specific value forBaseGenericObjectPool.getEvictionPolicyClassName()
for the specified user's pool.- Parameters:
userName
- The user name key.value
- The user specific value.
-
setPerUserLifo
void setPerUserLifo(java.util.Map<java.lang.String,java.lang.Boolean> userDefaultLifo)
-
setPerUserLifo
public void setPerUserLifo(java.lang.String userName, java.lang.Boolean value)
Sets a user specific value forBaseGenericObjectPool.getLifo()
for the specified user's pool.- Parameters:
userName
- The user name key.value
- The user specific value.
-
setPerUserMaxIdle
void setPerUserMaxIdle(java.util.Map<java.lang.String,java.lang.Integer> userDefaultMaxIdle)
-
setPerUserMaxIdle
public void setPerUserMaxIdle(java.lang.String userName, java.lang.Integer value)
Sets a user specific value forGenericObjectPool.getMaxIdle()
for the specified user's pool.- Parameters:
userName
- The user name key.value
- The user specific value.
-
setPerUserMaxTotal
void setPerUserMaxTotal(java.util.Map<java.lang.String,java.lang.Integer> userDefaultMaxTotal)
-
setPerUserMaxTotal
public void setPerUserMaxTotal(java.lang.String userName, java.lang.Integer value)
Sets a user specific value forBaseGenericObjectPool.getMaxTotal()
for the specified user's pool.- Parameters:
userName
- The user name key.value
- The user specific value.
-
setPerUserMaxWaitMillis
void setPerUserMaxWaitMillis(java.util.Map<java.lang.String,java.lang.Long> userDefaultMaxWaitMillis)
-
setPerUserMaxWaitMillis
public void setPerUserMaxWaitMillis(java.lang.String userName, java.lang.Long value)
Sets a user specific value forBaseGenericObjectPool.getMaxWaitMillis()
for the specified user's pool.- Parameters:
userName
- The user name key.value
- The user specific value.
-
setPerUserMinEvictableIdleTimeMillis
void setPerUserMinEvictableIdleTimeMillis(java.util.Map<java.lang.String,java.lang.Long> userDefaultMinEvictableIdleTimeMillis)
-
setPerUserMinEvictableIdleTimeMillis
public void setPerUserMinEvictableIdleTimeMillis(java.lang.String userName, java.lang.Long value)
Sets a user specific value forBaseGenericObjectPool.getMinEvictableIdleTimeMillis()
for the specified user's pool.- Parameters:
userName
- The user name key.value
- The user specific value.
-
setPerUserMinIdle
void setPerUserMinIdle(java.util.Map<java.lang.String,java.lang.Integer> userDefaultMinIdle)
-
setPerUserMinIdle
public void setPerUserMinIdle(java.lang.String userName, java.lang.Integer value)
Sets a user specific value forGenericObjectPool.getMinIdle()
for the specified user's pool.- Parameters:
userName
- The user name key.value
- The user specific value.
-
setPerUserNumTestsPerEvictionRun
void setPerUserNumTestsPerEvictionRun(java.util.Map<java.lang.String,java.lang.Integer> userDefaultNumTestsPerEvictionRun)
-
setPerUserNumTestsPerEvictionRun
public void setPerUserNumTestsPerEvictionRun(java.lang.String userName, java.lang.Integer value)
Sets a user specific value forBaseGenericObjectPool.getNumTestsPerEvictionRun()
for the specified user's pool.- Parameters:
userName
- The user name key.value
- The user specific value.
-
setPerUserSoftMinEvictableIdleTimeMillis
void setPerUserSoftMinEvictableIdleTimeMillis(java.util.Map<java.lang.String,java.lang.Long> userDefaultSoftMinEvictableIdleTimeMillis)
-
setPerUserSoftMinEvictableIdleTimeMillis
public void setPerUserSoftMinEvictableIdleTimeMillis(java.lang.String userName, java.lang.Long value)
Sets a user specific value forBaseGenericObjectPool.getSoftMinEvictableIdleTimeMillis()
for the specified user's pool.- Parameters:
userName
- The user name key.value
- The user specific value.
-
setPerUserTestOnBorrow
void setPerUserTestOnBorrow(java.util.Map<java.lang.String,java.lang.Boolean> userDefaultTestOnBorrow)
-
setPerUserTestOnBorrow
public void setPerUserTestOnBorrow(java.lang.String userName, java.lang.Boolean value)
Sets a user specific value forBaseGenericObjectPool.getTestOnBorrow()
for the specified user's pool.- Parameters:
userName
- The user name key.value
- The user specific value.
-
setPerUserTestOnCreate
void setPerUserTestOnCreate(java.util.Map<java.lang.String,java.lang.Boolean> userDefaultTestOnCreate)
-
setPerUserTestOnCreate
public void setPerUserTestOnCreate(java.lang.String userName, java.lang.Boolean value)
Sets a user specific value forBaseGenericObjectPool.getTestOnCreate()
for the specified user's pool.- Parameters:
userName
- The user name key.value
- The user specific value.
-
setPerUserTestOnReturn
void setPerUserTestOnReturn(java.util.Map<java.lang.String,java.lang.Boolean> userDefaultTestOnReturn)
-
setPerUserTestOnReturn
public void setPerUserTestOnReturn(java.lang.String userName, java.lang.Boolean value)
Sets a user specific value forBaseGenericObjectPool.getTestOnReturn()
for the specified user's pool.- Parameters:
userName
- The user name key.value
- The user specific value.
-
setPerUserTestWhileIdle
void setPerUserTestWhileIdle(java.util.Map<java.lang.String,java.lang.Boolean> userDefaultTestWhileIdle)
-
setPerUserTestWhileIdle
public void setPerUserTestWhileIdle(java.lang.String userName, java.lang.Boolean value)
Sets a user specific value forBaseGenericObjectPool.getTestWhileIdle()
for the specified user's pool.- Parameters:
userName
- The user name key.value
- The user specific value.
-
setPerUserTimeBetweenEvictionRunsMillis
void setPerUserTimeBetweenEvictionRunsMillis(java.util.Map<java.lang.String,java.lang.Long> userDefaultTimeBetweenEvictionRunsMillis)
-
setPerUserTimeBetweenEvictionRunsMillis
public void setPerUserTimeBetweenEvictionRunsMillis(java.lang.String userName, java.lang.Long value)
Sets a user specific value for()
for the specified user's pool.- Parameters:
userName
- The user name key.value
- The user specific value.
-
setupDefaults
protected void setupDefaults(java.sql.Connection con, java.lang.String userName) throws java.sql.SQLException
- Specified by:
setupDefaults
in classInstanceKeyDataSource
- Throws:
java.sql.SQLException
-
-