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 FooServer2 { 22 public FooServer2() { 23 } 24 25 public static void main(String [] args) { 26 TCPAddress addr = new TCPAddress("localhost", 9001); 27 TCPAddress sibling = new TCPAddress("localhost", 9000); 28 29 Set siblings = new HashSet (); 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 t) { 44 t.printStackTrace(); 45 } 46 } 47 } 48 | Popular Tags |