[ 
https://issues.apache.org/jira/browse/DIRAPI-149?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Emmanuel Lecharny updated DIRAPI-149:
-------------------------------------
    Description: 
When creating a LdapNetworkConnection, a 'NioThread' is created as a 
'User-Thread' that handles network IO. This thread lives for as long as the 
connection is not closed.

If the connection is not closed this will prevent the JavaVM from terminating, 
which may be somewhat unexpected, since this behaviour is not explicitly 
documented.

My suggestion would be to change the io-Thread's type to be a 'daemon' thread. 
That way, not closing an LdapConnection would not prevent the JavaVM from 
terminating.

example code snippet:

{code}
  public static void main(String[] args) throws Exception
  {
    LdapConnectionConfig cfg = new LdapConnectionConfig();
    cfg.setLdapHost("myHost");
    cfg.setLdapPort(389);
    cfg.setName("myUser@myHost");
    cfg.setCredentials("myPassword");
    
   LdapConnection conn = new LdapNetworkConnection(cfg);
   conn.bind();

   //the JavaVM will never terminate, because the connection was not closed!
  }
{code}

  was:
When creating a LdapNetworkConnection, a 'NioThread' is created as a 
'User-Thread' that handles network IO. This thread lives for as long as the 
connection is not closed.

If the connection is not closed this will prevent the JavaVM from terminating, 
which may be somewhat unexpected, since this behaviour is not explicitly 
documented.

My suggestion would be to change the io-Thread's type to be a 'daemon' thread. 
That way, not closing an LdapConnection would not prevent the JavaVM from 
terminating.

example code snippet:

  public static void main(String[] args) throws Exception
  {
    LdapConnectionConfig cfg = new LdapConnectionConfig();
    cfg.setLdapHost("myHost");
    cfg.setLdapPort(389);
    cfg.setName("myUser@myHost");
    cfg.setCredentials("myPassword");
    
   LdapConnection conn = new LdapNetworkConnection(cfg);
   conn.bind();

   //the JavaVM will never terminate, because the connection was not closed!
  }



> LdapNetworkConnection should not create user-Threads
> ----------------------------------------------------
>
>                 Key: DIRAPI-149
>                 URL: https://issues.apache.org/jira/browse/DIRAPI-149
>             Project: Directory Client API
>          Issue Type: Bug
>    Affects Versions: 1.0.0-M18
>            Reporter: Christian Cwienk
>
> When creating a LdapNetworkConnection, a 'NioThread' is created as a 
> 'User-Thread' that handles network IO. This thread lives for as long as the 
> connection is not closed.
> If the connection is not closed this will prevent the JavaVM from 
> terminating, which may be somewhat unexpected, since this behaviour is not 
> explicitly documented.
> My suggestion would be to change the io-Thread's type to be a 'daemon' 
> thread. That way, not closing an LdapConnection would not prevent the JavaVM 
> from terminating.
> example code snippet:
> {code}
>   public static void main(String[] args) throws Exception
>   {
>     LdapConnectionConfig cfg = new LdapConnectionConfig();
>     cfg.setLdapHost("myHost");
>     cfg.setLdapPort(389);
>     cfg.setName("myUser@myHost");
>     cfg.setCredentials("myPassword");
>     
>    LdapConnection conn = new LdapNetworkConnection(cfg);
>    conn.bind();
>    //the JavaVM will never terminate, because the connection was not closed!
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to