Re: Can't close connection used for pool creation in LDAP JAVA SDK 4.17

Carlos Sánchez <[email protected]>
Newsgroups gmane.comp.mozilla.devel.directory
Message-ID <[email protected]>
Hi,

    I think I have found a solution for this issue, just in case anyone 
needs it. First thing I did was to change from version 4.17 to 4.18 but 
the issue was still there.

    The problem is when you call the destroy() method in the 
ConnectionPool class. This method only close the connections in the pool 
but no the original connection used to create it (all the connections in 
the pool are clones).

    Closing that original connection seems to solve the problem. HEre is 
the modified method:

      /**
      * Destroy the whole pool - called during a shutdown
      */
     public void destroy() {
         for ( int i = 0; i < pool.size(); i++ ) {
             disconnect(
                 (LDAPConnectionObject)pool.elementAt(i) );
         }
         pool.removeAllElements();
         //Disconnect the connection used as a template
         if (ldc.isConnected())
             try {
                 ldc.disconnect();
             } catch (LDAPException e) {}
     }

Cheers,

Carlos.

Carlos Sánchez escribió:
> Hi,
> 
>    In my app I need to create an LDAPv3 connections pool. As default 
> protocol version is 2 I have to create the pool creating a connection 
> setting the version to 3 and use that connection to create the pool. 
> This works fine.
> 
>    The problem is when the application want to destroy the pool. I can 
> actually destroy the pool and all its connections get closed but I can't 
> disconnect the first connection created to set the protocol version...I 
> call disconnect() method and don't get any exception but the connection 
> remains open.
> 
>    I have tried to close the connection just after create the pool with 
> the same results. Any idea?
> 
> Thanks in advance,
> 
> Carlos.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.