KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > ubik > rmi > examples > ReliableFoo


1 package org.sapia.ubik.rmi.examples;
2
3 import org.sapia.ubik.rmi.naming.remote.RemoteInitialContextFactory;
4 import org.sapia.ubik.rmi.server.Log;
5
6 import java.rmi.RemoteException JavaDoc;
7
8 import java.util.Properties JavaDoc;
9
10 import javax.naming.*;
11
12
13 /**
14  * @author Yanick Duchesne
15  * <dl>
16  * <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>
17  * <dt><b>License:</b><dd>Read the license.txt file of the jar or visit the
18  * <a HREF="http://www.sapia-oss.org/license.html">license page</a> at the Sapia OSS web site</dd></dt>
19  * </dl>
20  */

21 public class ReliableFoo implements Foo {
22   public ReliableFoo() throws java.rmi.RemoteException JavaDoc {
23   }
24
25   /**
26    * @see org.sapia.ubik.rmi.Foo#getBar()
27    */

28   public Bar getBar() throws RemoteException JavaDoc {
29     return new UbikBar();
30   }
31
32   public static void main(String JavaDoc[] args) {
33     try {
34       Log.setWarning();
35
36       //PerfAnalyzer.getInstance().setEnabled(true);
37
Properties JavaDoc props = new Properties JavaDoc();
38       props.setProperty(InitialContext.PROVIDER_URL, "ubik://localhost:1099/");
39       props.setProperty(InitialContext.INITIAL_CONTEXT_FACTORY,
40         RemoteInitialContextFactory.class.getName());
41
42       //props.setProperty(RemoteInitialContextFactory.UBIK_DOMAIN_NAME, "yan");
43
InitialContext ctx = new InitialContext(props);
44
45       ctx.rebind("Foo", new ReliableFoo());
46
47       System.out.println("ReliableFoo started...");
48
49       while (true) {
50         Thread.sleep(10000);
51       }
52     } catch (Throwable JavaDoc t) {
53       t.printStackTrace();
54     }
55   }
56 }
57
Popular Tags