| Method from org.apache.commons.dbcp.datasources.PerUserPoolDataSource Detail: |
public void close() {
for (Iterator poolIter = pools.values().iterator();
poolIter.hasNext();) {
try {
((ObjectPool) poolIter.next()).close();
} catch (Exception closePoolException) {
//ignore and try to close others.
}
}
InstanceKeyObjectFactory.removeInstance(instanceKey);
}
Close pool(s) being maintained by this datasource. |
public int getDefaultMaxActive() {
return (this.defaultMaxActive);
}
The maximum number of active connections that can be allocated from
this pool at the same time, or non-positive for no limit.
This value is used for any username which is not specified
in perUserMaxConnections. |
public int getDefaultMaxIdle() {
return (this.defaultMaxIdle);
}
The maximum number of active connections that can remain idle in the
pool, without extra ones being released, or negative for no limit.
This value is used for any username which is not specified
in perUserMaxIdle. |
public int getDefaultMaxWait() {
return (this.defaultMaxWait);
}
The maximum number of milliseconds that the pool will wait (when there
are no available connections) for a connection to be returned before
throwing an exception, or -1 to wait indefinitely. Will fail
immediately if value is 0.
This value is used for any username which is not specified
in perUserMaxWait. The default is -1. |
public int getNumActive() {
return getNumActive(null, null);
}
Get the number of active connections in the default pool. |
public int getNumActive(String username,
String password) {
ObjectPool pool = (ObjectPool)pools.get(getPoolKey(username));
return (pool == null) ? 0 : pool.getNumActive();
}
Get the number of active connections in the pool for a given user. |
public int getNumIdle() {
return getNumIdle(null, null);
}
Get the number of idle connections in the default pool. |
public int getNumIdle(String username,
String password) {
ObjectPool pool = (ObjectPool)pools.get(getPoolKey(username));
return (pool == null) ? 0 : pool.getNumIdle();
}
Get the number of idle connections in the pool for a given user. |
public Boolean getPerUserDefaultAutoCommit(String key) {
Boolean value = null;
if (perUserDefaultAutoCommit != null) {
value = (Boolean) perUserDefaultAutoCommit.get(key);
}
return value;
}
The keys are usernames and the value is the --. Any
username specified here will override the value of defaultAutoCommit. |
public Boolean getPerUserDefaultReadOnly(String username) {
Boolean value = null;
if (perUserDefaultReadOnly != null) {
value = (Boolean) perUserDefaultReadOnly.get(username);
}
return value;
}
The keys are usernames and the value is the --. Any
username specified here will override the value of defaultReadOnly. |
public Integer getPerUserDefaultTransactionIsolation(String username) {
Integer value = null;
if (perUserDefaultTransactionIsolation != null) {
value = (Integer) perUserDefaultTransactionIsolation.get(username);
}
return value;
}
The isolation level of connections when returned from getConnection.
If null, the username will use the value of defaultTransactionIsolation. |
public Integer getPerUserMaxActive(String username) {
Integer value = null;
if (perUserMaxActive != null) {
value = (Integer) perUserMaxActive.get(username);
}
return value;
}
The maximum number of active connections that can be allocated from
this pool at the same time, or non-positive for no limit.
The keys are usernames and the value is the maximum connections. Any
username specified here will override the value of defaultMaxActive. |
public Integer getPerUserMaxIdle(String username) {
Integer value = null;
if (perUserMaxIdle != null) {
value = (Integer) perUserMaxIdle.get(username);
}
return value;
}
The maximum number of active connections that can remain idle in the
pool, without extra ones being released, or negative for no limit.
The keys are usernames and the value is the maximum connections. Any
username specified here will override the value of defaultMaxIdle. |
public Integer getPerUserMaxWait(String username) {
Integer value = null;
if (perUserMaxWait != null) {
value = (Integer) perUserMaxWait.get(username);
}
return value;
}
The maximum number of milliseconds that the pool will wait (when there
are no available connections) for a connection to be returned before
throwing an exception, or -1 to wait indefinitely. Will fail
immediately if value is 0.
The keys are usernames and the value is the maximum connections. Any
username specified here will override the value of defaultMaxWait. |
protected synchronized PooledConnectionAndInfo getPooledConnectionAndInfo(String username,
String password) throws SQLException {
PoolKey key = getPoolKey(username);
Object pool = pools.get(key);
if (pool == null) {
try {
registerPool(username, password);
pool = pools.get(key);
} catch (NamingException e) {
throw new SQLNestedException("RegisterPool failed", e);
}
}
PooledConnectionAndInfo info = null;
try {
info = (PooledConnectionAndInfo)((ObjectPool) pool).borrowObject();
}
catch (Exception e) {
throw new SQLNestedException(
"Could not retrieve connection info from pool", e);
}
return info;
}
|
public Reference getReference() throws NamingException {
Reference ref = new Reference(getClass().getName(),
PerUserPoolDataSourceFactory.class.getName(), null);
ref.add(new StringRefAddr("instanceKey", instanceKey));
return ref;
}
|
public void setDefaultMaxActive(int maxActive) {
assertInitializationAllowed();
this.defaultMaxActive = maxActive;
}
The maximum number of active connections that can be allocated from
this pool at the same time, or non-positive for no limit.
This value is used for any username which is not specified
in perUserMaxConnections. The default is 8. |
public void setDefaultMaxIdle(int defaultMaxIdle) {
assertInitializationAllowed();
this.defaultMaxIdle = defaultMaxIdle;
}
The maximum number of active connections that can remain idle in the
pool, without extra ones being released, or negative for no limit.
This value is used for any username which is not specified
in perUserMaxIdle. The default is 8. |
public void setDefaultMaxWait(int defaultMaxWait) {
assertInitializationAllowed();
this.defaultMaxWait = defaultMaxWait;
}
The maximum number of milliseconds that the pool will wait (when there
are no available connections) for a connection to be returned before
throwing an exception, or -1 to wait indefinitely. Will fail
immediately if value is 0.
This value is used for any username which is not specified
in perUserMaxWait. The default is -1. |
public void setPerUserDefaultAutoCommit(String username,
Boolean value) {
assertInitializationAllowed();
if (perUserDefaultAutoCommit == null) {
perUserDefaultAutoCommit = new HashMap();
}
perUserDefaultAutoCommit.put(username, value);
}
The keys are usernames and the value is the --. Any
username specified here will override the value of defaultAutoCommit. |
public void setPerUserDefaultReadOnly(String username,
Boolean value) {
assertInitializationAllowed();
if (perUserDefaultReadOnly == null) {
perUserDefaultReadOnly = new HashMap();
}
perUserDefaultReadOnly.put(username, value);
}
The keys are usernames and the value is the --. Any
username specified here will override the value of defaultReadOnly. |
public void setPerUserDefaultTransactionIsolation(String username,
Integer value) {
assertInitializationAllowed();
if (perUserDefaultTransactionIsolation == null) {
perUserDefaultTransactionIsolation = new HashMap();
}
perUserDefaultTransactionIsolation.put(username, value);
}
The isolation level of connections when returned from getConnection.
Valid values are the constants defined in Connection. |
public void setPerUserMaxActive(String username,
Integer value) {
assertInitializationAllowed();
if (perUserMaxActive == null) {
perUserMaxActive = new HashMap();
}
perUserMaxActive.put(username, value);
}
The maximum number of active connections that can be allocated from
this pool at the same time, or non-positive for no limit.
The keys are usernames and the value is the maximum connections. Any
username specified here will override the value of defaultMaxActive. |
public void setPerUserMaxIdle(String username,
Integer value) {
assertInitializationAllowed();
if (perUserMaxIdle == null) {
perUserMaxIdle = new HashMap();
}
perUserMaxIdle.put(username, value);
}
The maximum number of active connections that can remain idle in the
pool, without extra ones being released, or negative for no limit.
The keys are usernames and the value is the maximum connections. Any
username specified here will override the value of defaultMaxIdle. |
public void setPerUserMaxWait(String username,
Integer value) {
assertInitializationAllowed();
if (perUserMaxWait == null) {
perUserMaxWait = new HashMap();
}
perUserMaxWait.put(username, value);
}
The maximum number of milliseconds that the pool will wait (when there
are no available connections) for a connection to be returned before
throwing an exception, or -1 to wait indefinitely. Will fail
immediately if value is 0.
The keys are usernames and the value is the maximum connections. Any
username specified here will override the value of defaultMaxWait. |
protected void setupDefaults(Connection con,
String username) throws SQLException {
boolean defaultAutoCommit = isDefaultAutoCommit();
if (username != null) {
Boolean userMax = getPerUserDefaultAutoCommit(username);
if (userMax != null) {
defaultAutoCommit = userMax.booleanValue();
}
}
boolean defaultReadOnly = isDefaultReadOnly();
if (username != null) {
Boolean userMax = getPerUserDefaultReadOnly(username);
if (userMax != null) {
defaultReadOnly = userMax.booleanValue();
}
}
int defaultTransactionIsolation = getDefaultTransactionIsolation();
if (username != null) {
Integer userMax = getPerUserDefaultTransactionIsolation(username);
if (userMax != null) {
defaultTransactionIsolation = userMax.intValue();
}
}
con.setAutoCommit(defaultAutoCommit);
if (defaultTransactionIsolation != UNKNOWN_TRANSACTIONISOLATION) {
con.setTransactionIsolation(defaultTransactionIsolation);
}
con.setReadOnly(defaultReadOnly);
}
|