It seems to forward the call from this.activate() to the delegee 
("this.connection.activate()"). So  this is not a endless recursion by itself  
(unless "this.connection" points back to "this" or to a chain of delegated 
connections looping back to itself. Both should not be the case normally.

I am not sure how often this.connection is actually another delegation 
(instanceof), so it might not be called often anyway.

Gruss
Bernd


--
http://bernd.eckenfels.net
________________________________
Von: shi feng qiang <shanbeirens...@163.com>
Gesendet: Tuesday, April 14, 2020 4:33:35 AM
An: user@commons.apache.org <user@commons.apache.org>
Betreff: commons-dbcp2 source code read

I amd reading code of commons-dbcp2 source, but a piece of codes confused me.
That is  
https://github.com/apache/commons-dbcp/blob/master/src/main/java/org/apache/commons/dbcp2/DelegatingConnection.java
 of DelegatingConnection.java .


    protected void activate() {
        closed = false;
        setLastUsed();
        if (connection instanceof DelegatingConnection) {
            ((DelegatingConnection<?>) connection).activate();// 615 todo this 
line
}
    }

((DelegatingConnection<?>) connection).activate();
can this call occur infinite recursive?

best regards!

Reply via email to