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 ; 10 import java.util.Set ; 11 12 13 21 public class FooServer1 { 22 public FooServer1() { 23 } 24 25 public static void main(String [] args) { 26 TCPAddress addr = new TCPAddress("localhost", 9000); 27 TCPAddress sibling = new TCPAddress("localhost", 9001); 28 29 Set siblings = new HashSet (); 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 t) { 43 t.printStackTrace(); 44 } 45 } 46 } 47 | Popular Tags |