KickJava   Java API By Example, From Geeks To Geeks.

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


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 FooServer2 {
22   public FooServer2() {
23   }
24
25   public static void main(String JavaDoc[] args) {
26     TCPAddress addr = new TCPAddress("localhost", 9001);
27     TCPAddress sibling = new TCPAddress("localhost", 9000);
28
29     Set JavaDoc siblings = new HashSet JavaDoc();
30     siblings.add(sibling);
31
32     try {
33       Foo f = new UbikFoo();
34
35       ServerSideInterceptor serverSide = new ServerSideInterceptor(siblings, f);
36       Hub.serverRuntime.addInterceptor(ReplicationEvent.class, serverSide);
37
38       Hub.exportObject(f, addr.getPort());
39
40       while (true) {
41         Thread.sleep(100000);
42       }
43     } catch (Throwable JavaDoc t) {
44       t.printStackTrace();
45     }
46   }
47 }
48
Popular Tags