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 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.
Constructor and Description |
---|
PerUserPoolDataSource()
Default no-arg constructor for Serialization
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close pool(s) being maintained by this datasource.
|
int |
getNumActive()
Get the number of active connections in the default pool.
|
int |
getNumActive(java.lang.String username)
Get the number of active connections in the pool for a given user.
|
int |
getNumIdle()
Get the number of idle connections in the default pool.
|
int |
getNumIdle(java.lang.String username)
Get the number of idle connections in the pool for a given user.
|
boolean |
getPerUserBlockWhenExhausted(java.lang.String key)
Gets the user specific value for
BaseGenericObjectPool.getBlockWhenExhausted() for the
specified user's pool or the default if no user specific value is defined. |
java.lang.Boolean |
getPerUserDefaultAutoCommit(java.lang.String key)
Gets the user specific default value for
Connection.setAutoCommit(boolean) for the specified user's pool. |
java.lang.Boolean |
getPerUserDefaultReadOnly(java.lang.String key)
Gets the user specific default value for
Connection.setReadOnly(boolean) for the specified user's pool. |
java.lang.Integer |
getPerUserDefaultTransactionIsolation(java.lang.String key)
Gets the user specific default value for
Connection.setTransactionIsolation(int) for the specified user's pool. |
java.lang.String |
getPerUserEvictionPolicyClassName(java.lang.String key)
Gets the user specific value for
BaseGenericObjectPool.getEvictionPolicyClassName() for the
specified user's pool or the default if no user specific value is defined. |
boolean |
getPerUserLifo(java.lang.String key)
Gets the user specific value for
BaseGenericObjectPool.getLifo() for
the specified user's pool or the default if no user specific value is
defined. |
int |
getPerUserMaxIdle(java.lang.String key)
Gets the user specific value for
GenericObjectPool.getMaxIdle() for the
specified user's pool or the default if no user specific value is defined. |
int |
getPerUserMaxTotal(java.lang.String key)
Gets the user specific value for
BaseGenericObjectPool.getMaxTotal() for the
specified user's pool or the default if no user specific value is defined. |
long |
getPerUserMaxWaitMillis(java.lang.String key)
Gets the user specific value for
BaseGenericObjectPool.getMaxWaitMillis() for the
specified user's pool or the default if no user specific value is defined. |
long |
getPerUserMinEvictableIdleTimeMillis(java.lang.String key)
Gets the user specific value for
BaseGenericObjectPool.getMinEvictableIdleTimeMillis() for the
specified user's pool or the default if no user specific value is defined. |
int |
getPerUserMinIdle(java.lang.String key)
Gets the user specific value for
GenericObjectPool.getMinIdle() for the
specified user's pool or the default if no user specific value is defined. |
int |
getPerUserNumTestsPerEvictionRun(java.lang.String key)
Gets the user specific value for
BaseGenericObjectPool.getNumTestsPerEvictionRun() for the
specified user's pool or the default if no user specific value is defined. |
long |
getPerUserSoftMinEvictableIdleTimeMillis(java.lang.String key)
Gets the user specific value for
BaseGenericObjectPool.getSoftMinEvictableIdleTimeMillis() for the
specified user's pool or the default if no user specific value is defined. |
boolean |
getPerUserTestOnBorrow(java.lang.String key)
Gets the user specific value for
BaseGenericObjectPool.getTestOnBorrow() for the
specified user's pool or the default if no user specific value is defined. |
boolean |
getPerUserTestOnCreate(java.lang.String key)
Gets the user specific value for
BaseGenericObjectPool.getTestOnCreate() for the
specified user's pool or the default if no user specific value is defined. |
boolean |
getPerUserTestOnReturn(java.lang.String key)
Gets the user specific value for
BaseGenericObjectPool.getTestOnReturn() for the
specified user's pool or the default if no user specific value is defined. |
boolean |
getPerUserTestWhileIdle(java.lang.String key)
Gets the user specific value for
BaseGenericObjectPool.getTestWhileIdle() for the
specified user's pool or the default if no user specific value is defined. |
long |
getPerUserTimeBetweenEvictionRunsMillis(java.lang.String key)
Gets the user specific value for
BaseGenericObjectPool.getTimeBetweenEvictionRunsMillis() for the
specified user's pool or the default if no user specific value is defined. |
javax.naming.Reference |
getReference()
Returns a
PerUserPoolDataSource Reference . |
void |
setPerUserBlockWhenExhausted(java.lang.String username,
java.lang.Boolean value)
Sets a user specific value for
BaseGenericObjectPool.getBlockWhenExhausted() for the specified
user's pool. |
void |
setPerUserDefaultAutoCommit(java.lang.String username,
java.lang.Boolean value)
Sets a user specific default value for
Connection.setAutoCommit(boolean) for the specified user's pool. |
void |
setPerUserDefaultReadOnly(java.lang.String username,
java.lang.Boolean value)
Sets a user specific default value for
Connection.setReadOnly(boolean) for the specified user's pool. |
void |
setPerUserDefaultTransactionIsolation(java.lang.String username,
java.lang.Integer value)
Sets a user specific default value for
Connection.setTransactionIsolation(int) for the specified user's pool. |
void |
setPerUserEvictionPolicyClassName(java.lang.String username,
java.lang.String value)
Sets a user specific value for
BaseGenericObjectPool.getEvictionPolicyClassName() for the specified
user's pool. |
void |
setPerUserLifo(java.lang.String username,
java.lang.Boolean value)
Sets a user specific value for
BaseGenericObjectPool.getLifo() for the specified
user's pool. |
void |
setPerUserMaxIdle(java.lang.String username,
java.lang.Integer value)
Sets a user specific value for
GenericObjectPool.getMaxIdle() for the specified
user's pool. |
void |
setPerUserMaxTotal(java.lang.String username,
java.lang.Integer value)
Sets a user specific value for
BaseGenericObjectPool.getMaxTotal() for the specified
user's pool. |
void |
setPerUserMaxWaitMillis(java.lang.String username,
java.lang.Long value)
Sets a user specific value for
BaseGenericObjectPool.getMaxWaitMillis() for the specified
user's pool. |
void |
setPerUserMinEvictableIdleTimeMillis(java.lang.String username,
java.lang.Long value)
Sets a user specific value for
BaseGenericObjectPool.getMinEvictableIdleTimeMillis() for the
specified user's pool. |
void |
setPerUserMinIdle(java.lang.String username,
java.lang.Integer value)
Sets a user specific value for
GenericObjectPool.getMinIdle() for the specified
user's pool. |
void |
setPerUserNumTestsPerEvictionRun(java.lang.String username,
java.lang.Integer value)
Sets a user specific value for
BaseGenericObjectPool.getNumTestsPerEvictionRun() for the specified
user's pool. |
void |
setPerUserSoftMinEvictableIdleTimeMillis(java.lang.String username,
java.lang.Long value)
Sets a user specific value for
BaseGenericObjectPool.getSoftMinEvictableIdleTimeMillis() for the
specified user's pool. |
void |
setPerUserTestOnBorrow(java.lang.String username,
java.lang.Boolean value)
Sets a user specific value for
BaseGenericObjectPool.getTestOnBorrow() for the specified
user's pool. |
void |
setPerUserTestOnCreate(java.lang.String username,
java.lang.Boolean value)
Sets a user specific value for
BaseGenericObjectPool.getTestOnCreate() for the specified
user's pool. |
void |
setPerUserTestOnReturn(java.lang.String username,
java.lang.Boolean value)
Sets a user specific value for
BaseGenericObjectPool.getTestOnReturn() for the specified
user's pool. |
void |
setPerUserTestWhileIdle(java.lang.String username,
java.lang.Boolean value)
Sets a user specific value for
BaseGenericObjectPool.getTestWhileIdle() for the specified
user's pool. |
void |
setPerUserTimeBetweenEvictionRunsMillis(java.lang.String username,
java.lang.Long value)
Sets a user specific value for
() for the specified
user's pool. |
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, unwrap
public PerUserPoolDataSource()
public void close()
close
in interface java.lang.AutoCloseable
close
in class InstanceKeyDataSource
public int getNumActive()
public int getNumActive(java.lang.String username)
public int getNumIdle()
public int getNumIdle(java.lang.String username)
public boolean getPerUserBlockWhenExhausted(java.lang.String key)
BaseGenericObjectPool.getBlockWhenExhausted()
for the
specified user's pool or the default if no user specific value is defined.public java.lang.Boolean getPerUserDefaultAutoCommit(java.lang.String key)
Connection.setAutoCommit(boolean)
for the specified user's pool.public java.lang.Boolean getPerUserDefaultReadOnly(java.lang.String key)
Connection.setReadOnly(boolean)
for the specified user's pool.public java.lang.Integer getPerUserDefaultTransactionIsolation(java.lang.String key)
Connection.setTransactionIsolation(int)
for the specified user's pool.public java.lang.String getPerUserEvictionPolicyClassName(java.lang.String key)
BaseGenericObjectPool.getEvictionPolicyClassName()
for the
specified user's pool or the default if no user specific value is defined.public boolean getPerUserLifo(java.lang.String key)
BaseGenericObjectPool.getLifo()
for
the specified user's pool or the default if no user specific value is
defined.public int getPerUserMaxIdle(java.lang.String key)
GenericObjectPool.getMaxIdle()
for the
specified user's pool or the default if no user specific value is defined.public int getPerUserMaxTotal(java.lang.String key)
BaseGenericObjectPool.getMaxTotal()
for the
specified user's pool or the default if no user specific value is defined.public long getPerUserMaxWaitMillis(java.lang.String key)
BaseGenericObjectPool.getMaxWaitMillis()
for the
specified user's pool or the default if no user specific value is defined.public long getPerUserMinEvictableIdleTimeMillis(java.lang.String key)
BaseGenericObjectPool.getMinEvictableIdleTimeMillis()
for the
specified user's pool or the default if no user specific value is defined.public int getPerUserMinIdle(java.lang.String key)
GenericObjectPool.getMinIdle()
for the
specified user's pool or the default if no user specific value is defined.public int getPerUserNumTestsPerEvictionRun(java.lang.String key)
BaseGenericObjectPool.getNumTestsPerEvictionRun()
for the
specified user's pool or the default if no user specific value is defined.public long getPerUserSoftMinEvictableIdleTimeMillis(java.lang.String key)
BaseGenericObjectPool.getSoftMinEvictableIdleTimeMillis()
for the
specified user's pool or the default if no user specific value is defined.public boolean getPerUserTestOnBorrow(java.lang.String key)
BaseGenericObjectPool.getTestOnBorrow()
for the
specified user's pool or the default if no user specific value is defined.public boolean getPerUserTestOnCreate(java.lang.String key)
BaseGenericObjectPool.getTestOnCreate()
for the
specified user's pool or the default if no user specific value is defined.public boolean getPerUserTestOnReturn(java.lang.String key)
BaseGenericObjectPool.getTestOnReturn()
for the
specified user's pool or the default if no user specific value is defined.public boolean getPerUserTestWhileIdle(java.lang.String key)
BaseGenericObjectPool.getTestWhileIdle()
for the
specified user's pool or the default if no user specific value is defined.public long getPerUserTimeBetweenEvictionRunsMillis(java.lang.String key)
BaseGenericObjectPool.getTimeBetweenEvictionRunsMillis()
for the
specified user's pool or the default if no user specific value is defined.public javax.naming.Reference getReference() throws javax.naming.NamingException
PerUserPoolDataSource
Reference
.javax.naming.NamingException
public void setPerUserBlockWhenExhausted(java.lang.String username, java.lang.Boolean value)
BaseGenericObjectPool.getBlockWhenExhausted()
for the specified
user's pool.public void setPerUserDefaultAutoCommit(java.lang.String username, java.lang.Boolean value)
Connection.setAutoCommit(boolean)
for the specified user's pool.public void setPerUserDefaultReadOnly(java.lang.String username, java.lang.Boolean value)
Connection.setReadOnly(boolean)
for the specified user's pool.public void setPerUserDefaultTransactionIsolation(java.lang.String username, java.lang.Integer value)
Connection.setTransactionIsolation(int)
for the specified user's pool.public void setPerUserEvictionPolicyClassName(java.lang.String username, java.lang.String value)
BaseGenericObjectPool.getEvictionPolicyClassName()
for the specified
user's pool.public void setPerUserLifo(java.lang.String username, java.lang.Boolean value)
BaseGenericObjectPool.getLifo()
for the specified
user's pool.public void setPerUserMaxIdle(java.lang.String username, java.lang.Integer value)
GenericObjectPool.getMaxIdle()
for the specified
user's pool.public void setPerUserMaxTotal(java.lang.String username, java.lang.Integer value)
BaseGenericObjectPool.getMaxTotal()
for the specified
user's pool.public void setPerUserMaxWaitMillis(java.lang.String username, java.lang.Long value)
BaseGenericObjectPool.getMaxWaitMillis()
for the specified
user's pool.public void setPerUserMinEvictableIdleTimeMillis(java.lang.String username, java.lang.Long value)
BaseGenericObjectPool.getMinEvictableIdleTimeMillis()
for the
specified user's pool.public void setPerUserMinIdle(java.lang.String username, java.lang.Integer value)
GenericObjectPool.getMinIdle()
for the specified
user's pool.public void setPerUserNumTestsPerEvictionRun(java.lang.String username, java.lang.Integer value)
BaseGenericObjectPool.getNumTestsPerEvictionRun()
for the specified
user's pool.public void setPerUserSoftMinEvictableIdleTimeMillis(java.lang.String username, java.lang.Long value)
BaseGenericObjectPool.getSoftMinEvictableIdleTimeMillis()
for the
specified user's pool.public void setPerUserTestOnBorrow(java.lang.String username, java.lang.Boolean value)
BaseGenericObjectPool.getTestOnBorrow()
for the specified
user's pool.public void setPerUserTestOnCreate(java.lang.String username, java.lang.Boolean value)
BaseGenericObjectPool.getTestOnCreate()
for the specified
user's pool.public void setPerUserTestOnReturn(java.lang.String username, java.lang.Boolean value)
BaseGenericObjectPool.getTestOnReturn()
for the specified
user's pool.public void setPerUserTestWhileIdle(java.lang.String username, java.lang.Boolean value)
BaseGenericObjectPool.getTestWhileIdle()
for the specified
user's pool.public void setPerUserTimeBetweenEvictionRunsMillis(java.lang.String username, java.lang.Long value)
()
for the specified
user's pool.Copyright © 2001-2015 Apache Software Foundation. Documenation generated November 28 2016.