commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1547625 - in /commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2: DelegatingConnection.java PoolableConnection.java PoolablePreparedStatement.java PoolingConnection.java PoolingDataSource.java managed/ManagedConnection.java
Date Tue, 03 Dec 2013 22:44:39 GMT
Author: markt
Date: Tue Dec  3 22:44:38 2013
New Revision: 1547625

URL: http://svn.apache.org/r1547625
Log:
More work to address generics warnings

Modified:
    commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/DelegatingConnection.java
    commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolableConnection.java
    commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolablePreparedStatement.java
    commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolingConnection.java
    commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolingDataSource.java
    commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/managed/ManagedConnection.java

Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/DelegatingConnection.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/DelegatingConnection.java?rev=1547625&r1=1547624&r2=1547625&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/DelegatingConnection.java
(original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/DelegatingConnection.java
Tue Dec  3 22:44:38 2013
@@ -138,7 +138,7 @@ public class DelegatingConnection<C exte
      * Returns my underlying {@link Connection}.
      * @return my underlying {@link Connection}.
      */
-    public Connection getDelegate() {
+    public C getDelegate() {
         return getDelegateInternal();
     }
 

Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolableConnection.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolableConnection.java?rev=1547625&r1=1547624&r2=1547625&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolableConnection.java (original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolableConnection.java Tue
Dec  3 22:44:38 2013
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,7 +31,7 @@ import org.apache.commons.pool2.ObjectPo
  * @author James House
  * @version $Revision$ $Date$
  */
-public class PoolableConnection extends DelegatingConnection {
+public class PoolableConnection extends DelegatingConnection<Connection> {
     /** The pool to which I should return. */
     // TODO: Correct use of the pool requires that this connection is only every returned
to the pool once.
     protected ObjectPool<PoolableConnection> _pool = null;

Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolablePreparedStatement.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolablePreparedStatement.java?rev=1547625&r1=1547624&r2=1547625&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolablePreparedStatement.java
(original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolablePreparedStatement.java
Tue Dec  3 22:44:38 2013
@@ -61,7 +61,7 @@ public class PoolablePreparedStatement<K
      */
     public PoolablePreparedStatement(PreparedStatement stmt, K key,
             KeyedObjectPool<K, PoolablePreparedStatement<K,S>> pool,
-            DelegatingConnection conn) {
+            DelegatingConnection<?> conn) {
         super(conn, stmt);
         _pool = pool;
         _key = key;

Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolingConnection.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolingConnection.java?rev=1547625&r1=1547624&r2=1547625&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolingConnection.java (original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolingConnection.java Tue
Dec  3 22:44:38 2013
@@ -45,7 +45,7 @@ import org.apache.commons.pool2.impl.Def
  * @author Dirk Verbeeck
  * @version $Revision$ $Date$
  */
-public class PoolingConnection extends DelegatingConnection
+public class PoolingConnection extends DelegatingConnection<Connection>
         implements KeyedPooledObjectFactory<PStmtKey,DelegatingPreparedStatement> {
 
     /** Pool of {@link PreparedStatement}s. and {@link CallableStatement}s */

Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolingDataSource.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolingDataSource.java?rev=1547625&r1=1547624&r2=1547625&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolingDataSource.java (original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolingDataSource.java Tue
Dec  3 22:44:38 2013
@@ -108,11 +108,11 @@ public class PoolingDataSource<C extends
     @Override
     public Connection getConnection() throws SQLException {
         try {
-            Connection conn = _pool.borrowObject();
-            if (conn != null) {
-                conn = new PoolGuardConnectionWrapper(conn);
+            C conn = _pool.borrowObject();
+            if (conn == null) {
+                return null;
             }
-            return conn;
+            return  new PoolGuardConnectionWrapper<>(conn);
         } catch(SQLException e) {
             throw e;
         } catch(NoSuchElementException e) {
@@ -181,9 +181,10 @@ public class PoolingDataSource<C extends
      * PoolGuardConnectionWrapper is a Connection wrapper that makes sure a
      * closed connection cannot be used anymore.
      */
-    private class PoolGuardConnectionWrapper extends DelegatingConnection {
+    private class PoolGuardConnectionWrapper<D extends Connection>
+            extends DelegatingConnection<D> {
 
-        PoolGuardConnectionWrapper(Connection delegate) {
+        PoolGuardConnectionWrapper(D delegate) {
             super(delegate);
         }
 
@@ -191,7 +192,7 @@ public class PoolingDataSource<C extends
          * @see org.apache.commons.dbcp2.DelegatingConnection#getDelegate()
          */
         @Override
-        public Connection getDelegate() {
+        public D getDelegate() {
             if (isAccessToUnderlyingConnectionAllowed()) {
                 return super.getDelegate();
             } else {

Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/managed/ManagedConnection.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/managed/ManagedConnection.java?rev=1547625&r1=1547624&r2=1547625&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/managed/ManagedConnection.java
(original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/managed/ManagedConnection.java
Tue Dec  3 22:44:38 2013
@@ -255,7 +255,7 @@ public class ManagedConnection<C extends
     }
 
     @Override
-    public Connection getDelegate() {
+    public C getDelegate() {
         if (isAccessToUnderlyingConnectionAllowed()) {
             return getDelegateInternal();
         } else {



Mime
View raw message