psteitz commented on a change in pull request #42:
URL: https://github.com/apache/commons-dbcp/pull/42#discussion_r449927856



##########
File path: src/main/java/org/apache/commons/dbcp2/PoolableConnection.java
##########
@@ -124,6 +124,9 @@ public PoolableConnection(final Connection conn, final 
ObjectPool<PoolableConnec
     protected void passivate() throws SQLException {
         super.passivate();
         setClosedInternal(true);
+        if (getDelegateInternal() instanceof PoolingConnection) {
+            ((PoolingConnection) 
getDelegateInternal()).connectionReturnedToPool();
+        }
     }

Review comment:
       This is a little awkward.  I see now how my initial idea does not work.  
Implementing passivate in PoolingConnection would do nothing as it would never 
be called.  I was tempted to recommend that we change PoolableConnection 
passivate to cascade to its delegate, but the problem is the delegate could 
just be a Connection (physical).  So no way around this that I can see.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to