commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1572042 - in /commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2: PoolablePreparedStatement.java cpdsadapter/DriverAdapterCPDS.java cpdsadapter/PoolablePreparedStatementStub.java cpdsadapter/PooledConnectionImpl.java
Date Wed, 26 Feb 2014 13:15:58 GMT
Author: markt
Date: Wed Feb 26 13:15:58 2014
New Revision: 1572042

URL: http://svn.apache.org/r1572042
Log:
Remove unnecessary code identified by PMD

Removed:
    commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/cpdsadapter/PoolablePreparedStatementStub.java
Modified:
    commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolablePreparedStatement.java
    commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/cpdsadapter/DriverAdapterCPDS.java
    commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/cpdsadapter/PooledConnectionImpl.java

Modified: commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolablePreparedStatement.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolablePreparedStatement.java?rev=1572042&r1=1572041&r2=1572042&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolablePreparedStatement.java
(original)
+++ commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolablePreparedStatement.java
Wed Feb 26 13:15:58 2014
@@ -31,7 +31,6 @@ import org.apache.commons.pool2.KeyedObj
  * My {@link #close} method returns me to my containing pool. (See {@link PoolingConnection}.)
  *
  * @param <K> the key type
- * @param <S> the statement type
  *
  * @see PoolingConnection
  * @author Rodney Waldhoff
@@ -40,12 +39,11 @@ import org.apache.commons.pool2.KeyedObj
  * @author Dirk Verbeeck
  * @version $Revision$ $Date$
  */
-public class PoolablePreparedStatement<K, S extends PoolablePreparedStatement<K,S>>
-        extends DelegatingPreparedStatement {
+public class PoolablePreparedStatement<K> extends DelegatingPreparedStatement {
     /**
      * The {@link KeyedObjectPool} from which I was obtained.
      */
-    private final KeyedObjectPool<K, PoolablePreparedStatement<K,S>> _pool;
+    private final KeyedObjectPool<K,PoolablePreparedStatement<K>> _pool;
 
     /**
      * My "key" as used by {@link KeyedObjectPool}.
@@ -62,7 +60,7 @@ public class PoolablePreparedStatement<K
      * @param conn the {@link java.sql.Connection Connection} from which I was created
      */
     public PoolablePreparedStatement(PreparedStatement stmt, K key,
-            KeyedObjectPool<K, PoolablePreparedStatement<K,S>> pool,
+            KeyedObjectPool<K, PoolablePreparedStatement<K>> pool,
             DelegatingConnection<?> conn) {
         super(conn, stmt);
         _pool = pool;

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=1572042&r1=1572041&r2=1572042&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
Wed Feb 26 13:15:58 2014
@@ -192,7 +192,7 @@ public class DriverAdapterCPDS
             }
             pci.setAccessToUnderlyingConnectionAllowed(isAccessToUnderlyingConnectionAllowed());
         }
-        KeyedObjectPool<PStmtKeyCPDS, PoolablePreparedStatement<PStmtKeyCPDS, PoolablePreparedStatementStub>>
stmtPool = null;
+        KeyedObjectPool<PStmtKeyCPDS, PoolablePreparedStatement<PStmtKeyCPDS>>
stmtPool = null;
         if (isPoolPreparedStatements()) {
             GenericKeyedObjectPoolConfig config = new GenericKeyedObjectPoolConfig();
             config.setMaxTotalPerKey(Integer.MAX_VALUE);

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=1572042&r1=1572041&r2=1572042&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
Wed Feb 26 13:15:58 2014
@@ -42,7 +42,7 @@ import org.apache.commons.pool2.impl.Def
  * @version $Revision$ $Date$
  */
 class PooledConnectionImpl implements PooledConnection,
-        KeyedPooledObjectFactory<PStmtKeyCPDS,PoolablePreparedStatement<PStmtKeyCPDS,PoolablePreparedStatementStub>>
{
+        KeyedPooledObjectFactory<PStmtKeyCPDS,PoolablePreparedStatement<PStmtKeyCPDS>>
{
 
     private static final String CLOSED
             = "Attempted to use PooledConnection after closed() was called.";
@@ -79,7 +79,7 @@ class PooledConnectionImpl implements Po
     private boolean isClosed;
 
     /** My pool of {*link PreparedStatement}s. */
-    private KeyedObjectPool<PStmtKeyCPDS, PoolablePreparedStatement<PStmtKeyCPDS, PoolablePreparedStatementStub>>
pstmtPool = null;
+    private KeyedObjectPool<PStmtKeyCPDS, PoolablePreparedStatement<PStmtKeyCPDS>>
pstmtPool = null;
 
     /**
      * Controls access to the underlying connection
@@ -102,7 +102,7 @@ class PooledConnectionImpl implements Po
     }
 
     public void setStatementPool(
-            KeyedObjectPool<PStmtKeyCPDS, PoolablePreparedStatement<PStmtKeyCPDS, PoolablePreparedStatementStub>>
statementPool) {
+            KeyedObjectPool<PStmtKeyCPDS, PoolablePreparedStatement<PStmtKeyCPDS>>
statementPool) {
         pstmtPool = statementPool;
     }
 
@@ -419,7 +419,7 @@ class PooledConnectionImpl implements Po
      * @param key the key for the {*link PreparedStatement} to be created
      */
     @Override
-    public PooledObject<PoolablePreparedStatement<PStmtKeyCPDS,PoolablePreparedStatementStub>>
makeObject(PStmtKeyCPDS key) throws Exception {
+    public PooledObject<PoolablePreparedStatement<PStmtKeyCPDS>> makeObject(PStmtKeyCPDS
key) throws Exception {
         if (null == key) {
             throw new IllegalArgumentException();
         }
@@ -427,23 +427,20 @@ class PooledConnectionImpl implements Po
         if (null == key.getResultSetType()
                 && null == key.getResultSetConcurrency()) {
             if (null == key.getAutoGeneratedKeys()) {
-                return new DefaultPooledObject<PoolablePreparedStatement<PStmtKeyCPDS,PoolablePreparedStatementStub>>(
-                        new PoolablePreparedStatementStub(
-                                connection.prepareStatement(key.getSql()),
-                                key, pstmtPool, delegatingConnection));
+                return new DefaultPooledObject<>(new PoolablePreparedStatement<>(
+                        connection.prepareStatement(key.getSql()),
+                        key, pstmtPool, delegatingConnection));
             }
-            return new DefaultPooledObject<PoolablePreparedStatement<PStmtKeyCPDS,PoolablePreparedStatementStub>>(
-                    new PoolablePreparedStatementStub(
+            return new DefaultPooledObject<>(new PoolablePreparedStatement<>(
                             connection.prepareStatement(key.getSql(),
                                     key.getAutoGeneratedKeys().intValue()),
                             key, pstmtPool, delegatingConnection));
         }
-        return new DefaultPooledObject<PoolablePreparedStatement<PStmtKeyCPDS,PoolablePreparedStatementStub>>(
-                new PoolablePreparedStatementStub(
-                        connection.prepareStatement(key.getSql(),
-                                key.getResultSetType().intValue(),
-                                key.getResultSetConcurrency().intValue()),
-                                key, pstmtPool, delegatingConnection));
+        return new DefaultPooledObject<>(new PoolablePreparedStatement<>(
+                connection.prepareStatement(key.getSql(),
+                        key.getResultSetType().intValue(),
+                        key.getResultSetConcurrency().intValue()),
+                        key, pstmtPool, delegatingConnection));
     }
 
     /**
@@ -454,7 +451,7 @@ class PooledConnectionImpl implements Po
      */
     @Override
     public void destroyObject(PStmtKeyCPDS key,
-            PooledObject<PoolablePreparedStatement<PStmtKeyCPDS,PoolablePreparedStatementStub>>
p)
+            PooledObject<PoolablePreparedStatement<PStmtKeyCPDS>> p)
             throws Exception {
         p.getObject().getInnermostDelegate().close();
     }
@@ -468,7 +465,7 @@ class PooledConnectionImpl implements Po
      */
     @Override
     public boolean validateObject(PStmtKeyCPDS key,
-            PooledObject<PoolablePreparedStatement<PStmtKeyCPDS,PoolablePreparedStatementStub>>
p) {
+            PooledObject<PoolablePreparedStatement<PStmtKeyCPDS>> p) {
         return true;
     }
 
@@ -480,7 +477,7 @@ class PooledConnectionImpl implements Po
      */
     @Override
     public void activateObject(PStmtKeyCPDS key,
-            PooledObject<PoolablePreparedStatement<PStmtKeyCPDS,PoolablePreparedStatementStub>>
p)
+            PooledObject<PoolablePreparedStatement<PStmtKeyCPDS>> p)
             throws Exception {
         p.getObject().activate();
     }
@@ -493,9 +490,9 @@ class PooledConnectionImpl implements Po
      */
     @Override
     public void passivateObject(PStmtKeyCPDS key,
-            PooledObject<PoolablePreparedStatement<PStmtKeyCPDS,PoolablePreparedStatementStub>>
p)
+            PooledObject<PoolablePreparedStatement<PStmtKeyCPDS>> p)
             throws Exception {
-        PoolablePreparedStatement<PStmtKeyCPDS,PoolablePreparedStatementStub> ppss
= p.getObject();
+        PoolablePreparedStatement<PStmtKeyCPDS> ppss = p.getObject();
         ppss.clearParameters();
         ppss.passivate();
     }



Mime
View raw message