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 ; 7 8 import java.util.Properties ; 9 10 import javax.naming.*; 11 12 13 21 public class ReliableFoo implements Foo { 22 public ReliableFoo() throws java.rmi.RemoteException { 23 } 24 25 28 public Bar getBar() throws RemoteException { 29 return new UbikBar(); 30 } 31 32 public static void main(String [] args) { 33 try { 34 Log.setWarning(); 35 36 Properties props = new Properties (); 38 props.setProperty(InitialContext.PROVIDER_URL, "ubik://localhost:1099/"); 39 props.setProperty(InitialContext.INITIAL_CONTEXT_FACTORY, 40 RemoteInitialContextFactory.class.getName()); 41 42 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 t) { 53 t.printStackTrace(); 54 } 55 } 56 } 57 | Popular Tags |