KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > ubik > rmi > examples > replication > FooServer1


1 package org.sapia.ubik.rmi.examples.replication;
2
3 import org.sapia.ubik.net.TCPAddress;
4 import org.sapia.ubik.rmi.examples.Foo;
5 import org.sapia.ubik.rmi.examples.UbikFoo;
6 import org.sapia.ubik.rmi.replication.ReplicationEvent;
7 import org.sapia.ubik.rmi.server.Hub;
8
9 import java.util.HashSet JavaDoc;
10 import java.util.Set JavaDoc;
11
12
13 /**
14  * @author Yanick Duchesne
15  * <dl>
16  * <dt><b>Copyright:</b><dd>Copyright &#169; 2002-2004 <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 FooServer1 {
22   public FooServer1() {
23   }
24
25   public static void main(String JavaDoc[] args) {
26     TCPAddress addr = new TCPAddress("localhost", 9000);
27     TCPAddress sibling = new TCPAddress("localhost", 9001);
28
29     Set JavaDoc siblings = new HashSet JavaDoc();
30     siblings.add(sibling);
31
32     try {
33       Foo f = new UbikFoo();
34       ServerSideInterceptor serverSide = new ServerSideInterceptor(siblings, f);
35       Hub.serverRuntime.addInterceptor(ReplicationEvent.class, serverSide);
36
37       Hub.exportObject(f, addr.getPort());
38
39       while (true) {
40         Thread.sleep(100000);
41       }
42     } catch (Throwable JavaDoc t) {
43       t.printStackTrace();
44     }
45   }
46 }
47
Popular Tags