Return-Path: Delivered-To: apmail-incubator-directory-dev-archive@www.apache.org Received: (qmail 93939 invoked from network); 16 Mar 2005 03:00:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 16 Mar 2005 03:00:27 -0000 Received: (qmail 87948 invoked by uid 500); 16 Mar 2005 03:00:26 -0000 Delivered-To: apmail-incubator-directory-dev-archive@incubator.apache.org Received: (qmail 87893 invoked by uid 500); 16 Mar 2005 03:00:26 -0000 Mailing-List: contact directory-dev-help@incubator.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 directory-dev@incubator.apache.org Received: (qmail 87880 invoked by uid 99); 16 Mar 2005 03:00:26 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from ajax-1.apache.org (HELO ajax.apache.org) (192.87.106.226) by apache.org (qpsmtpd/0.28) with ESMTP; Tue, 15 Mar 2005 19:00:24 -0800 Received: from ajax.apache.org (ajax.apache.org [127.0.0.1]) by ajax.apache.org (8.12.11/8.12.11) with ESMTP id j2G30LI1032173 for ; Wed, 16 Mar 2005 04:00:21 +0100 Message-ID: <1963979738.1110942021798.JavaMail.jira@ajax.apache.org> Date: Wed, 16 Mar 2005 04:00:21 +0100 (CET) From: "Phil Steitz (JIRA)" To: directory-dev@incubator.apache.org Subject: [jira] Assigned: (DIREVE-146) EnvKeys.SHUTDOWN fails to work inside main() method In-Reply-To: <1847632337.1110941360845.JavaMail.jira@ajax.apache.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/DIREVE-146?page=history ] Phil Steitz reassigned DIREVE-146: ---------------------------------- Assign To: Alex Karasulu (was: Phil Steitz) > EnvKeys.SHUTDOWN fails to work inside main() method > --------------------------------------------------- > > Key: DIREVE-146 > URL: http://issues.apache.org/jira/browse/DIREVE-146 > Project: Directory Server > Type: Bug > Components: server main > Environment: WindowsXP SP2, Eclipse 3.1m5, JRE 1.5_02 > Reporter: Robert Sanders > Assignee: Alex Karasulu > Priority: Minor > > While the JUnit test code works correctly, when using a main() method to create an instance of the directory server via JNDI, then server is only shutdown if System.exit() is called, not when EnvKeys.SHUTDOWN is used to create a DirContext. Example code: > public class Ldap2 { > > private Hashtable env = new Hashtable(); > public Ldap2() { > env.put( Context.PROVIDER_URL, "ou=system" ); > env.put( Context.INITIAL_CONTEXT_FACTORY, "org.apache.ldap.server.jndi.ServerContextFactory" ); > env.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" ); > env.put( Context.SECURITY_CREDENTIALS, "secret" ); > } > > /** > * @param args > */ > public static void main(String[] args) throws Exception { > Ldap2 ldap = new Ldap2(); > ldap.run(); > } > > private void run() throws Exception { > DirContext ctx = new InitialDirContext( env ); > try { > System.out.println( ctx ); > String key = null; > NamingEnumeration list = ctx.list(""); > while (list.hasMore()) { > NameClassPair nc = (NameClassPair)list.next(); > System.out.println( nc ); > } > > ctx.close(); > ctx = null; > } finally { > Hashtable closeEnv = new Hashtable(env); > closeEnv.put(EnvKeys.SHUTDOWN , ""); > new InitialDirContext( closeEnv ); > //System.exit(0); > } > } > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira