[jira] Closed: (DIRSERVER-323) EnvKeys.SHUTDOWN fails to work
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Apache Server configuration support > Apache Directory Project > [jira] Closed: (DIRSERVER-323) EnvKeys.SHUTDOWN fails to work




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    [jira] Closed: (DIRSERVER-323) EnvKeys.SHUTDOWN fails to work  
Emmanuel Lecharny (JIRA)


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-21-07 12:11 PM


[ https://issues.apache.org/jira/brow...ls:all-tabpanel ]

Emmanuel Lecharny closed DIRSERVER-323.
---------------------------------------


Closing all issues created in 2005 and before which are marked resolved

> EnvKeys.SHUTDOWN fails to work inside main() method
> ---------------------------------------------------
>
>                 Key: DIRSERVER-323
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-323
>             Project: Directory ApacheDS
>          Issue Type: Bug
>         Environment: WindowsXP SP2, Eclipse 3.1m5, JRE 1.5_02
>            Reporter: Robert Sanders
>         Assigned To: 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.e
xit() is called, not when EnvKeys.SHUTDOWN is used to create a DirContext.  Example 
cod
e:
> 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.S
erverContextFactory" );
> 		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.
-
You can reply to this email to add a comment to the issue online.







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 06:03 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register