Re: commons-dbcp2 source code read

2020-04-14 Thread Bernd Eckenfels
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 
Gesendet: Tuesday, April 14, 2020 4:33:35 AM
An: 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!


commons-dbcp2 source code read

2020-04-14 Thread shi feng qiang
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!