directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Problem with shutting down embedded ApacheDS
Date Fri, 18 Mar 2005 10:30:36 GMT

When shutting down our server (which embeds Apache Directory Server) we 
have some problems with shutting down the embeded LDAP server. One of the 
reasons could be the addShutdownhook in When embedding the 
server we need to add a shutdownhook ourselves to make sure the LDAP 
server is gracefully shutdown (see code below). Among other things, the 
shutdown of the embedded LDAP server seems to call the sync on the 
RootNexus as well, causing an IllegalStateException as 2 separate threads 
are accessing the RootNexus.

Java API for System.exit:
The virtual machine's shutdown sequence consists of two phases. In the 
first phase all registered shutdown hooks, if any, are started in some 
unspecified order and allowed to run concurrently until they finish. 

Example of shutting down (which is a part of our shutdownhook):
Properties env = new Properties();
env.setProperty(Context.PROVIDER_URL, "ou=system");
env.setProperty(Context.SECURITY_PRINCIPAL, "uid=admin,ou=system");
env.setProperty(Context.SECURITY_CREDENTIALS, "secret");
env.setProperty(EnvKeys.SYNC, "true");
env.setProperty(EnvKeys.SHUTDOWN, "true");
new InitialDirContext(env);

Maybe this is caused by the soluttion for bug report

Any suggestions for solving this?
- Removing the addShutdownHook in RootNexus?
- Making the close function thread-safe?
- ...


BTW: At this point we are using a 0.9 SNAPSHOT of the ApacheDS.


Inventive Designers' Email Disclaimer:

View raw message