Return-Path: Delivered-To: apmail-directory-dev-archive@www.apache.org Received: (qmail 75373 invoked from network); 18 Mar 2005 10:30:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 18 Mar 2005 10:30:55 -0000 Received: (qmail 20544 invoked by uid 500); 18 Mar 2005 10:30:54 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 20409 invoked by uid 500); 18 Mar 2005 10:30:54 -0000 Mailing-List: contact dev-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Apache Directory Developers List" Delivered-To: mailing list dev@directory.apache.org Received: (qmail 20395 invoked by uid 500); 18 Mar 2005 10:30:54 -0000 Delivered-To: apmail-incubator-directory-dev@incubator.apache.org Received: (qmail 20391 invoked by uid 99); 18 Mar 2005 10:30:54 -0000 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=FORGED_RCVD_HELO,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from uu194-7-185-202.unknown.uunet.be (HELO inventivedesigners.be) (194.7.185.202) by apache.org (qpsmtpd/0.28) with SMTP; Fri, 18 Mar 2005 02:30:52 -0800 Received: (qmail 16304 invoked from network); 18 Mar 2005 10:30:49 -0000 Received: from doonix.intranet (HELO domino01.intranet) (10.0.0.238) by doonix.intranet with SMTP; 18 Mar 2005 10:30:49 -0000 To: directory-dev@incubator.apache.org Subject: Problem with shutting down embedded ApacheDS MIME-Version: 1.0 X-Mailer: Lotus Notes Release 6.5.3 September 14, 2004 Message-ID: From: David_Geleyn@inventivedesigners.com Date: Fri, 18 Mar 2005 11:30:36 +0100 X-MIMETrack: Serialize by Router on Domino01/Inventive Designers(Release 6.0.1|February 07, 2003) at 03/18/2005 11:30:48 AM, Serialize complete at 03/18/2005 11:30:48 AM Content-Type: text/plain; charset="US-ASCII" X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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