Modified: tomcat/tc8.0.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/datasources/PerUserPoolDataSource.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/datasources/PerUserPoolDataSource.java?rev=1743727&r1=1743726&r2=1743727&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/datasources/PerUserPoolDataSource.java (original) +++ tomcat/tc8.0.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/datasources/PerUserPoolDataSource.java Fri May 13 19:03:42 2016 @@ -102,10 +102,10 @@ public class PerUserPoolDataSource exten */ @Override public void close() { - for (PooledConnectionManager manager : managers.values()) { + for (final PooledConnectionManager manager : managers.values()) { try { ((CPDSConnectionFactory) manager).getPool().close(); - } catch (Exception closePoolException) { + } catch (final Exception closePoolException) { //ignore and try to close others. } } @@ -120,7 +120,7 @@ public class PerUserPoolDataSource exten * {@link GenericObjectPool#getBlockWhenExhausted()} for the * specified user's pool or the default if no user specific value is defined. */ - public boolean getPerUserBlockWhenExhausted(String key) { + public boolean getPerUserBlockWhenExhausted(final String key) { Boolean value = null; if (perUserBlockWhenExhausted != null) { value = perUserBlockWhenExhausted.get(key); @@ -136,8 +136,8 @@ public class PerUserPoolDataSource exten * {@link GenericObjectPool#getBlockWhenExhausted()} for the specified * user's pool. */ - public void setPerUserBlockWhenExhausted(String username, - Boolean value) { + public void setPerUserBlockWhenExhausted(final String username, + final Boolean value) { assertInitializationAllowed(); if (perUserBlockWhenExhausted == null) { perUserBlockWhenExhausted = new HashMap<>(); @@ -146,7 +146,7 @@ public class PerUserPoolDataSource exten } void setPerUserBlockWhenExhausted( - Map<String,Boolean> userDefaultBlockWhenExhausted) { + final Map<String,Boolean> userDefaultBlockWhenExhausted) { assertInitializationAllowed(); if (perUserBlockWhenExhausted == null) { perUserBlockWhenExhausted = new HashMap<>(); @@ -162,7 +162,7 @@ public class PerUserPoolDataSource exten * {@link GenericObjectPool#getEvictionPolicyClassName()} for the * specified user's pool or the default if no user specific value is defined. */ - public String getPerUserEvictionPolicyClassName(String key) { + public String getPerUserEvictionPolicyClassName(final String key) { String value = null; if (perUserEvictionPolicyClassName != null) { value = perUserEvictionPolicyClassName.get(key); @@ -178,8 +178,8 @@ public class PerUserPoolDataSource exten * {@link GenericObjectPool#getEvictionPolicyClassName()} for the specified * user's pool. */ - public void setPerUserEvictionPolicyClassName(String username, - String value) { + public void setPerUserEvictionPolicyClassName(final String username, + final String value) { assertInitializationAllowed(); if (perUserEvictionPolicyClassName == null) { perUserEvictionPolicyClassName = new HashMap<>(); @@ -188,7 +188,7 @@ public class PerUserPoolDataSource exten } void setPerUserEvictionPolicyClassName( - Map<String,String> userDefaultEvictionPolicyClassName) { + final Map<String,String> userDefaultEvictionPolicyClassName) { assertInitializationAllowed(); if (perUserEvictionPolicyClassName == null) { perUserEvictionPolicyClassName = new HashMap<>(); @@ -204,7 +204,7 @@ public class PerUserPoolDataSource exten * the specified user's pool or the default if no user specific value is * defined. */ - public boolean getPerUserLifo(String key) { + public boolean getPerUserLifo(final String key) { Boolean value = null; if (perUserLifo != null) { value = perUserLifo.get(key); @@ -220,7 +220,7 @@ public class PerUserPoolDataSource exten * {@link GenericObjectPool#getLifo()} for the specified * user's pool. */ - public void setPerUserLifo(String username, Boolean value) { + public void setPerUserLifo(final String username, final Boolean value) { assertInitializationAllowed(); if (perUserLifo == null) { perUserLifo = new HashMap<>(); @@ -228,7 +228,7 @@ public class PerUserPoolDataSource exten perUserLifo.put(username, value); } - void setPerUserLifo(Map<String,Boolean> userDefaultLifo) { + void setPerUserLifo(final Map<String,Boolean> userDefaultLifo) { assertInitializationAllowed(); if (perUserLifo == null) { perUserLifo = new HashMap<>(); @@ -244,7 +244,7 @@ public class PerUserPoolDataSource exten * {@link GenericObjectPool#getMaxIdle()} for the * specified user's pool or the default if no user specific value is defined. */ - public int getPerUserMaxIdle(String key) { + public int getPerUserMaxIdle(final String key) { Integer value = null; if (perUserMaxIdle != null) { value = perUserMaxIdle.get(key); @@ -260,7 +260,7 @@ public class PerUserPoolDataSource exten * {@link GenericObjectPool#getMaxIdle()} for the specified * user's pool. */ - public void setPerUserMaxIdle(String username, Integer value) { + public void setPerUserMaxIdle(final String username, final Integer value) { assertInitializationAllowed(); if (perUserMaxIdle == null) { perUserMaxIdle = new HashMap<>(); @@ -268,7 +268,7 @@ public class PerUserPoolDataSource exten perUserMaxIdle.put(username, value); } - void setPerUserMaxIdle(Map<String,Integer> userDefaultMaxIdle) { + void setPerUserMaxIdle(final Map<String,Integer> userDefaultMaxIdle) { assertInitializationAllowed(); if (perUserMaxIdle == null) { perUserMaxIdle = new HashMap<>(); @@ -284,7 +284,7 @@ public class PerUserPoolDataSource exten * {@link GenericObjectPool#getMaxTotal()} for the * specified user's pool or the default if no user specific value is defined. */ - public int getPerUserMaxTotal(String key) { + public int getPerUserMaxTotal(final String key) { Integer value = null; if (perUserMaxTotal != null) { value = perUserMaxTotal.get(key); @@ -300,7 +300,7 @@ public class PerUserPoolDataSource exten * {@link GenericObjectPool#getMaxTotal()} for the specified * user's pool. */ - public void setPerUserMaxTotal(String username, Integer value) { + public void setPerUserMaxTotal(final String username, final Integer value) { assertInitializationAllowed(); if (perUserMaxTotal == null) { perUserMaxTotal = new HashMap<>(); @@ -308,7 +308,7 @@ public class PerUserPoolDataSource exten perUserMaxTotal.put(username, value); } - void setPerUserMaxTotal(Map<String,Integer> userDefaultMaxTotal) { + void setPerUserMaxTotal(final Map<String,Integer> userDefaultMaxTotal) { assertInitializationAllowed(); if (perUserMaxTotal == null) { perUserMaxTotal = new HashMap<>(); @@ -324,7 +324,7 @@ public class PerUserPoolDataSource exten * {@link GenericObjectPool#getMaxWaitMillis()} for the * specified user's pool or the default if no user specific value is defined. */ - public long getPerUserMaxWaitMillis(String key) { + public long getPerUserMaxWaitMillis(final String key) { Long value = null; if (perUserMaxWaitMillis != null) { value = perUserMaxWaitMillis.get(key); @@ -340,7 +340,7 @@ public class PerUserPoolDataSource exten * {@link GenericObjectPool#getMaxWaitMillis()} for the specified * user's pool. */ - public void setPerUserMaxWaitMillis(String username, Long value) { + public void setPerUserMaxWaitMillis(final String username, final Long value) { assertInitializationAllowed(); if (perUserMaxWaitMillis == null) { perUserMaxWaitMillis = new HashMap<>(); @@ -349,7 +349,7 @@ public class PerUserPoolDataSource exten } void setPerUserMaxWaitMillis( - Map<String,Long> userDefaultMaxWaitMillis) { + final Map<String,Long> userDefaultMaxWaitMillis) { assertInitializationAllowed(); if (perUserMaxWaitMillis == null) { perUserMaxWaitMillis = new HashMap<>(); @@ -365,7 +365,7 @@ public class PerUserPoolDataSource exten * {@link GenericObjectPool#getMinEvictableIdleTimeMillis()} for the * specified user's pool or the default if no user specific value is defined. */ - public long getPerUserMinEvictableIdleTimeMillis(String key) { + public long getPerUserMinEvictableIdleTimeMillis(final String key) { Long value = null; if (perUserMinEvictableIdleTimeMillis != null) { value = perUserMinEvictableIdleTimeMillis.get(key); @@ -381,8 +381,8 @@ public class PerUserPoolDataSource exten * {@link GenericObjectPool#getMinEvictableIdleTimeMillis()} for the * specified user's pool. */ - public void setPerUserMinEvictableIdleTimeMillis(String username, - Long value) { + public void setPerUserMinEvictableIdleTimeMillis(final String username, + final Long value) { assertInitializationAllowed(); if (perUserMinEvictableIdleTimeMillis == null) { perUserMinEvictableIdleTimeMillis = new HashMap<>(); @@ -391,7 +391,7 @@ public class PerUserPoolDataSource exten } void setPerUserMinEvictableIdleTimeMillis( - Map<String,Long> userDefaultMinEvictableIdleTimeMillis) { + final Map<String,Long> userDefaultMinEvictableIdleTimeMillis) { assertInitializationAllowed(); if (perUserMinEvictableIdleTimeMillis == null) { perUserMinEvictableIdleTimeMillis = new HashMap<>(); @@ -408,7 +408,7 @@ public class PerUserPoolDataSource exten * {@link GenericObjectPool#getMinIdle()} for the * specified user's pool or the default if no user specific value is defined. */ - public int getPerUserMinIdle(String key) { + public int getPerUserMinIdle(final String key) { Integer value = null; if (perUserMinIdle != null) { value = perUserMinIdle.get(key); @@ -424,7 +424,7 @@ public class PerUserPoolDataSource exten * {@link GenericObjectPool#getMinIdle()} for the specified * user's pool. */ - public void setPerUserMinIdle(String username, Integer value) { + public void setPerUserMinIdle(final String username, final Integer value) { assertInitializationAllowed(); if (perUserMinIdle == null) { perUserMinIdle = new HashMap<>(); @@ -432,7 +432,7 @@ public class PerUserPoolDataSource exten perUserMinIdle.put(username, value); } - void setPerUserMinIdle(Map<String,Integer> userDefaultMinIdle) { + void setPerUserMinIdle(final Map<String,Integer> userDefaultMinIdle) { assertInitializationAllowed(); if (perUserMinIdle == null) { perUserMinIdle = new HashMap<>(); @@ -448,7 +448,7 @@ public class PerUserPoolDataSource exten * {@link GenericObjectPool#getNumTestsPerEvictionRun()} for the * specified user's pool or the default if no user specific value is defined. */ - public int getPerUserNumTestsPerEvictionRun(String key) { + public int getPerUserNumTestsPerEvictionRun(final String key) { Integer value = null; if (perUserNumTestsPerEvictionRun != null) { value = perUserNumTestsPerEvictionRun.get(key); @@ -464,8 +464,8 @@ public class PerUserPoolDataSource exten * {@link GenericObjectPool#getNumTestsPerEvictionRun()} for the specified * user's pool. */ - public void setPerUserNumTestsPerEvictionRun(String username, - Integer value) { + public void setPerUserNumTestsPerEvictionRun(final String username, + final Integer value) { assertInitializationAllowed(); if (perUserNumTestsPerEvictionRun == null) { perUserNumTestsPerEvictionRun = new HashMap<>(); @@ -474,7 +474,7 @@ public class PerUserPoolDataSource exten } void setPerUserNumTestsPerEvictionRun( - Map<String,Integer> userDefaultNumTestsPerEvictionRun) { + final Map<String,Integer> userDefaultNumTestsPerEvictionRun) { assertInitializationAllowed(); if (perUserNumTestsPerEvictionRun == null) { perUserNumTestsPerEvictionRun = new HashMap<>(); @@ -490,7 +490,7 @@ public class PerUserPoolDataSource exten * {@link GenericObjectPool#getSoftMinEvictableIdleTimeMillis()} for the * specified user's pool or the default if no user specific value is defined. */ - public long getPerUserSoftMinEvictableIdleTimeMillis(String key) { + public long getPerUserSoftMinEvictableIdleTimeMillis(final String key) { Long value = null; if (perUserSoftMinEvictableIdleTimeMillis != null) { value = perUserSoftMinEvictableIdleTimeMillis.get(key); @@ -506,8 +506,8 @@ public class PerUserPoolDataSource exten * {@link GenericObjectPool#getSoftMinEvictableIdleTimeMillis()} for the * specified user's pool. */ - public void setPerUserSoftMinEvictableIdleTimeMillis(String username, - Long value) { + public void setPerUserSoftMinEvictableIdleTimeMillis(final String username, + final Long value) { assertInitializationAllowed(); if (perUserSoftMinEvictableIdleTimeMillis == null) { perUserSoftMinEvictableIdleTimeMillis = new HashMap<>(); @@ -516,7 +516,7 @@ public class PerUserPoolDataSource exten } void setPerUserSoftMinEvictableIdleTimeMillis( - Map<String,Long> userDefaultSoftMinEvictableIdleTimeMillis) { + final Map<String,Long> userDefaultSoftMinEvictableIdleTimeMillis) { assertInitializationAllowed(); if (perUserSoftMinEvictableIdleTimeMillis == null) { perUserSoftMinEvictableIdleTimeMillis = new HashMap<>(); @@ -532,7 +532,7 @@ public class PerUserPoolDataSource exten * {@link GenericObjectPool#getTestOnCreate()} for the * specified user's pool or the default if no user specific value is defined. */ - public boolean getPerUserTestOnCreate(String key) { + public boolean getPerUserTestOnCreate(final String key) { Boolean value = null; if (perUserTestOnCreate != null) { value = perUserTestOnCreate.get(key); @@ -548,7 +548,7 @@ public class PerUserPoolDataSource exten * {@link GenericObjectPool#getTestOnCreate()} for the specified * user's pool. */ - public void setPerUserTestOnCreate(String username, Boolean value) { + public void setPerUserTestOnCreate(final String username, final Boolean value) { assertInitializationAllowed(); if (perUserTestOnCreate == null) { perUserTestOnCreate = new HashMap<>(); @@ -556,7 +556,7 @@ public class PerUserPoolDataSource exten perUserTestOnCreate.put(username, value); } - void setPerUserTestOnCreate(Map<String,Boolean> userDefaultTestOnCreate) { + void setPerUserTestOnCreate(final Map<String,Boolean> userDefaultTestOnCreate) { assertInitializationAllowed(); if (perUserTestOnCreate == null) { perUserTestOnCreate = new HashMap<>(); @@ -572,7 +572,7 @@ public class PerUserPoolDataSource exten * {@link GenericObjectPool#getTestOnBorrow()} for the * specified user's pool or the default if no user specific value is defined. */ - public boolean getPerUserTestOnBorrow(String key) { + public boolean getPerUserTestOnBorrow(final String key) { Boolean value = null; if (perUserTestOnBorrow != null) { value = perUserTestOnBorrow.get(key); @@ -588,7 +588,7 @@ public class PerUserPoolDataSource exten * {@link GenericObjectPool#getTestOnBorrow()} for the specified * user's pool. */ - public void setPerUserTestOnBorrow(String username, Boolean value) { + public void setPerUserTestOnBorrow(final String username, final Boolean value) { assertInitializationAllowed(); if (perUserTestOnBorrow == null) { perUserTestOnBorrow = new HashMap<>(); @@ -596,7 +596,7 @@ public class PerUserPoolDataSource exten perUserTestOnBorrow.put(username, value); } - void setPerUserTestOnBorrow(Map<String,Boolean> userDefaultTestOnBorrow) { + void setPerUserTestOnBorrow(final Map<String,Boolean> userDefaultTestOnBorrow) { assertInitializationAllowed(); if (perUserTestOnBorrow == null) { perUserTestOnBorrow = new HashMap<>(); @@ -612,7 +612,7 @@ public class PerUserPoolDataSource exten * {@link GenericObjectPool#getTestOnReturn()} for the * specified user's pool or the default if no user specific value is defined. */ - public boolean getPerUserTestOnReturn(String key) { + public boolean getPerUserTestOnReturn(final String key) { Boolean value = null; if (perUserTestOnReturn != null) { value = perUserTestOnReturn.get(key); @@ -628,7 +628,7 @@ public class PerUserPoolDataSource exten * {@link GenericObjectPool#getTestOnReturn()} for the specified * user's pool. */ - public void setPerUserTestOnReturn(String username, Boolean value) { + public void setPerUserTestOnReturn(final String username, final Boolean value) { assertInitializationAllowed(); if (perUserTestOnReturn == null) { perUserTestOnReturn = new HashMap<>(); @@ -637,7 +637,7 @@ public class PerUserPoolDataSource exten } void setPerUserTestOnReturn( - Map<String,Boolean> userDefaultTestOnReturn) { + final Map<String,Boolean> userDefaultTestOnReturn) { assertInitializationAllowed(); if (perUserTestOnReturn == null) { perUserTestOnReturn = new HashMap<>(); @@ -653,7 +653,7 @@ public class PerUserPoolDataSource exten * {@link GenericObjectPool#getTestWhileIdle()} for the * specified user's pool or the default if no user specific value is defined. */ - public boolean getPerUserTestWhileIdle(String key) { + public boolean getPerUserTestWhileIdle(final String key) { Boolean value = null; if (perUserTestWhileIdle != null) { value = perUserTestWhileIdle.get(key); @@ -669,7 +669,7 @@ public class PerUserPoolDataSource exten * {@link GenericObjectPool#getTestWhileIdle()} for the specified * user's pool. */ - public void setPerUserTestWhileIdle(String username, Boolean value) { + public void setPerUserTestWhileIdle(final String username, final Boolean value) { assertInitializationAllowed(); if (perUserTestWhileIdle == null) { perUserTestWhileIdle = new HashMap<>(); @@ -678,7 +678,7 @@ public class PerUserPoolDataSource exten } void setPerUserTestWhileIdle( - Map<String,Boolean> userDefaultTestWhileIdle) { + final Map<String,Boolean> userDefaultTestWhileIdle) { assertInitializationAllowed(); if (perUserTestWhileIdle == null) { perUserTestWhileIdle = new HashMap<>(); @@ -694,7 +694,7 @@ public class PerUserPoolDataSource exten * {@link GenericObjectPool#getTimeBetweenEvictionRunsMillis()} for the * specified user's pool or the default if no user specific value is defined. */ - public long getPerUserTimeBetweenEvictionRunsMillis(String key) { + public long getPerUserTimeBetweenEvictionRunsMillis(final String key) { Long value = null; if (perUserTimeBetweenEvictionRunsMillis != null) { value = perUserTimeBetweenEvictionRunsMillis.get(key); @@ -710,8 +710,8 @@ public class PerUserPoolDataSource exten * {@link GenericObjectPool#getTimeBetweenEvictionRunsMillis ()} for the specified * user's pool. */ - public void setPerUserTimeBetweenEvictionRunsMillis(String username, - Long value) { + public void setPerUserTimeBetweenEvictionRunsMillis(final String username, + final Long value) { assertInitializationAllowed(); if (perUserTimeBetweenEvictionRunsMillis == null) { perUserTimeBetweenEvictionRunsMillis = new HashMap<>(); @@ -720,7 +720,7 @@ public class PerUserPoolDataSource exten } void setPerUserTimeBetweenEvictionRunsMillis( - Map<String,Long> userDefaultTimeBetweenEvictionRunsMillis ) { + final Map<String,Long> userDefaultTimeBetweenEvictionRunsMillis ) { assertInitializationAllowed(); if (perUserTimeBetweenEvictionRunsMillis == null) { perUserTimeBetweenEvictionRunsMillis = new HashMap<>(); @@ -736,7 +736,7 @@ public class PerUserPoolDataSource exten * Gets the user specific default value for * {@link Connection#setAutoCommit(boolean)} for the specified user's pool. */ - public Boolean getPerUserDefaultAutoCommit(String key) { + public Boolean getPerUserDefaultAutoCommit(final String key) { Boolean value = null; if (perUserDefaultAutoCommit != null) { value = perUserDefaultAutoCommit.get(key); @@ -748,7 +748,7 @@ public class PerUserPoolDataSource exten * Sets a user specific default value for * {@link Connection#setAutoCommit(boolean)} for the specified user's pool. */ - public void setPerUserDefaultAutoCommit(String username, Boolean value) { + public void setPerUserDefaultAutoCommit(final String username, final Boolean value) { assertInitializationAllowed(); if (perUserDefaultAutoCommit == null) { perUserDefaultAutoCommit = new HashMap<>(); @@ -756,7 +756,7 @@ public class PerUserPoolDataSource exten perUserDefaultAutoCommit.put(username, value); } - void setPerUserDefaultAutoCommit(Map<String,Boolean> userDefaultAutoCommit) { + void setPerUserDefaultAutoCommit(final Map<String,Boolean> userDefaultAutoCommit) { assertInitializationAllowed(); if (perUserDefaultAutoCommit == null) { perUserDefaultAutoCommit = new HashMap<>(); @@ -771,7 +771,7 @@ public class PerUserPoolDataSource exten * Gets the user specific default value for * {@link Connection#setReadOnly(boolean)} for the specified user's pool. */ - public Boolean getPerUserDefaultReadOnly(String key) { + public Boolean getPerUserDefaultReadOnly(final String key) { Boolean value = null; if (perUserDefaultReadOnly != null) { value = perUserDefaultReadOnly.get(key); @@ -783,7 +783,7 @@ public class PerUserPoolDataSource exten * Sets a user specific default value for * {@link Connection#setReadOnly(boolean)} for the specified user's pool. */ - public void setPerUserDefaultReadOnly(String username, Boolean value) { + public void setPerUserDefaultReadOnly(final String username, final Boolean value) { assertInitializationAllowed(); if (perUserDefaultReadOnly == null) { perUserDefaultReadOnly = new HashMap<>(); @@ -791,7 +791,7 @@ public class PerUserPoolDataSource exten perUserDefaultReadOnly.put(username, value); } - void setPerUserDefaultReadOnly(Map<String,Boolean> userDefaultReadOnly) { + void setPerUserDefaultReadOnly(final Map<String,Boolean> userDefaultReadOnly) { assertInitializationAllowed(); if (perUserDefaultReadOnly == null) { perUserDefaultReadOnly = new HashMap<>(); @@ -806,7 +806,7 @@ public class PerUserPoolDataSource exten * Gets the user specific default value for * {@link Connection#setTransactionIsolation(int)} for the specified user's pool. */ - public Integer getPerUserDefaultTransactionIsolation(String key) { + public Integer getPerUserDefaultTransactionIsolation(final String key) { Integer value = null; if (perUserDefaultTransactionIsolation != null) { value = perUserDefaultTransactionIsolation.get(key); @@ -818,8 +818,8 @@ public class PerUserPoolDataSource exten * Sets a user specific default value for * {@link Connection#setTransactionIsolation(int)} for the specified user's pool. */ - public void setPerUserDefaultTransactionIsolation(String username, - Integer value) { + public void setPerUserDefaultTransactionIsolation(final String username, + final Integer value) { assertInitializationAllowed(); if (perUserDefaultTransactionIsolation == null) { perUserDefaultTransactionIsolation = new HashMap<>(); @@ -828,7 +828,7 @@ public class PerUserPoolDataSource exten } void setPerUserDefaultTransactionIsolation( - Map<String,Integer> userDefaultTransactionIsolation) { + final Map<String,Integer> userDefaultTransactionIsolation) { assertInitializationAllowed(); if (perUserDefaultTransactionIsolation == null) { perUserDefaultTransactionIsolation = new HashMap<>(); @@ -852,8 +852,8 @@ public class PerUserPoolDataSource exten /** * Get the number of active connections in the pool for a given user. */ - public int getNumActive(String username) { - ObjectPool<PooledConnectionAndInfo> pool = + public int getNumActive(final String username) { + final ObjectPool<PooledConnectionAndInfo> pool = getPool(getPoolKey(username)); return pool == null ? 0 : pool.getNumActive(); } @@ -868,8 +868,8 @@ public class PerUserPoolDataSource exten /** * Get the number of idle connections in the pool for a given user. */ - public int getNumIdle(String username) { - ObjectPool<PooledConnectionAndInfo> pool = + public int getNumIdle(final String username) { + final ObjectPool<PooledConnectionAndInfo> pool = getPool(getPoolKey(username)); return pool == null ? 0 : pool.getNumIdle(); } @@ -880,7 +880,7 @@ public class PerUserPoolDataSource exten @Override protected PooledConnectionAndInfo - getPooledConnectionAndInfo(String username, String password) + getPooledConnectionAndInfo(final String username, final String password) throws SQLException { final PoolKey key = getPoolKey(username); @@ -892,7 +892,7 @@ public class PerUserPoolDataSource exten try { registerPool(username, password); manager = managers.get(key); - } catch (NamingException e) { + } catch (final NamingException e) { throw new SQLException("RegisterPool failed", e); } } @@ -903,15 +903,15 @@ public class PerUserPoolDataSource exten try { info = pool.borrowObject(); } - catch (NoSuchElementException ex) { + catch (final NoSuchElementException ex) { throw new SQLException( "Could not retrieve connection info from pool", ex); } - catch (Exception e) { + catch (final Exception e) { // See if failure is due to CPDSConnectionFactory authentication failure try { testCPDS(username, password); - } catch (Exception ex) { + } catch (final Exception ex) { throw new SQLException( "Could not retrieve connection info from pool", ex); } @@ -923,12 +923,12 @@ public class PerUserPoolDataSource exten try { registerPool(username, password); pool = getPool(key); - } catch (NamingException ne) { + } catch (final NamingException ne) { throw new SQLException("RegisterPool failed", ne); } try { info = pool.borrowObject(); - } catch (Exception ex) { + } catch (final Exception ex) { throw new SQLException( "Could not retrieve connection info from pool", ex); } @@ -937,11 +937,11 @@ public class PerUserPoolDataSource exten } @Override - protected void setupDefaults(Connection con, String username) + protected void setupDefaults(final Connection con, final String username) throws SQLException { Boolean defaultAutoCommit = isDefaultAutoCommit(); if (username != null) { - Boolean userMax = getPerUserDefaultAutoCommit(username); + final Boolean userMax = getPerUserDefaultAutoCommit(username); if (userMax != null) { defaultAutoCommit = userMax; } @@ -949,7 +949,7 @@ public class PerUserPoolDataSource exten Boolean defaultReadOnly = isDefaultReadOnly(); if (username != null) { - Boolean userMax = getPerUserDefaultReadOnly(username); + final Boolean userMax = getPerUserDefaultReadOnly(username); if (userMax != null) { defaultReadOnly = userMax; } @@ -957,7 +957,7 @@ public class PerUserPoolDataSource exten int defaultTransactionIsolation = getDefaultTransactionIsolation(); if (username != null) { - Integer userMax = getPerUserDefaultTransactionIsolation(username); + final Integer userMax = getPerUserDefaultTransactionIsolation(username); if (userMax != null) { defaultTransactionIsolation = userMax.intValue(); } @@ -979,7 +979,7 @@ public class PerUserPoolDataSource exten } @Override - protected PooledConnectionManager getConnectionManager(UserPassKey upkey) { + protected PooledConnectionManager getConnectionManager(final UserPassKey upkey) { return managers.get(getPoolKey(upkey.getUsername())); } @@ -988,7 +988,7 @@ public class PerUserPoolDataSource exten */ @Override public Reference getReference() throws NamingException { - Reference ref = new Reference(getClass().getName(), + final Reference ref = new Reference(getClass().getName(), PerUserPoolDataSourceFactory.class.getName(), null); ref.add(new StringRefAddr("instanceKey", getInstanceKey())); return ref; @@ -1000,25 +1000,25 @@ public class PerUserPoolDataSource exten * @param username User name * @return The pool key */ - private PoolKey getPoolKey(String username) { + private PoolKey getPoolKey(final String username) { return new PoolKey(getDataSourceName(), username); } - private synchronized void registerPool(String username, String password) + private synchronized void registerPool(final String username, final String password) throws NamingException, SQLException { - ConnectionPoolDataSource cpds = testCPDS(username, password); + final ConnectionPoolDataSource cpds = testCPDS(username, password); // Set up the factory we will use (passing the pool associates // the factory with the pool, so we do not have to do so // explicitly) - CPDSConnectionFactory factory = new CPDSConnectionFactory(cpds, + final CPDSConnectionFactory factory = new CPDSConnectionFactory(cpds, getValidationQuery(), getValidationQueryTimeout(), isRollbackAfterValidation(), username, password); factory.setMaxConnLifetimeMillis(getMaxConnLifetimeMillis()); // Create an object pool to contain our PooledConnections - GenericObjectPool<PooledConnectionAndInfo> pool = + final GenericObjectPool<PooledConnectionAndInfo> pool = new GenericObjectPool<>(factory); factory.setPool(pool); pool.setBlockWhenExhausted(getPerUserBlockWhenExhausted(username)); @@ -1044,7 +1044,7 @@ public class PerUserPoolDataSource exten pool.setSwallowedExceptionListener(new SwallowedExceptionLogger(log)); - Object old = managers.put(getPoolKey(username), factory); + final Object old = managers.put(getPoolKey(username), factory); if (old != null) { throw new IllegalStateException("Pool already contains an entry for this user/password: " + username); } @@ -1057,17 +1057,17 @@ public class PerUserPoolDataSource exten * @exception IOException if an error occurs * @exception ClassNotFoundException if an error occurs */ - private void readObject(ObjectInputStream in) + private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException { try { in.defaultReadObject(); - PerUserPoolDataSource oldDS = (PerUserPoolDataSource) + final PerUserPoolDataSource oldDS = (PerUserPoolDataSource) new PerUserPoolDataSourceFactory() .getObjectInstance(getReference(), null, null, null); this.managers = oldDS.managers; } - catch (NamingException e) + catch (final NamingException e) { throw new IOException("NamingException: " + e); } @@ -1080,8 +1080,8 @@ public class PerUserPoolDataSource exten * @return the GenericObjectPool pooling connections for the username and datasource * specified by the PoolKey */ - private ObjectPool<PooledConnectionAndInfo> getPool(PoolKey key) { - CPDSConnectionFactory mgr = (CPDSConnectionFactory) managers.get(key); + private ObjectPool<PooledConnectionAndInfo> getPool(final PoolKey key) { + final CPDSConnectionFactory mgr = (CPDSConnectionFactory) managers.get(key); return mgr == null ? null : mgr.getPool(); } }
Modified: tomcat/tc8.0.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/datasources/PerUserPoolDataSourceFactory.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/datasources/PerUserPoolDataSourceFactory.java?rev=1743727&r1=1743726&r2=1743727&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/datasources/PerUserPoolDataSourceFactory.java (original) +++ tomcat/tc8.0.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/datasources/PerUserPoolDataSourceFactory.java Fri May 13 19:03:42 2016 @@ -35,15 +35,15 @@ public class PerUserPoolDataSourceFactor PerUserPoolDataSource.class.getName(); @Override - protected boolean isCorrectClass(String className) { + protected boolean isCorrectClass(final String className) { return PER_USER_POOL_CLASSNAME.equals(className); } @SuppressWarnings("unchecked") // Avoid warnings on deserialization @Override - protected InstanceKeyDataSource getNewInstance(Reference ref) + protected InstanceKeyDataSource getNewInstance(final Reference ref) throws IOException, ClassNotFoundException { - PerUserPoolDataSource pupds = new PerUserPoolDataSource(); + final PerUserPoolDataSource pupds = new PerUserPoolDataSource(); RefAddr ra = ref.get("defaultMaxTotal"); if (ra != null && ra.getContent() != null) { pupds.setDefaultMaxTotal( @@ -64,42 +64,42 @@ public class PerUserPoolDataSourceFactor ra = ref.get("perUserDefaultAutoCommit"); if (ra != null && ra.getContent() != null) { - byte[] serialized = (byte[]) ra.getContent(); + final byte[] serialized = (byte[]) ra.getContent(); pupds.setPerUserDefaultAutoCommit( (Map<String,Boolean>) deserialize(serialized)); } ra = ref.get("perUserDefaultTransactionIsolation"); if (ra != null && ra.getContent() != null) { - byte[] serialized = (byte[]) ra.getContent(); + final byte[] serialized = (byte[]) ra.getContent(); pupds.setPerUserDefaultTransactionIsolation( (Map<String,Integer>) deserialize(serialized)); } ra = ref.get("perUserMaxTotal"); if (ra != null && ra.getContent() != null) { - byte[] serialized = (byte[]) ra.getContent(); + final byte[] serialized = (byte[]) ra.getContent(); pupds.setPerUserMaxTotal( (Map<String,Integer>) deserialize(serialized)); } ra = ref.get("perUserMaxIdle"); if (ra != null && ra.getContent() != null) { - byte[] serialized = (byte[]) ra.getContent(); + final byte[] serialized = (byte[]) ra.getContent(); pupds.setPerUserMaxIdle( (Map<String,Integer>) deserialize(serialized)); } ra = ref.get("perUserMaxWaitMillis"); if (ra != null && ra.getContent() != null) { - byte[] serialized = (byte[]) ra.getContent(); + final byte[] serialized = (byte[]) ra.getContent(); pupds.setPerUserMaxWaitMillis( (Map<String,Long>) deserialize(serialized)); } ra = ref.get("perUserDefaultReadOnly"); if (ra != null && ra.getContent() != null) { - byte[] serialized = (byte[]) ra.getContent(); + final byte[] serialized = (byte[]) ra.getContent(); pupds.setPerUserDefaultReadOnly( (Map<String,Boolean>) deserialize(serialized)); } Modified: tomcat/tc8.0.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/datasources/PoolKey.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/datasources/PoolKey.java?rev=1743727&r1=1743726&r2=1743727&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/datasources/PoolKey.java (original) +++ tomcat/tc8.0.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/datasources/PoolKey.java Fri May 13 19:03:42 2016 @@ -28,15 +28,15 @@ class PoolKey implements Serializable { private final String datasourceName; private final String username; - PoolKey(String datasourceName, String username) { + PoolKey(final String datasourceName, final String username) { this.datasourceName = datasourceName; this.username = username; } @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if (obj instanceof PoolKey) { - PoolKey pk = (PoolKey)obj; + final PoolKey pk = (PoolKey)obj; return (null == datasourceName ? null == pk.datasourceName : datasourceName.equals(pk.datasourceName)) && (null == username ? null == pk.username : username.equals(pk.username)); } @@ -57,7 +57,7 @@ class PoolKey implements Serializable { @Override public String toString() { - StringBuffer sb = new StringBuffer(50); + final StringBuffer sb = new StringBuffer(50); sb.append("PoolKey("); sb.append(username).append(", ").append(datasourceName); sb.append(')'); Modified: tomcat/tc8.0.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/datasources/PooledConnectionAndInfo.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/datasources/PooledConnectionAndInfo.java?rev=1743727&r1=1743726&r2=1743727&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/datasources/PooledConnectionAndInfo.java (original) +++ tomcat/tc8.0.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/datasources/PooledConnectionAndInfo.java Fri May 13 19:03:42 2016 @@ -31,7 +31,7 @@ final class PooledConnectionAndInfo { private final String username; private final UserPassKey upkey; - PooledConnectionAndInfo(PooledConnection pc, String username, String password) { + PooledConnectionAndInfo(final PooledConnection pc, final String username, final String password) { this.pooledConnection = pc; this.username = username; this.password = password; Modified: tomcat/tc8.0.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/datasources/SharedPoolDataSource.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/datasources/SharedPoolDataSource.java?rev=1743727&r1=1743726&r2=1743727&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/datasources/SharedPoolDataSource.java (original) +++ tomcat/tc8.0.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/datasources/SharedPoolDataSource.java Fri May 13 19:03:42 2016 @@ -90,7 +90,7 @@ public class SharedPoolDataSource extend /** * Get {@link GenericKeyedObjectPool#getMaxTotal()} for this pool. */ - public void setMaxTotal(int maxTotal) { + public void setMaxTotal(final int maxTotal) { assertInitializationAllowed(); this.maxTotal = maxTotal; } @@ -118,14 +118,14 @@ public class SharedPoolDataSource extend @Override protected PooledConnectionAndInfo - getPooledConnectionAndInfo(String username, String password) + getPooledConnectionAndInfo(final String username, final String password) throws SQLException { synchronized(this) { if (pool == null) { try { registerPool(username, password); - } catch (NamingException e) { + } catch (final NamingException e) { throw new SQLException("RegisterPool failed", e); } } @@ -133,12 +133,12 @@ public class SharedPoolDataSource extend PooledConnectionAndInfo info = null; - UserPassKey key = new UserPassKey(username, password); + final UserPassKey key = new UserPassKey(username, password); try { info = pool.borrowObject(key); } - catch (Exception e) { + catch (final Exception e) { throw new SQLException( "Could not retrieve connection info from pool", e); } @@ -146,7 +146,7 @@ public class SharedPoolDataSource extend } @Override - protected PooledConnectionManager getConnectionManager(UserPassKey upkey) { + protected PooledConnectionManager getConnectionManager(final UserPassKey upkey) { return factory; } @@ -155,23 +155,23 @@ public class SharedPoolDataSource extend */ @Override public Reference getReference() throws NamingException { - Reference ref = new Reference(getClass().getName(), + final Reference ref = new Reference(getClass().getName(), SharedPoolDataSourceFactory.class.getName(), null); ref.add(new StringRefAddr("instanceKey", getInstanceKey())); return ref; } - private void registerPool(String username, String password) + private void registerPool(final String username, final String password) throws NamingException, SQLException { - ConnectionPoolDataSource cpds = testCPDS(username, password); + final ConnectionPoolDataSource cpds = testCPDS(username, password); // Create an object pool to contain our PooledConnections factory = new KeyedCPDSConnectionFactory(cpds, getValidationQuery(), getValidationQueryTimeout(), isRollbackAfterValidation()); factory.setMaxConnLifetimeMillis(getMaxConnLifetimeMillis()); - GenericKeyedObjectPoolConfig config = + final GenericKeyedObjectPoolConfig config = new GenericKeyedObjectPoolConfig(); config.setBlockWhenExhausted(getDefaultBlockWhenExhausted()); config.setEvictionPolicyClassName(getDefaultEvictionPolicyClassName()); @@ -193,26 +193,26 @@ public class SharedPoolDataSource extend config.setTimeBetweenEvictionRunsMillis( getDefaultTimeBetweenEvictionRunsMillis()); - KeyedObjectPool<UserPassKey,PooledConnectionAndInfo> tmpPool = + final KeyedObjectPool<UserPassKey,PooledConnectionAndInfo> tmpPool = new GenericKeyedObjectPool<>(factory, config); factory.setPool(tmpPool); pool = tmpPool; } @Override - protected void setupDefaults(Connection con, String username) throws SQLException { - Boolean defaultAutoCommit = isDefaultAutoCommit(); + protected void setupDefaults(final Connection con, final String username) throws SQLException { + final Boolean defaultAutoCommit = isDefaultAutoCommit(); if (defaultAutoCommit != null && con.getAutoCommit() != defaultAutoCommit.booleanValue()) { con.setAutoCommit(defaultAutoCommit.booleanValue()); } - int defaultTransactionIsolation = getDefaultTransactionIsolation(); + final int defaultTransactionIsolation = getDefaultTransactionIsolation(); if (defaultTransactionIsolation != UNKNOWN_TRANSACTIONISOLATION) { con.setTransactionIsolation(defaultTransactionIsolation); } - Boolean defaultReadOnly = isDefaultReadOnly(); + final Boolean defaultReadOnly = isDefaultReadOnly(); if (defaultReadOnly != null && con.isReadOnly() != defaultReadOnly.booleanValue()) { con.setReadOnly(defaultReadOnly.booleanValue()); @@ -226,17 +226,17 @@ public class SharedPoolDataSource extend * @exception IOException if an error occurs * @exception ClassNotFoundException if an error occurs */ - private void readObject(ObjectInputStream in) + private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException { try { in.defaultReadObject(); - SharedPoolDataSource oldDS = (SharedPoolDataSource) + final SharedPoolDataSource oldDS = (SharedPoolDataSource) new SharedPoolDataSourceFactory() .getObjectInstance(getReference(), null, null, null); this.pool = oldDS.pool; } - catch (NamingException e) + catch (final NamingException e) { throw new IOException("NamingException: " + e); } Modified: tomcat/tc8.0.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/datasources/SharedPoolDataSourceFactory.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/datasources/SharedPoolDataSourceFactory.java?rev=1743727&r1=1743726&r2=1743727&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/datasources/SharedPoolDataSourceFactory.java (original) +++ tomcat/tc8.0.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/datasources/SharedPoolDataSourceFactory.java Fri May 13 19:03:42 2016 @@ -31,14 +31,14 @@ public class SharedPoolDataSourceFactory SharedPoolDataSource.class.getName(); @Override - protected boolean isCorrectClass(String className) { + protected boolean isCorrectClass(final String className) { return SHARED_POOL_CLASSNAME.equals(className); } @Override - protected InstanceKeyDataSource getNewInstance(Reference ref) { - SharedPoolDataSource spds = new SharedPoolDataSource(); - RefAddr ra = ref.get("maxTotal"); + protected InstanceKeyDataSource getNewInstance(final Reference ref) { + final SharedPoolDataSource spds = new SharedPoolDataSource(); + final RefAddr ra = ref.get("maxTotal"); if (ra != null && ra.getContent() != null) { spds.setMaxTotal( Integer.parseInt(ra.getContent().toString())); Modified: tomcat/tc8.0.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/datasources/UserPassKey.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/datasources/UserPassKey.java?rev=1743727&r1=1743726&r2=1743727&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/datasources/UserPassKey.java (original) +++ tomcat/tc8.0.x/trunk/java/org/apache/tomcat/dbcp/dbcp2/datasources/UserPassKey.java Fri May 13 19:03:42 2016 @@ -35,7 +35,7 @@ class UserPassKey implements Serializabl private final String password; private final String username; - UserPassKey(String username, String password) { + UserPassKey(final String username, final String password) { this.username = username; this.password = password; } @@ -64,7 +64,7 @@ class UserPassKey implements Serializabl * @see java.lang.Object#equals(java.lang.Object) */ @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if (obj == null) { return false; } @@ -77,7 +77,7 @@ class UserPassKey implements Serializabl return false; } - UserPassKey key = (UserPassKey) obj; + final UserPassKey key = (UserPassKey) obj; return this.username == null ? key.username == null : @@ -95,7 +95,7 @@ class UserPassKey implements Serializabl @Override public String toString() { - StringBuffer sb = new StringBuffer(50); + final StringBuffer sb = new StringBuffer(50); sb.append("UserPassKey("); sb.append(username).append(", ").append(password).append(')'); return sb.toString(); Modified: tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml?rev=1743727&r1=1743726&r2=1743727&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml Fri May 13 19:03:42 2016 @@ -58,6 +58,14 @@ </fix> </changelog> </subsection> + <subsection name="Other"> + <changelog> + <update> + Update the internal fork of Commons DBCP 2 to r1743696 (2.1.1 plus + additional fixes). (markt) + </update> + </changelog> + </subsection> </section> <section name="Tomcat 8.0.35 (markt)" rtext="release in progress"> <subsection name="Catalina"> --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
