Recently I worked on a server side project. And I noticed this snipet below :

public class DBConnection implements Connection {

private DBCConnectionPool pool;
private Connection conn;
public DBCConnection(Connection conn, DBCConnectionPool pool) {

I was very curious to see the reason for pool reference in a connection pool. I saw very interesting situation. Can you imagine to have a connection pool which stores DB connections. Also every connection invokes method of connection pool “return connection” with parameter “this” just to return itself to the connection pool. Actually method “return connection” invokes virtual method “release” to the same connection through the passed parameter “this”!

!!!!!!!!!!!!!!!!!!!!!!!!!!!!NO COMMENT!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Leave a Comment

Your email address will not be published. Required fields are marked *