You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Da...@inventivedesigners.com on 2005/03/18 11:30:36 UTC
Problem with shutting down embedded ApacheDS
Hi,
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 RootNexus.java. 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.INITIAL_CONTEXT_FACTORY,
"org.apache.ldap.server.jndi.ServerContextFactory");
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
http://issues.apache.org/jira/browse/DIREVE-92?
Any suggestions for solving this?
- Removing the addShutdownHook in RootNexus?
- Making the close function thread-safe?
- ...
Thanks!
BTW: At this point we are using a 0.9 SNAPSHOT of the ApacheDS.
David.
--------------------------------------------------
Inventive Designers' Email Disclaimer:
http://www.inventivedesigners.com/email-disclaimer