KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > ubik > rmi > examples > jndi > JndiDiscoveryEg


1 package org.sapia.ubik.rmi.examples.jndi;
2
3 import org.sapia.ubik.rmi.naming.remote.discovery.DiscoveryHelper;
4 import org.sapia.ubik.rmi.naming.remote.discovery.JndiDiscoListener;
5
6 import javax.naming.Context JavaDoc;
7
8
9 /**
10  * @author Yanick Duchesne
11  * <dl>
12  * <dt><b>Copyright:</b><dd>Copyright &#169; 2002-2003 <a HREF="http://www.sapia-oss.org">Sapia Open Source Software</a>. All Rights Reserved.</dd></dt>
13  * <dt><b>License:</b><dd>Read the license.txt file of the jar or visit the
14  * <a HREF="http://www.sapia-oss.org/license.html">license page</a> at the Sapia OSS web site</dd></dt>
15  * </dl>
16  */

17 public class JndiDiscoveryEg {
18   public static void main(String JavaDoc[] args) {
19     try {
20       DiscoveryHelper helper = new DiscoveryHelper("default");
21
22       System.out.println("Waiting for JNDI...");
23
24       final JndiDiscoListener listener = new JndiDiscoListener() {
25           public void onJndiDiscovered(Context JavaDoc ctx) {
26             System.out.println("Discovered!!!!");
27           }
28         };
29
30       helper.addJndiDiscoListener(listener);
31
32       while (true) {
33         Thread.sleep(100000);
34       }
35     } catch (Exception JavaDoc e) {
36       e.printStackTrace();
37     }
38   }
39 }
40
Popular Tags