bdemers commented on code in PR #79:
URL: https://github.com/apache/directory-ldap-api/pull/79#discussion_r1498516680


##########
ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapConnectionPool.java:
##########
@@ -123,6 +123,10 @@ public LdapConnection getConnection() throws LdapException
         try
         {
             connection = super.borrowObject();
+            if ( connection instanceof PooledLdapConnection )
+            {
+                ( ( PooledLdapConnection ) connection ).setConnectionPool( 
this );
+            }

Review Comment:
   I ran into a chicken and egg problem with the pooled connection, so this was 
the work around...
   
   Ideally I'd want to pass the pool in the constructor of the 
`LdapConnectionFactory`, but that itself is passed indirectly into the 
`AbstractPoolableLdapConnectionFactory`
   
   An alternative, _might_ be to have the `LdapConnectionPool`'s constructor 
inspect the type `PooledObjectFactory`, if it's a 
`AbstractPoolableLdapConnectionFactory`, the connection factory could be 
wrapped 🤔
   Similar solution, different location 🤷 



-- 
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.

To unsubscribe, e-mail: [email protected]

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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to