You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2016/02/08 22:58:42 UTC
svn commit: r1729277 [4/7] - in /commons/proper/dbcp/trunk/src:
main/java/org/apache/commons/dbcp2/
main/java/org/apache/commons/dbcp2/cpdsadapter/
main/java/org/apache/commons/dbcp2/datasources/
main/java/org/apache/commons/dbcp2/managed/ test/java/or...
Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolingConnection.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolingConnection.java?rev=1729277&r1=1729276&r2=1729277&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolingConnection.java (original)
+++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolingConnection.java Mon Feb 8 21:58:41 2016
@@ -55,13 +55,13 @@ public class PoolingConnection extends D
* Constructor.
* @param c the underlying {@link Connection}.
*/
- public PoolingConnection(Connection c) {
+ public PoolingConnection(final Connection c) {
super(c);
}
public void setStatementPool(
- KeyedObjectPool<PStmtKey,DelegatingPreparedStatement> pool) {
+ final KeyedObjectPool<PStmtKey,DelegatingPreparedStatement> pool) {
_pstmtPool = pool;
}
@@ -100,7 +100,7 @@ public class PoolingConnection extends D
* @return a {@link PoolablePreparedStatement}
*/
@Override
- public PreparedStatement prepareStatement(String sql) throws SQLException {
+ public PreparedStatement prepareStatement(final String sql) throws SQLException {
if (null == _pstmtPool) {
throw new SQLException(
"Statement pool is null - closed or invalid PoolingConnection.");
@@ -117,7 +117,7 @@ public class PoolingConnection extends D
}
@Override
- public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
+ public PreparedStatement prepareStatement(final String sql, final int autoGeneratedKeys) throws SQLException {
if (null == _pstmtPool) {
throw new SQLException(
"Statement pool is null - closed or invalid PoolingConnection.");
@@ -144,7 +144,7 @@ public class PoolingConnection extends D
* @return a {@link PoolablePreparedStatement}
*/
@Override
- public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
+ public PreparedStatement prepareStatement(final String sql, final int resultSetType, final int resultSetConcurrency) throws SQLException {
if (null == _pstmtPool) {
throw new SQLException(
"Statement pool is null - closed or invalid PoolingConnection.");
@@ -167,7 +167,7 @@ public class PoolingConnection extends D
* @throws SQLException
*/
@Override
- public CallableStatement prepareCall(String sql) throws SQLException {
+ public CallableStatement prepareCall(final String sql) throws SQLException {
try {
return (CallableStatement) _pstmtPool.borrowObject(createKey(sql, StatementType.CALLABLE_STATEMENT));
} catch (final NoSuchElementException e) {
@@ -188,7 +188,7 @@ public class PoolingConnection extends D
* @throws SQLException
*/
@Override
- public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
+ public CallableStatement prepareCall(final String sql, final int resultSetType, final int resultSetConcurrency) throws SQLException {
try {
return (CallableStatement) _pstmtPool.borrowObject(createKey(sql, resultSetType,
resultSetConcurrency, StatementType.CALLABLE_STATEMENT));
@@ -222,7 +222,7 @@ public class PoolingConnection extends D
// return super.prepareStatement(sql, columnNames);
// }
- protected PStmtKey createKey(String sql, int autoGeneratedKeys) {
+ protected PStmtKey createKey(final String sql, final int autoGeneratedKeys) {
String catalog = null;
try {
catalog = getCatalog();
@@ -238,7 +238,7 @@ public class PoolingConnection extends D
* @param resultSetType result set type
* @param resultSetConcurrency result set concurrency
*/
- protected PStmtKey createKey(String sql, int resultSetType, int resultSetConcurrency) {
+ protected PStmtKey createKey(final String sql, final int resultSetType, final int resultSetConcurrency) {
String catalog = null;
try {
catalog = getCatalog();
@@ -255,7 +255,7 @@ public class PoolingConnection extends D
* @param resultSetConcurrency result set concurrency
* @param stmtType statement type
*/
- protected PStmtKey createKey(String sql, int resultSetType, int resultSetConcurrency, StatementType stmtType) {
+ protected PStmtKey createKey(final String sql, final int resultSetType, final int resultSetConcurrency, final StatementType stmtType) {
String catalog = null;
try {
catalog = getCatalog();
@@ -269,7 +269,7 @@ public class PoolingConnection extends D
* Create a PStmtKey for the given arguments.
* @param sql the sql string used to define the statement
*/
- protected PStmtKey createKey(String sql) {
+ protected PStmtKey createKey(final String sql) {
String catalog = null;
try {
catalog = getCatalog();
@@ -284,7 +284,7 @@ public class PoolingConnection extends D
* @param sql the SQL string used to define the statement
* @param stmtType statement type
*/
- protected PStmtKey createKey(String sql, StatementType stmtType) {
+ protected PStmtKey createKey(final String sql, final StatementType stmtType) {
String catalog = null;
try {
catalog = getCatalog();
@@ -298,7 +298,7 @@ public class PoolingConnection extends D
* Normalize the given SQL statement, producing a
* canonical form that is semantically equivalent to the original.
*/
- protected String normalizeSQL(String sql) {
+ protected String normalizeSQL(final String sql) {
return sql.trim();
}
@@ -312,7 +312,7 @@ public class PoolingConnection extends D
* @see #createKey(String, int, int, StatementType)
*/
@Override
- public PooledObject<DelegatingPreparedStatement> makeObject(PStmtKey key)
+ public PooledObject<DelegatingPreparedStatement> makeObject(final PStmtKey key)
throws Exception {
if(null == key) {
throw new IllegalArgumentException("Prepared statement key is null or invalid.");
@@ -356,8 +356,8 @@ public class PoolingConnection extends D
* @param p the wrapped pooled statement to be destroyed.
*/
@Override
- public void destroyObject(PStmtKey key,
- PooledObject<DelegatingPreparedStatement> p)
+ public void destroyObject(final PStmtKey key,
+ final PooledObject<DelegatingPreparedStatement> p)
throws Exception {
p.getObject().getInnermostDelegate().close();
}
@@ -371,8 +371,8 @@ public class PoolingConnection extends D
* @return {@code true}
*/
@Override
- public boolean validateObject(PStmtKey key,
- PooledObject<DelegatingPreparedStatement> p) {
+ public boolean validateObject(final PStmtKey key,
+ final PooledObject<DelegatingPreparedStatement> p) {
return true;
}
@@ -384,8 +384,8 @@ public class PoolingConnection extends D
* @param p wrapped pooled statement to be activated
*/
@Override
- public void activateObject(PStmtKey key,
- PooledObject<DelegatingPreparedStatement> p) throws Exception {
+ public void activateObject(final PStmtKey key,
+ final PooledObject<DelegatingPreparedStatement> p) throws Exception {
p.getObject().activate();
}
@@ -398,8 +398,8 @@ public class PoolingConnection extends D
* @param p a wrapped {@link PreparedStatement}
*/
@Override
- public void passivateObject(PStmtKey key,
- PooledObject<DelegatingPreparedStatement> p) throws Exception {
+ public void passivateObject(final PStmtKey key,
+ final PooledObject<DelegatingPreparedStatement> p) throws Exception {
final DelegatingPreparedStatement dps = p.getObject();
dps.clearParameters();
dps.passivate();
Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolingDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolingDataSource.java?rev=1729277&r1=1729276&r2=1729277&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolingDataSource.java (original)
+++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolingDataSource.java Mon Feb 8 21:58:41 2016
@@ -50,7 +50,7 @@ public class PoolingDataSource<C extends
/** Controls access to the underlying connection */
private boolean accessToUnderlyingConnectionAllowed = false;
- public PoolingDataSource(ObjectPool<C> pool) {
+ public PoolingDataSource(final ObjectPool<C> pool) {
if (null == pool) {
throw new NullPointerException("Pool must not be null.");
}
@@ -102,18 +102,18 @@ public class PoolingDataSource<C extends
*
* @param allow Access to the underlying connection is granted when true.
*/
- public void setAccessToUnderlyingConnectionAllowed(boolean allow) {
+ public void setAccessToUnderlyingConnectionAllowed(final boolean allow) {
this.accessToUnderlyingConnectionAllowed = allow;
}
/* JDBC_4_ANT_KEY_BEGIN */
@Override
- public boolean isWrapperFor(Class<?> iface) throws SQLException {
+ public boolean isWrapperFor(final Class<?> iface) throws SQLException {
return false;
}
@Override
- public <T> T unwrap(Class<T> iface) throws SQLException {
+ public <T> T unwrap(final Class<T> iface) throws SQLException {
throw new SQLException("PoolingDataSource is not a wrapper.");
}
/* JDBC_4_ANT_KEY_END */
@@ -153,7 +153,7 @@ public class PoolingDataSource<C extends
* @throws UnsupportedOperationException
*/
@Override
- public Connection getConnection(String uname, String passwd) throws SQLException {
+ public Connection getConnection(final String uname, final String passwd) throws SQLException {
throw new UnsupportedOperationException();
}
@@ -183,7 +183,7 @@ public class PoolingDataSource<C extends
* implementation does not support this feature.
*/
@Override
- public void setLoginTimeout(int seconds) {
+ public void setLoginTimeout(final int seconds) {
throw new UnsupportedOperationException("Login timeout is not supported.");
}
@@ -192,7 +192,7 @@ public class PoolingDataSource<C extends
* @see DataSource#setLogWriter
*/
@Override
- public void setLogWriter(PrintWriter out) {
+ public void setLogWriter(final PrintWriter out) {
_logWriter = out;
}
@@ -213,7 +213,7 @@ public class PoolingDataSource<C extends
private class PoolGuardConnectionWrapper<D extends Connection>
extends DelegatingConnection<D> {
- PoolGuardConnectionWrapper(D delegate) {
+ PoolGuardConnectionWrapper(final D delegate) {
super(delegate);
}
Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolingDriver.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolingDriver.java?rev=1729277&r1=1729276&r2=1729277&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolingDriver.java (original)
+++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolingDriver.java Mon Feb 8 21:58:41 2016
@@ -64,7 +64,7 @@ public class PoolingDriver implements Dr
/**
* For unit testing purposes.
*/
- protected PoolingDriver(boolean accessToUnderlyingConnectionAllowed) {
+ protected PoolingDriver(final boolean accessToUnderlyingConnectionAllowed) {
this.accessToUnderlyingConnectionAllowed = accessToUnderlyingConnectionAllowed;
}
@@ -78,7 +78,7 @@ public class PoolingDriver implements Dr
return accessToUnderlyingConnectionAllowed;
}
- public synchronized ObjectPool<? extends Connection> getConnectionPool(String name)
+ public synchronized ObjectPool<? extends Connection> getConnectionPool(final String name)
throws SQLException {
final ObjectPool<? extends Connection> pool = pools.get(name);
if (null == pool) {
@@ -87,12 +87,12 @@ public class PoolingDriver implements Dr
return pool;
}
- public synchronized void registerPool(String name,
- ObjectPool<? extends Connection> pool) {
+ public synchronized void registerPool(final String name,
+ final ObjectPool<? extends Connection> pool) {
pools.put(name,pool);
}
- public synchronized void closePool(String name) throws SQLException {
+ public synchronized void closePool(final String name) throws SQLException {
final ObjectPool<? extends Connection> pool = pools.get(name);
if (pool != null) {
pools.remove(name);
@@ -111,7 +111,7 @@ public class PoolingDriver implements Dr
}
@Override
- public boolean acceptsURL(String url) throws SQLException {
+ public boolean acceptsURL(final String url) throws SQLException {
try {
return url.startsWith(URL_PREFIX);
} catch(final NullPointerException e) {
@@ -120,7 +120,7 @@ public class PoolingDriver implements Dr
}
@Override
- public Connection connect(String url, Properties info) throws SQLException {
+ public Connection connect(final String url, final Properties info) throws SQLException {
if(acceptsURL(url)) {
final ObjectPool<? extends Connection> pool =
getConnectionPool(url.substring(URL_PREFIX_LEN));
@@ -157,7 +157,7 @@ public class PoolingDriver implements Dr
* <code>PoolGuardConnectionWrapper</code> or an error occurs invalidating
* the connection
*/
- public void invalidateConnection(Connection conn) throws SQLException {
+ public void invalidateConnection(final Connection conn) throws SQLException {
if (conn instanceof PoolGuardConnectionWrapper) { // normal case
final PoolGuardConnectionWrapper pgconn = (PoolGuardConnectionWrapper) conn;
@SuppressWarnings("unchecked")
@@ -190,7 +190,7 @@ public class PoolingDriver implements Dr
}
@Override
- public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) {
+ public DriverPropertyInfo[] getPropertyInfo(final String url, final Properties info) {
return new DriverPropertyInfo[0];
}
@@ -211,8 +211,8 @@ public class PoolingDriver implements Dr
private final ObjectPool<? extends Connection> pool;
- PoolGuardConnectionWrapper(ObjectPool<? extends Connection> pool,
- Connection delegate) {
+ PoolGuardConnectionWrapper(final ObjectPool<? extends Connection> pool,
+ final Connection delegate) {
super(delegate);
this.pool = pool;
}
Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/SwallowedExceptionLogger.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/SwallowedExceptionLogger.java?rev=1729277&r1=1729276&r2=1729277&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/SwallowedExceptionLogger.java (original)
+++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/SwallowedExceptionLogger.java Mon Feb 8 21:58:41 2016
@@ -35,7 +35,7 @@ public class SwallowedExceptionLogger im
*
* @param log logger
*/
- public SwallowedExceptionLogger(Log log) {
+ public SwallowedExceptionLogger(final Log log) {
this(log, true);
}
@@ -46,13 +46,13 @@ public class SwallowedExceptionLogger im
* @param log logger
* @param logExpiredConnections false suppresses logging of expired connection events
*/
- public SwallowedExceptionLogger(Log log, boolean logExpiredConnections) {
+ public SwallowedExceptionLogger(final Log log, final boolean logExpiredConnections) {
this.log = log;
this.logExpiredConnections = logExpiredConnections;
}
@Override
- public void onSwallowException(Exception e) {
+ public void onSwallowException(final Exception e) {
if (logExpiredConnections || !(e instanceof LifetimeExceededException)) {
log.warn(Utils.getMessage(
"swallowedExceptionLogger.onSwallowedException"), e);
Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/Utils.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/Utils.java?rev=1729277&r1=1729276&r2=1729277&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/Utils.java (original)
+++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/Utils.java Mon Feb 8 21:58:41 2016
@@ -74,7 +74,7 @@ public final class Utils {
*
* @param rset a ResultSet, may be {@code null}
*/
- public static void closeQuietly(ResultSet rset) {
+ public static void closeQuietly(final ResultSet rset) {
if (rset != null) {
try {
rset.close();
@@ -89,7 +89,7 @@ public final class Utils {
*
* @param conn a Connection, may be {@code null}
*/
- public static void closeQuietly(Connection conn) {
+ public static void closeQuietly(final Connection conn) {
if (conn != null) {
try {
conn.close();
@@ -104,7 +104,7 @@ public final class Utils {
*
* @param stmt a Statement, may be {@code null}
*/
- public static void closeQuietly(Statement stmt) {
+ public static void closeQuietly(final Statement stmt) {
if (stmt != null) {
try {
stmt.close();
@@ -118,7 +118,7 @@ public final class Utils {
/**
* Obtain the correct i18n message for the given key.
*/
- public static String getMessage(String key) {
+ public static String getMessage(final String key) {
return getMessage(key, (Object[]) null);
}
@@ -127,7 +127,7 @@ public final class Utils {
* Obtain the correct i18n message for the given key with placeholders
* replaced by the supplied arguments.
*/
- public static String getMessage(String key, Object... args) {
+ public static String getMessage(final String key, final Object... args) {
final String msg = messages.getString(key);
if (args == null || args.length == 0) {
return msg;
Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/cpdsadapter/ConnectionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/cpdsadapter/ConnectionImpl.java?rev=1729277&r1=1729276&r2=1729277&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/cpdsadapter/ConnectionImpl.java (original)
+++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/cpdsadapter/ConnectionImpl.java Mon Feb 8 21:58:41 2016
@@ -54,9 +54,9 @@ class ConnectionImpl extends DelegatingC
* @param connection The JDBC 1.x Connection to wrap.
* @param accessToUnderlyingConnectionAllowed if true, then access is allowed to the underlying connection
*/
- ConnectionImpl(PooledConnectionImpl pooledConnection,
- Connection connection,
- boolean accessToUnderlyingConnectionAllowed) {
+ ConnectionImpl(final PooledConnectionImpl pooledConnection,
+ final Connection connection,
+ final boolean accessToUnderlyingConnectionAllowed) {
super(connection);
this.pooledConnection = pooledConnection;
this.accessToUnderlyingConnectionAllowed =
@@ -95,7 +95,7 @@ class ConnectionImpl extends DelegatingC
* in the wrapped connection.
*/
@Override
- public PreparedStatement prepareStatement(String sql) throws SQLException {
+ public PreparedStatement prepareStatement(final String sql) throws SQLException {
checkOpen();
try {
return new DelegatingPreparedStatement
@@ -116,8 +116,8 @@ class ConnectionImpl extends DelegatingC
* in the wrapped connection.
*/
@Override
- public PreparedStatement prepareStatement(String sql, int resultSetType,
- int resultSetConcurrency)
+ public PreparedStatement prepareStatement(final String sql, final int resultSetType,
+ final int resultSetConcurrency)
throws SQLException {
checkOpen();
try {
@@ -132,9 +132,9 @@ class ConnectionImpl extends DelegatingC
}
@Override
- public PreparedStatement prepareStatement(String sql, int resultSetType,
- int resultSetConcurrency,
- int resultSetHoldability)
+ public PreparedStatement prepareStatement(final String sql, final int resultSetType,
+ final int resultSetConcurrency,
+ final int resultSetHoldability)
throws SQLException {
checkOpen();
try {
@@ -149,7 +149,7 @@ class ConnectionImpl extends DelegatingC
}
@Override
- public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
+ public PreparedStatement prepareStatement(final String sql, final int autoGeneratedKeys)
throws SQLException {
checkOpen();
try {
@@ -163,7 +163,7 @@ class ConnectionImpl extends DelegatingC
}
@Override
- public PreparedStatement prepareStatement(String sql, int columnIndexes[])
+ public PreparedStatement prepareStatement(final String sql, final int columnIndexes[])
throws SQLException {
checkOpen();
try {
@@ -177,7 +177,7 @@ class ConnectionImpl extends DelegatingC
}
@Override
- public PreparedStatement prepareStatement(String sql, String columnNames[])
+ public PreparedStatement prepareStatement(final String sql, final String columnNames[])
throws SQLException {
checkOpen();
try {
Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/cpdsadapter/DriverAdapterCPDS.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/cpdsadapter/DriverAdapterCPDS.java?rev=1729277&r1=1729276&r2=1729277&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/cpdsadapter/DriverAdapterCPDS.java (original)
+++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/cpdsadapter/DriverAdapterCPDS.java Mon Feb 8 21:58:41 2016
@@ -164,7 +164,7 @@ public class DriverAdapterCPDS
* @param pass password to be used fur the connection
*/
@Override
- public PooledConnection getPooledConnection(String username, String pass)
+ public PooledConnection getPooledConnection(final String username, final String pass)
throws SQLException {
getConnectionCalled = true;
PooledConnectionImpl pci = null;
@@ -274,8 +274,8 @@ public class DriverAdapterCPDS
* implements ObjectFactory to create an instance of this class
*/
@Override
- public Object getObjectInstance(Object refObj, Name name,
- Context context, Hashtable<?,?> env)
+ public Object getObjectInstance(final Object refObj, final Name name,
+ final Context context, final Hashtable<?,?> env)
throws Exception {
// The spec says to return null if we can't create an instance
// of the reference
@@ -387,7 +387,7 @@ public class DriverAdapterCPDS
* @param props Connection properties to use when creating new connections.
* @throws IllegalStateException if {@link #getPooledConnection()} has been called
*/
- public void setConnectionProperties(Properties props) {
+ public void setConnectionProperties(final Properties props) {
assertInitializationAllowed();
connectionProperties = props;
if (connectionProperties.containsKey("user")) {
@@ -417,7 +417,7 @@ public class DriverAdapterCPDS
*
* @param v Value to assign to description.
*/
- public void setDescription(String v) {
+ public void setDescription(final String v) {
this.description = v;
}
@@ -434,7 +434,7 @@ public class DriverAdapterCPDS
* @param v Value to assign to password.
* @throws IllegalStateException if {@link #getPooledConnection()} has been called
*/
- public void setPassword(String v) {
+ public void setPassword(final String v) {
assertInitializationAllowed();
this.password = v;
if (connectionProperties != null) {
@@ -455,7 +455,7 @@ public class DriverAdapterCPDS
* @param v Value to assign to url.
* @throws IllegalStateException if {@link #getPooledConnection()} has been called
*/
- public void setUrl(String v) {
+ public void setUrl(final String v) {
assertInitializationAllowed();
this.url = v;
}
@@ -473,7 +473,7 @@ public class DriverAdapterCPDS
* @param v Value to assign to user.
* @throws IllegalStateException if {@link #getPooledConnection()} has been called
*/
- public void setUser(String v) {
+ public void setUser(final String v) {
assertInitializationAllowed();
this.user = v;
if (connectionProperties != null) {
@@ -495,7 +495,7 @@ public class DriverAdapterCPDS
* @param v Value to assign to driver.
* @throws IllegalStateException if {@link #getPooledConnection()} has been called
*/
- public void setDriver(String v) throws ClassNotFoundException {
+ public void setDriver(final String v) throws ClassNotFoundException {
assertInitializationAllowed();
this.driver = v;
// make sure driver is registered
@@ -524,7 +524,7 @@ public class DriverAdapterCPDS
* while attempting to connect to a database. NOT USED.
*/
@Override
- public void setLoginTimeout(int seconds) {
+ public void setLoginTimeout(final int seconds) {
loginTimeout = seconds;
}
@@ -532,7 +532,7 @@ public class DriverAdapterCPDS
* Set the log writer for this data source. NOT USED.
*/
@Override
- public void setLogWriter(PrintWriter out) {
+ public void setLogWriter(final PrintWriter out) {
logWriter = out;
}
@@ -554,7 +554,7 @@ public class DriverAdapterCPDS
* @param v true to pool statements.
* @throws IllegalStateException if {@link #getPooledConnection()} has been called
*/
- public void setPoolPreparedStatements(boolean v) {
+ public void setPoolPreparedStatements(final boolean v) {
assertInitializationAllowed();
this.poolPreparedStatements = v;
}
@@ -575,7 +575,7 @@ public class DriverAdapterCPDS
* @param maxIdle The maximum number of statements that can remain idle
* @throws IllegalStateException if {@link #getPooledConnection()} has been called
*/
- public void setMaxIdle(int maxIdle) {
+ public void setMaxIdle(final int maxIdle) {
assertInitializationAllowed();
this.maxIdle = maxIdle;
}
@@ -602,7 +602,7 @@ public class DriverAdapterCPDS
* @throws IllegalStateException if {@link #getPooledConnection()} has been called
*/
public void setTimeBetweenEvictionRunsMillis(
- long timeBetweenEvictionRunsMillis) {
+ final long timeBetweenEvictionRunsMillis) {
assertInitializationAllowed();
_timeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis;
}
@@ -631,7 +631,7 @@ public class DriverAdapterCPDS
* @see #setTimeBetweenEvictionRunsMillis(long)
* @throws IllegalStateException if {@link #getPooledConnection()} has been called
*/
- public void setNumTestsPerEvictionRun(int numTestsPerEvictionRun) {
+ public void setNumTestsPerEvictionRun(final int numTestsPerEvictionRun) {
assertInitializationAllowed();
_numTestsPerEvictionRun = numTestsPerEvictionRun;
}
@@ -659,7 +659,7 @@ public class DriverAdapterCPDS
* @see #setTimeBetweenEvictionRunsMillis(long)
* @throws IllegalStateException if {@link #getPooledConnection()} has been called
*/
- public void setMinEvictableIdleTimeMillis(int minEvictableIdleTimeMillis) {
+ public void setMinEvictableIdleTimeMillis(final int minEvictableIdleTimeMillis) {
assertInitializationAllowed();
_minEvictableIdleTimeMillis = minEvictableIdleTimeMillis;
}
@@ -680,7 +680,7 @@ public class DriverAdapterCPDS
*
* @param allow Access to the underlying connection is granted when true.
*/
- public synchronized void setAccessToUnderlyingConnectionAllowed(boolean allow) {
+ public synchronized void setAccessToUnderlyingConnectionAllowed(final boolean allow) {
this.accessToUnderlyingConnectionAllowed = allow;
}
@@ -699,7 +699,7 @@ public class DriverAdapterCPDS
* @param maxPreparedStatements the new maximum number of prepared
* statements
*/
- public void setMaxPreparedStatements(int maxPreparedStatements)
+ public void setMaxPreparedStatements(final int maxPreparedStatements)
{
_maxPreparedStatements = maxPreparedStatements;
}
Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/cpdsadapter/PStmtKeyCPDS.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/cpdsadapter/PStmtKeyCPDS.java?rev=1729277&r1=1729276&r2=1729277&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/cpdsadapter/PStmtKeyCPDS.java (original)
+++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/cpdsadapter/PStmtKeyCPDS.java Mon Feb 8 21:58:41 2016
@@ -30,43 +30,43 @@ public class PStmtKeyCPDS extends PStmtK
private final int _columnIndexes[];
private final String _columnNames[];
- public PStmtKeyCPDS(String sql) {
+ public PStmtKeyCPDS(final String sql) {
super(sql);
_resultSetHoldability = null;
_columnIndexes = null;
_columnNames = null;
}
- public PStmtKeyCPDS(String sql, int autoGeneratedKeys) {
+ public PStmtKeyCPDS(final String sql, final int autoGeneratedKeys) {
super(sql, null, autoGeneratedKeys);
_resultSetHoldability = null;
_columnIndexes = null;
_columnNames = null;
}
- public PStmtKeyCPDS(String sql, int resultSetType, int resultSetConcurrency) {
+ public PStmtKeyCPDS(final String sql, final int resultSetType, final int resultSetConcurrency) {
super(sql, resultSetType, resultSetConcurrency);
_resultSetHoldability = null;
_columnIndexes = null;
_columnNames = null;
}
- public PStmtKeyCPDS(String sql, int resultSetType, int resultSetConcurrency,
- int resultSetHoldability) {
+ public PStmtKeyCPDS(final String sql, final int resultSetType, final int resultSetConcurrency,
+ final int resultSetHoldability) {
super(sql, resultSetType, resultSetConcurrency);
_resultSetHoldability = Integer.valueOf(resultSetHoldability);
_columnIndexes = null;
_columnNames = null;
}
- public PStmtKeyCPDS(String sql, int columnIndexes[]) {
+ public PStmtKeyCPDS(final String sql, final int columnIndexes[]) {
super(sql);
_columnIndexes = Arrays.copyOf(columnIndexes, columnIndexes.length);
_resultSetHoldability = null;
_columnNames = null;
}
- public PStmtKeyCPDS(String sql, String columnNames[]) {
+ public PStmtKeyCPDS(final String sql, final String columnNames[]) {
super(sql);
_columnNames = Arrays.copyOf(columnNames, columnNames.length);
_resultSetHoldability = null;
@@ -75,7 +75,7 @@ public class PStmtKeyCPDS extends PStmtK
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/cpdsadapter/PooledConnectionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/cpdsadapter/PooledConnectionImpl.java?rev=1729277&r1=1729276&r2=1729277&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/cpdsadapter/PooledConnectionImpl.java (original)
+++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/cpdsadapter/PooledConnectionImpl.java Mon Feb 8 21:58:41 2016
@@ -91,7 +91,7 @@ class PooledConnectionImpl
* Wrap the real connection.
* @param connection the connection to be wrapped
*/
- PooledConnectionImpl(Connection connection) {
+ PooledConnectionImpl(final Connection connection) {
this.connection = connection;
if (connection instanceof DelegatingConnection) {
this.delegatingConnection = (DelegatingConnection<?>) connection;
@@ -103,7 +103,7 @@ class PooledConnectionImpl
}
public void setStatementPool(
- KeyedObjectPool<PStmtKeyCPDS, PoolablePreparedStatement<PStmtKeyCPDS>> statementPool) {
+ final KeyedObjectPool<PStmtKeyCPDS, PoolablePreparedStatement<PStmtKeyCPDS>> statementPool) {
pstmtPool = statementPool;
}
@@ -111,7 +111,7 @@ class PooledConnectionImpl
* {@inheritDoc}
*/
@Override
- public void addConnectionEventListener(ConnectionEventListener listener) {
+ public void addConnectionEventListener(final ConnectionEventListener listener) {
if (!eventListeners.contains(listener)) {
eventListeners.add(listener);
}
@@ -119,7 +119,7 @@ class PooledConnectionImpl
/* JDBC_4_ANT_KEY_BEGIN */
@Override
- public void addStatementEventListener(StatementEventListener listener) {
+ public void addStatementEventListener(final StatementEventListener listener) {
if (!statementEventListeners.contains(listener)) {
statementEventListeners.add(listener);
}
@@ -195,13 +195,13 @@ class PooledConnectionImpl
*/
@Override
public void removeConnectionEventListener(
- ConnectionEventListener listener) {
+ final ConnectionEventListener listener) {
eventListeners.remove(listener);
}
/* JDBC_4_ANT_KEY_BEGIN */
@Override
- public void removeStatementEventListener(StatementEventListener listener) {
+ public void removeStatementEventListener(final StatementEventListener listener) {
statementEventListeners.remove(listener);
}
/* JDBC_4_ANT_KEY_END */
@@ -245,7 +245,7 @@ class PooledConnectionImpl
* @param sql the SQL statement
* @return a {@link PoolablePreparedStatement}
*/
- PreparedStatement prepareStatement(String sql) throws SQLException {
+ PreparedStatement prepareStatement(final String sql) throws SQLException {
if (pstmtPool == null) {
return connection.prepareStatement(sql);
}
@@ -274,8 +274,8 @@ class PooledConnectionImpl
* @return a {@link PoolablePreparedStatement}
* @see Connection#prepareStatement(String, int, int)
*/
- PreparedStatement prepareStatement(String sql, int resultSetType,
- int resultSetConcurrency)
+ PreparedStatement prepareStatement(final String sql, final int resultSetType,
+ final int resultSetConcurrency)
throws SQLException {
if (pstmtPool == null) {
return connection.prepareStatement(sql, resultSetType, resultSetConcurrency);
@@ -301,7 +301,7 @@ class PooledConnectionImpl
* @return a {@link PoolablePreparedStatement}
* @see Connection#prepareStatement(String, int)
*/
- PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
+ PreparedStatement prepareStatement(final String sql, final int autoGeneratedKeys)
throws SQLException {
if (pstmtPool == null) {
return connection.prepareStatement(sql, autoGeneratedKeys);
@@ -315,8 +315,8 @@ class PooledConnectionImpl
}
}
- PreparedStatement prepareStatement(String sql, int resultSetType,
- int resultSetConcurrency, int resultSetHoldability)
+ PreparedStatement prepareStatement(final String sql, final int resultSetType,
+ final int resultSetConcurrency, final int resultSetHoldability)
throws SQLException {
if (pstmtPool == null) {
return connection.prepareStatement(sql, resultSetType,
@@ -332,7 +332,7 @@ class PooledConnectionImpl
}
}
- PreparedStatement prepareStatement(String sql, int columnIndexes[])
+ PreparedStatement prepareStatement(final String sql, final int columnIndexes[])
throws SQLException {
if (pstmtPool == null) {
return connection.prepareStatement(sql, columnIndexes);
@@ -346,7 +346,7 @@ class PooledConnectionImpl
}
}
- PreparedStatement prepareStatement(String sql, String columnNames[])
+ PreparedStatement prepareStatement(final String sql, final String columnNames[])
throws SQLException {
if (pstmtPool == null) {
return connection.prepareStatement(sql, columnNames);
@@ -363,15 +363,15 @@ class PooledConnectionImpl
/**
* Create a {@link PooledConnectionImpl.PStmtKey} for the given arguments.
*/
- protected PStmtKeyCPDS createKey(String sql, int autoGeneratedKeys) {
+ protected PStmtKeyCPDS createKey(final String sql, final int autoGeneratedKeys) {
return new PStmtKeyCPDS(normalizeSQL(sql), autoGeneratedKeys);
}
/**
* Create a {@link PooledConnectionImpl.PStmtKey} for the given arguments.
*/
- protected PStmtKeyCPDS createKey(String sql, int resultSetType,
- int resultSetConcurrency, int resultSetHoldability) {
+ protected PStmtKeyCPDS createKey(final String sql, final int resultSetType,
+ final int resultSetConcurrency, final int resultSetHoldability) {
return new PStmtKeyCPDS(normalizeSQL(sql), resultSetType,
resultSetConcurrency, resultSetHoldability);
}
@@ -379,22 +379,22 @@ class PooledConnectionImpl
/**
* Create a {@link PooledConnectionImpl.PStmtKey} for the given arguments.
*/
- protected PStmtKeyCPDS createKey(String sql, int columnIndexes[]) {
+ protected PStmtKeyCPDS createKey(final String sql, final int columnIndexes[]) {
return new PStmtKeyCPDS(normalizeSQL(sql), columnIndexes);
}
/**
* Create a {@link PooledConnectionImpl.PStmtKey} for the given arguments.
*/
- protected PStmtKeyCPDS createKey(String sql, String columnNames[]) {
+ protected PStmtKeyCPDS createKey(final String sql, final String columnNames[]) {
return new PStmtKeyCPDS(normalizeSQL(sql), columnNames);
}
/**
* Create a {@link PooledConnectionImpl.PStmtKey} for the given arguments.
*/
- protected PStmtKeyCPDS createKey(String sql, int resultSetType,
- int resultSetConcurrency) {
+ protected PStmtKeyCPDS createKey(final String sql, final int resultSetType,
+ final int resultSetConcurrency) {
return new PStmtKeyCPDS(normalizeSQL(sql), resultSetType,
resultSetConcurrency);
}
@@ -402,7 +402,7 @@ class PooledConnectionImpl
/**
* Create a {@link PooledConnectionImpl.PStmtKey} for the given arguments.
*/
- protected PStmtKeyCPDS createKey(String sql) {
+ protected PStmtKeyCPDS createKey(final String sql) {
return new PStmtKeyCPDS(normalizeSQL(sql));
}
@@ -410,7 +410,7 @@ class PooledConnectionImpl
* Normalize the given SQL statement, producing a
* canonical form that is semantically equivalent to the original.
*/
- protected String normalizeSQL(String sql) {
+ protected String normalizeSQL(final String sql) {
return sql.trim();
}
@@ -420,7 +420,7 @@ class PooledConnectionImpl
* @param key the key for the {@link PreparedStatement} to be created
*/
@Override
- public PooledObject<PoolablePreparedStatement<PStmtKeyCPDS>> makeObject(PStmtKeyCPDS key) throws Exception {
+ public PooledObject<PoolablePreparedStatement<PStmtKeyCPDS>> makeObject(final PStmtKeyCPDS key) throws Exception {
if (null == key) {
throw new IllegalArgumentException();
}
@@ -451,8 +451,8 @@ class PooledConnectionImpl
* @param p the wrapped {@link PreparedStatement} to be destroyed.
*/
@Override
- public void destroyObject(PStmtKeyCPDS key,
- PooledObject<PoolablePreparedStatement<PStmtKeyCPDS>> p)
+ public void destroyObject(final PStmtKeyCPDS key,
+ final PooledObject<PoolablePreparedStatement<PStmtKeyCPDS>> p)
throws Exception {
p.getObject().getInnermostDelegate().close();
}
@@ -465,8 +465,8 @@ class PooledConnectionImpl
* @return {@code true}
*/
@Override
- public boolean validateObject(PStmtKeyCPDS key,
- PooledObject<PoolablePreparedStatement<PStmtKeyCPDS>> p) {
+ public boolean validateObject(final PStmtKeyCPDS key,
+ final PooledObject<PoolablePreparedStatement<PStmtKeyCPDS>> p) {
return true;
}
@@ -477,8 +477,8 @@ class PooledConnectionImpl
* @param p ignored
*/
@Override
- public void activateObject(PStmtKeyCPDS key,
- PooledObject<PoolablePreparedStatement<PStmtKeyCPDS>> p)
+ public void activateObject(final PStmtKeyCPDS key,
+ final PooledObject<PoolablePreparedStatement<PStmtKeyCPDS>> p)
throws Exception {
p.getObject().activate();
}
@@ -490,8 +490,8 @@ class PooledConnectionImpl
* @param p a wrapped {@link PreparedStatement}
*/
@Override
- public void passivateObject(PStmtKeyCPDS key,
- PooledObject<PoolablePreparedStatement<PStmtKeyCPDS>> p)
+ public void passivateObject(final PStmtKeyCPDS key,
+ final PooledObject<PoolablePreparedStatement<PStmtKeyCPDS>> p)
throws Exception {
final PoolablePreparedStatement<PStmtKeyCPDS> ppss = p.getObject();
ppss.clearParameters();
@@ -514,7 +514,7 @@ class PooledConnectionImpl
*
* @param allow Access to the underlying connection is granted when true.
*/
- public synchronized void setAccessToUnderlyingConnectionAllowed(boolean allow) {
+ public synchronized void setAccessToUnderlyingConnectionAllowed(final boolean allow) {
this.accessToUnderlyingConnectionAllowed = allow;
}
}
Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/CPDSConnectionFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/CPDSConnectionFactory.java?rev=1729277&r1=1729276&r2=1729277&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/CPDSConnectionFactory.java (original)
+++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/CPDSConnectionFactory.java Mon Feb 8 21:58:41 2016
@@ -90,12 +90,12 @@ class CPDSConnectionFactory
* @param username The user name to use to create connections
* @param password The password to use to create connections
*/
- public CPDSConnectionFactory(ConnectionPoolDataSource cpds,
- String validationQuery,
- int validationQueryTimeout,
- boolean rollbackAfterValidation,
- String username,
- String password) {
+ public CPDSConnectionFactory(final ConnectionPoolDataSource cpds,
+ final String validationQuery,
+ final int validationQueryTimeout,
+ final boolean rollbackAfterValidation,
+ final String username,
+ final String password) {
_cpds = cpds;
_validationQuery = validationQuery;
_validationQueryTimeout = validationQueryTimeout;
@@ -118,7 +118,7 @@ class CPDSConnectionFactory
* @param pool the {@link ObjectPool} in which to pool those {@link
* Connection}s
*/
- public void setPool(ObjectPool<PooledConnectionAndInfo> pool) {
+ public void setPool(final ObjectPool<PooledConnectionAndInfo> pool) {
this._pool = pool;
}
@@ -152,11 +152,11 @@ class CPDSConnectionFactory
* Closes the PooledConnection and stops listening for events from it.
*/
@Override
- public void destroyObject(PooledObject<PooledConnectionAndInfo> p) throws Exception {
+ public void destroyObject(final PooledObject<PooledConnectionAndInfo> p) throws Exception {
doDestroyObject(p.getObject());
}
- private void doDestroyObject(PooledConnectionAndInfo pci) throws Exception{
+ private void doDestroyObject(final PooledConnectionAndInfo pci) throws Exception{
final PooledConnection pc = pci.getPooledConnection();
pc.removeConnectionEventListener(this);
pcMap.remove(pc);
@@ -164,7 +164,7 @@ class CPDSConnectionFactory
}
@Override
- public boolean validateObject(PooledObject<PooledConnectionAndInfo> p) {
+ public boolean validateObject(final PooledObject<PooledConnectionAndInfo> p) {
try {
validateLifetime(p);
} catch (final Exception e) {
@@ -221,13 +221,13 @@ class CPDSConnectionFactory
}
@Override
- public void passivateObject(PooledObject<PooledConnectionAndInfo> p)
+ public void passivateObject(final PooledObject<PooledConnectionAndInfo> p)
throws Exception {
validateLifetime(p);
}
@Override
- public void activateObject(PooledObject<PooledConnectionAndInfo> p)
+ public void activateObject(final PooledObject<PooledConnectionAndInfo> p)
throws Exception {
validateLifetime(p);
}
@@ -243,7 +243,7 @@ class CPDSConnectionFactory
* release this PooledConnection from our pool...
*/
@Override
- public void connectionClosed(ConnectionEvent event) {
+ public void connectionClosed(final ConnectionEvent event) {
final PooledConnection pc = (PooledConnection) event.getSource();
// if this event occurred because we were validating, ignore it
// otherwise return the connection to the pool.
@@ -275,7 +275,7 @@ class CPDSConnectionFactory
* not to be returned in the future
*/
@Override
- public void connectionErrorOccurred(ConnectionEvent event) {
+ public void connectionErrorOccurred(final ConnectionEvent event) {
final PooledConnection pc = (PooledConnection)event.getSource();
if (null != event.getSQLException()) {
System.err.println(
@@ -307,7 +307,7 @@ class CPDSConnectionFactory
* and connections that are checked out are closed on return.
*/
@Override
- public void invalidate(PooledConnection pc) throws SQLException {
+ public void invalidate(final PooledConnection pc) throws SQLException {
final PooledConnectionAndInfo pci = pcMap.get(pc);
if (pci == null) {
throw new IllegalStateException(NO_KEY_MESSAGE);
@@ -326,7 +326,7 @@ class CPDSConnectionFactory
* @param password new password
*/
@Override
- public synchronized void setPassword(String password) {
+ public synchronized void setPassword(final String password) {
_password = password;
}
@@ -337,7 +337,7 @@ class CPDSConnectionFactory
* @param maxConnLifetimeMillis A value of zero or less indicates an
* infinite lifetime. The default value is -1.
*/
- public void setMaxConnLifetimeMillis(long maxConnLifetimeMillis) {
+ public void setMaxConnLifetimeMillis(final long maxConnLifetimeMillis) {
this.maxConnLifetimeMillis = maxConnLifetimeMillis;
}
@@ -346,7 +346,7 @@ class CPDSConnectionFactory
* factory and closes the pool if this is the case; otherwise does nothing.
*/
@Override
- public void closePool(String username) throws SQLException {
+ public void closePool(final String username) throws SQLException {
synchronized (this) {
if (username == null || !username.equals(_username)) {
return;
@@ -359,7 +359,7 @@ class CPDSConnectionFactory
}
}
- private void validateLifetime(PooledObject<PooledConnectionAndInfo> p)
+ private void validateLifetime(final PooledObject<PooledConnectionAndInfo> p)
throws Exception {
if (maxConnLifetimeMillis > 0) {
final long lifetime = System.currentTimeMillis() - p.getCreateTime();
Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSource.java?rev=1729277&r1=1729276&r2=1729277&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSource.java (original)
+++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSource.java Mon Feb 8 21:58:41 2016
@@ -194,12 +194,12 @@ public abstract class InstanceKeyDataSou
/* JDBC_4_ANT_KEY_BEGIN */
@Override
- public boolean isWrapperFor(Class<?> iface) throws SQLException {
+ public boolean isWrapperFor(final Class<?> iface) throws SQLException {
return false;
}
@Override
- public <T> T unwrap(Class<T> iface) throws SQLException {
+ public <T> T unwrap(final Class<T> iface) throws SQLException {
throw new SQLException("InstanceKeyDataSource is not a wrapper.");
}
/* JDBC_4_ANT_KEY_END */
@@ -227,7 +227,7 @@ public abstract class InstanceKeyDataSou
* {@link GenericKeyedObjectPoolConfig#getBlockWhenExhausted()} for each per
* user pool.
*/
- public void setDefaultBlockWhenExhausted(boolean blockWhenExhausted) {
+ public void setDefaultBlockWhenExhausted(final boolean blockWhenExhausted) {
assertInitializationAllowed();
this.defaultBlockWhenExhausted = blockWhenExhausted;
}
@@ -247,7 +247,7 @@ public abstract class InstanceKeyDataSou
* each per user pool.
*/
public void setDefaultEvictionPolicyClassName(
- String evictionPolicyClassName) {
+ final String evictionPolicyClassName) {
assertInitializationAllowed();
this.defaultEvictionPolicyClassName = evictionPolicyClassName;
}
@@ -264,7 +264,7 @@ public abstract class InstanceKeyDataSou
* Sets the default value for
* {@link GenericKeyedObjectPoolConfig#getLifo()} for each per user pool.
*/
- public void setDefaultLifo(boolean lifo) {
+ public void setDefaultLifo(final boolean lifo) {
assertInitializationAllowed();
this.defaultLifo = lifo;
}
@@ -283,7 +283,7 @@ public abstract class InstanceKeyDataSou
* {@link GenericKeyedObjectPoolConfig#getMaxIdlePerKey()} for each per user
* pool.
*/
- public void setDefaultMaxIdle(int maxIdle) {
+ public void setDefaultMaxIdle(final int maxIdle) {
assertInitializationAllowed();
this.defaultMaxIdle = maxIdle;
}
@@ -302,7 +302,7 @@ public abstract class InstanceKeyDataSou
* {@link GenericKeyedObjectPoolConfig#getMaxTotalPerKey()} for each per
* user pool.
*/
- public void setDefaultMaxTotal(int maxTotal) {
+ public void setDefaultMaxTotal(final int maxTotal) {
assertInitializationAllowed();
this.defaultMaxTotal = maxTotal;
}
@@ -321,7 +321,7 @@ public abstract class InstanceKeyDataSou
* {@link GenericKeyedObjectPoolConfig#getMaxWaitMillis()} for each per user
* pool.
*/
- public void setDefaultMaxWaitMillis(long maxWaitMillis) {
+ public void setDefaultMaxWaitMillis(final long maxWaitMillis) {
assertInitializationAllowed();
this.defaultMaxWaitMillis = maxWaitMillis;
}
@@ -341,7 +341,7 @@ public abstract class InstanceKeyDataSou
* each per user pool.
*/
public void setDefaultMinEvictableIdleTimeMillis(
- long minEvictableIdleTimeMillis) {
+ final long minEvictableIdleTimeMillis) {
assertInitializationAllowed();
this.defaultMinEvictableIdleTimeMillis = minEvictableIdleTimeMillis;
}
@@ -360,7 +360,7 @@ public abstract class InstanceKeyDataSou
* {@link GenericKeyedObjectPoolConfig#getMinIdlePerKey()} for each per user
* pool.
*/
- public void setDefaultMinIdle(int minIdle) {
+ public void setDefaultMinIdle(final int minIdle) {
assertInitializationAllowed();
this.defaultMinIdle = minIdle;
}
@@ -379,7 +379,7 @@ public abstract class InstanceKeyDataSou
* {@link GenericKeyedObjectPoolConfig#getNumTestsPerEvictionRun()} for each
* per user pool.
*/
- public void setDefaultNumTestsPerEvictionRun(int numTestsPerEvictionRun) {
+ public void setDefaultNumTestsPerEvictionRun(final int numTestsPerEvictionRun) {
assertInitializationAllowed();
this.defaultNumTestsPerEvictionRun = numTestsPerEvictionRun;
}
@@ -398,7 +398,7 @@ public abstract class InstanceKeyDataSou
* {@link org.apache.commons.pool2.impl.GenericObjectPool GenericObjectPool#getSoftMinEvictableIdleTimeMillis()} for each per user pool.
*/
public void setDefaultSoftMinEvictableIdleTimeMillis(
- long softMinEvictableIdleTimeMillis) {
+ final long softMinEvictableIdleTimeMillis) {
assertInitializationAllowed();
this.defaultSoftMinEvictableIdleTimeMillis = softMinEvictableIdleTimeMillis;
}
@@ -415,7 +415,7 @@ public abstract class InstanceKeyDataSou
* Sets the default value for
* {@link org.apache.commons.pool2.impl.GenericObjectPool GenericObjectPool#getTestOnCreate()} for each per user pool.
*/
- public void setDefaultTestOnCreate(boolean testOnCreate) {
+ public void setDefaultTestOnCreate(final boolean testOnCreate) {
assertInitializationAllowed();
this.defaultTestOnCreate = testOnCreate;
}
@@ -432,7 +432,7 @@ public abstract class InstanceKeyDataSou
* Sets the default value for
* {@link org.apache.commons.pool2.impl.GenericObjectPool GenericObjectPool#getTestOnBorrow()} for each per user pool.
*/
- public void setDefaultTestOnBorrow(boolean testOnBorrow) {
+ public void setDefaultTestOnBorrow(final boolean testOnBorrow) {
assertInitializationAllowed();
this.defaultTestOnBorrow = testOnBorrow;
}
@@ -449,7 +449,7 @@ public abstract class InstanceKeyDataSou
* Sets the default value for
* {@link org.apache.commons.pool2.impl.GenericObjectPool GenericObjectPool#getTestOnReturn()} for each per user pool.
*/
- public void setDefaultTestOnReturn(boolean testOnReturn) {
+ public void setDefaultTestOnReturn(final boolean testOnReturn) {
assertInitializationAllowed();
this.defaultTestOnReturn = testOnReturn;
}
@@ -466,7 +466,7 @@ public abstract class InstanceKeyDataSou
* Sets the default value for
* {@link org.apache.commons.pool2.impl.GenericObjectPool GenericObjectPool#getTestWhileIdle()} for each per user pool.
*/
- public void setDefaultTestWhileIdle(boolean testWhileIdle) {
+ public void setDefaultTestWhileIdle(final boolean testWhileIdle) {
assertInitializationAllowed();
this.defaultTestWhileIdle = testWhileIdle;
}
@@ -486,7 +486,7 @@ public abstract class InstanceKeyDataSou
* per user pool.
*/
public void setDefaultTimeBetweenEvictionRunsMillis (
- long timeBetweenEvictionRunsMillis ) {
+ final long timeBetweenEvictionRunsMillis ) {
assertInitializationAllowed();
this.defaultTimeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis ;
}
@@ -507,7 +507,7 @@ public abstract class InstanceKeyDataSou
*
* @param v Value to assign to connectionPoolDataSource.
*/
- public void setConnectionPoolDataSource(ConnectionPoolDataSource v) {
+ public void setConnectionPoolDataSource(final ConnectionPoolDataSource v) {
assertInitializationAllowed();
if (dataSourceName != null) {
throw new IllegalStateException(
@@ -540,7 +540,7 @@ public abstract class InstanceKeyDataSou
*
* @param v Value to assign to dataSourceName.
*/
- public void setDataSourceName(String v) {
+ public void setDataSourceName(final String v) {
assertInitializationAllowed();
if (dataSource != null) {
throw new IllegalStateException(
@@ -579,7 +579,7 @@ public abstract class InstanceKeyDataSou
*
* @param v Value to assign to defaultAutoCommit.
*/
- public void setDefaultAutoCommit(Boolean v) {
+ public void setDefaultAutoCommit(final Boolean v) {
assertInitializationAllowed();
this.defaultAutoCommit = v;
}
@@ -606,7 +606,7 @@ public abstract class InstanceKeyDataSou
*
* @param v Value to assign to defaultReadOnly.
*/
- public void setDefaultReadOnly(Boolean v) {
+ public void setDefaultReadOnly(final Boolean v) {
assertInitializationAllowed();
this.defaultReadOnly = v;
}
@@ -631,7 +631,7 @@ public abstract class InstanceKeyDataSou
*
* @param v Value to assign to defaultTransactionIsolation
*/
- public void setDefaultTransactionIsolation(int v) {
+ public void setDefaultTransactionIsolation(final int v) {
assertInitializationAllowed();
switch (v) {
case Connection.TRANSACTION_NONE:
@@ -664,7 +664,7 @@ public abstract class InstanceKeyDataSou
*
* @param v Value to assign to description.
*/
- public void setDescription(String v) {
+ public void setDescription(final String v) {
this.description = v;
}
@@ -679,7 +679,7 @@ public abstract class InstanceKeyDataSou
*
* @return value of jndiEnvironment.
*/
- public String getJndiEnvironment(String key) {
+ public String getJndiEnvironment(final String key) {
String value = null;
if (jndiEnvironment != null) {
value = jndiEnvironment.getProperty(key);
@@ -695,7 +695,7 @@ public abstract class InstanceKeyDataSou
* @param key the JNDI environment property to set.
* @param value the value assigned to specified JNDI environment property.
*/
- public void setJndiEnvironment(String key, String value) {
+ public void setJndiEnvironment(final String key, final String value) {
if (jndiEnvironment == null) {
jndiEnvironment = new Properties();
}
@@ -710,7 +710,7 @@ public abstract class InstanceKeyDataSou
* @param properties the JNDI environment property to set which will
* overwrite any current settings
*/
- void setJndiEnvironment(Properties properties) {
+ void setJndiEnvironment(final Properties properties) {
if (jndiEnvironment == null) {
jndiEnvironment = new Properties();
} else {
@@ -733,7 +733,7 @@ public abstract class InstanceKeyDataSou
* @param v Value to assign to loginTimeout.
*/
@Override
- public void setLoginTimeout(int v) {
+ public void setLoginTimeout(final int v) {
this.loginTimeout = v;
}
@@ -755,7 +755,7 @@ public abstract class InstanceKeyDataSou
* @param v Value to assign to logWriter.
*/
@Override
- public void setLogWriter(PrintWriter v) {
+ public void setLogWriter(final PrintWriter v) {
this.logWriter = v;
}
@@ -777,7 +777,7 @@ public abstract class InstanceKeyDataSou
* one row. If not specified, connections will be validated using
* {@link Connection#isValid(int)}.
*/
- public void setValidationQuery(String validationQuery) {
+ public void setValidationQuery(final String validationQuery) {
assertInitializationAllowed();
this.validationQuery = validationQuery;
}
@@ -794,7 +794,7 @@ public abstract class InstanceKeyDataSou
*
* @param validationQueryTimeout The new timeout in seconds
*/
- public void setValidationQueryTimeout(int validationQueryTimeout) {
+ public void setValidationQueryTimeout(final int validationQueryTimeout) {
this.validationQueryTimeout = validationQueryTimeout;
}
@@ -819,7 +819,7 @@ public abstract class InstanceKeyDataSou
*
* @param rollbackAfterValidation new property value
*/
- public void setRollbackAfterValidation(boolean rollbackAfterValidation) {
+ public void setRollbackAfterValidation(final boolean rollbackAfterValidation) {
assertInitializationAllowed();
this.rollbackAfterValidation = rollbackAfterValidation;
}
@@ -841,7 +841,7 @@ public abstract class InstanceKeyDataSou
* following methods is invoked: <code>getConnection, setLogwriter,
* setLoginTimeout, getLoginTimeout, getLogWriter.</code></p>
*/
- public void setMaxConnLifetimeMillis(long maxConnLifetimeMillis) {
+ public void setMaxConnLifetimeMillis(final long maxConnLifetimeMillis) {
this.maxConnLifetimeMillis = maxConnLifetimeMillis;
}
@@ -872,7 +872,7 @@ public abstract class InstanceKeyDataSou
*
*/
@Override
- public Connection getConnection(String username, String password)
+ public Connection getConnection(final String username, final String password)
throws SQLException {
if (instanceKey == null) {
throw new SQLException("Must set the ConnectionPoolDataSource "
@@ -972,7 +972,7 @@ public abstract class InstanceKeyDataSou
throws SQLException;
- private void closeDueToException(PooledConnectionAndInfo info) {
+ private void closeDueToException(final PooledConnectionAndInfo info) {
if (info != null) {
try {
info.getPooledConnection().getConnection().close();
@@ -987,7 +987,7 @@ public abstract class InstanceKeyDataSou
}
protected ConnectionPoolDataSource
- testCPDS(String username, String password)
+ testCPDS(final String username, final String password)
throws javax.naming.NamingException, SQLException {
// The source of physical db connections
ConnectionPoolDataSource cpds = this.dataSource;
Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSourceFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSourceFactory.java?rev=1729277&r1=1729276&r2=1729277&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSourceFactory.java (original)
+++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/InstanceKeyDataSourceFactory.java Mon Feb 8 21:58:41 2016
@@ -45,7 +45,7 @@ abstract class InstanceKeyDataSourceFact
private static final Map<String, InstanceKeyDataSource> instanceMap =
new ConcurrentHashMap<>();
- static synchronized String registerNewInstance(InstanceKeyDataSource ds) {
+ static synchronized String registerNewInstance(final InstanceKeyDataSource ds) {
int max = 0;
final Iterator<String> i = instanceMap.keySet().iterator();
while (i.hasNext()) {
@@ -65,7 +65,7 @@ abstract class InstanceKeyDataSourceFact
return instanceKey;
}
- static void removeInstance(String key) {
+ static void removeInstance(final String key) {
if (key != null) {
instanceMap.remove(key);
}
@@ -90,8 +90,8 @@ abstract class InstanceKeyDataSourceFact
* or PerUserPoolDataSource
*/
@Override
- public Object getObjectInstance(Object refObj, Name name,
- Context context, Hashtable<?,?> env)
+ public Object getObjectInstance(final Object refObj, final Name name,
+ final Context context, final Hashtable<?,?> env)
throws IOException, ClassNotFoundException {
// The spec says to return null if we can't create an instance
// of the reference
@@ -131,8 +131,8 @@ abstract class InstanceKeyDataSourceFact
return obj;
}
- private void setCommonProperties(Reference ref,
- InstanceKeyDataSource ikds)
+ private void setCommonProperties(final Reference ref,
+ final InstanceKeyDataSource ikds)
throws IOException, ClassNotFoundException {
RefAddr ra = ref.get("dataSourceName");
@@ -311,7 +311,7 @@ abstract class InstanceKeyDataSourceFact
/**
* used to set some properties saved within a Reference
*/
- protected static final Object deserialize(byte[] data)
+ protected static final Object deserialize(final byte[] data)
throws IOException, ClassNotFoundException {
ObjectInputStream in = null;
try {
Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/KeyedCPDSConnectionFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/KeyedCPDSConnectionFactory.java?rev=1729277&r1=1729276&r2=1729277&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/KeyedCPDSConnectionFactory.java (original)
+++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/datasources/KeyedCPDSConnectionFactory.java Mon Feb 8 21:58:41 2016
@@ -87,17 +87,17 @@ class KeyedCPDSConnectionFactory
* @param rollbackAfterValidation whether a rollback should be issued after
* {@link #validateObject validating} {@link Connection}s.
*/
- public KeyedCPDSConnectionFactory(ConnectionPoolDataSource cpds,
- String validationQuery,
- int validationQueryTimeout,
- boolean rollbackAfterValidation) {
+ public KeyedCPDSConnectionFactory(final ConnectionPoolDataSource cpds,
+ final String validationQuery,
+ final int validationQueryTimeout,
+ final boolean rollbackAfterValidation) {
_cpds = cpds;
_validationQuery = validationQuery;
_validationQueryTimeout = validationQueryTimeout;
_rollbackAfterValidation = rollbackAfterValidation;
}
- public void setPool(KeyedObjectPool<UserPassKey,PooledConnectionAndInfo> pool) {
+ public void setPool(final KeyedObjectPool<UserPassKey,PooledConnectionAndInfo> pool) {
this._pool = pool;
}
@@ -118,7 +118,7 @@ class KeyedCPDSConnectionFactory
* @see org.apache.commons.pool2.KeyedPooledObjectFactory#makeObject(java.lang.Object)
*/
@Override
- public synchronized PooledObject<PooledConnectionAndInfo> makeObject(UserPassKey upkey)
+ public synchronized PooledObject<PooledConnectionAndInfo> makeObject(final UserPassKey upkey)
throws Exception {
PooledConnectionAndInfo pci = null;
@@ -148,7 +148,7 @@ class KeyedCPDSConnectionFactory
* Closes the PooledConnection and stops listening for events from it.
*/
@Override
- public void destroyObject(UserPassKey key, PooledObject<PooledConnectionAndInfo> p)
+ public void destroyObject(final UserPassKey key, final PooledObject<PooledConnectionAndInfo> p)
throws Exception {
final PooledConnection pc = p.getObject().getPooledConnection();
pc.removeConnectionEventListener(this);
@@ -165,8 +165,8 @@ class KeyedCPDSConnectionFactory
* @return true if validation succeeds
*/
@Override
- public boolean validateObject(UserPassKey key,
- PooledObject<PooledConnectionAndInfo> p) {
+ public boolean validateObject(final UserPassKey key,
+ final PooledObject<PooledConnectionAndInfo> p) {
try {
validateLifetime(p);
} catch (final Exception e) {
@@ -223,14 +223,14 @@ class KeyedCPDSConnectionFactory
}
@Override
- public void passivateObject(UserPassKey key,
- PooledObject<PooledConnectionAndInfo> p) throws Exception {
+ public void passivateObject(final UserPassKey key,
+ final PooledObject<PooledConnectionAndInfo> p) throws Exception {
validateLifetime(p);
}
@Override
- public void activateObject(UserPassKey key,
- PooledObject<PooledConnectionAndInfo> p) throws Exception {
+ public void activateObject(final UserPassKey key,
+ final PooledObject<PooledConnectionAndInfo> p) throws Exception {
validateLifetime(p);
}
@@ -245,7 +245,7 @@ class KeyedCPDSConnectionFactory
* release this PooledConnection from our pool...
*/
@Override
- public void connectionClosed(ConnectionEvent event) {
+ public void connectionClosed(final ConnectionEvent event) {
final PooledConnection pc = (PooledConnection)event.getSource();
// if this event occurred because we were validating, or if this
// connection has been marked for removal, ignore it
@@ -277,7 +277,7 @@ class KeyedCPDSConnectionFactory
* not to be returned in the future
*/
@Override
- public void connectionErrorOccurred(ConnectionEvent event) {
+ public void connectionErrorOccurred(final ConnectionEvent event) {
final PooledConnection pc = (PooledConnection)event.getSource();
if (null != event.getSQLException()) {
System.err
@@ -310,7 +310,7 @@ class KeyedCPDSConnectionFactory
* are not affected and they will not be automatically closed on return to the pool.
*/
@Override
- public void invalidate(PooledConnection pc) throws SQLException {
+ public void invalidate(final PooledConnection pc) throws SQLException {
final PooledConnectionAndInfo info = pcMap.get(pc);
if (info == null) {
throw new IllegalStateException(NO_KEY_MESSAGE);
@@ -328,7 +328,7 @@ class KeyedCPDSConnectionFactory
* Does nothing. This factory does not cache user credentials.
*/
@Override
- public void setPassword(String password) {
+ public void setPassword(final String password) {
}
/**
@@ -338,7 +338,7 @@ class KeyedCPDSConnectionFactory
* @param maxConnLifetimeMillis A value of zero or less indicates an
* infinite lifetime. The default value is -1.
*/
- public void setMaxConnLifetimeMillis(long maxConnLifetimeMillis) {
+ public void setMaxConnLifetimeMillis(final long maxConnLifetimeMillis) {
this.maxConnLifetimeMillis = maxConnLifetimeMillis;
}
@@ -348,7 +348,7 @@ class KeyedCPDSConnectionFactory
* with the given user. This method is not currently used.
*/
@Override
- public void closePool(String username) throws SQLException {
+ public void closePool(final String username) throws SQLException {
try {
_pool.clear(new UserPassKey(username, null));
} catch (final Exception ex) {
@@ -356,7 +356,7 @@ class KeyedCPDSConnectionFactory
}
}
- private void validateLifetime(PooledObject<PooledConnectionAndInfo> p)
+ private void validateLifetime(final PooledObject<PooledConnectionAndInfo> p)
throws Exception {
if (maxConnLifetimeMillis > 0) {
final long lifetime = System.currentTimeMillis() - p.getCreateTime();