1 package org.sapia.ubik.rmi.examples; 2 3 import org.sapia.ubik.rmi.naming.remote.RemoteInitialContextFactory; 4 5 import java.util.Properties ; 6 7 import javax.naming.InitialContext ; 8 9 10 18 public class LoadBalanceEg { 19 22 public LoadBalanceEg() { 23 super(); 24 } 25 26 public static void main(String [] args) { 27 try { 28 Properties props = new Properties (); 29 props.setProperty(InitialContext.PROVIDER_URL, "ubik://localhost:1099"); 30 props.setProperty(InitialContext.INITIAL_CONTEXT_FACTORY, 31 RemoteInitialContextFactory.class.getName()); 32 33 InitialContext ctx = new InitialContext (props); 34 35 Foo f = (Foo) ctx.lookup("Foo"); 36 37 while (true) { 38 System.out.println(f.getBar().getMsg()); 39 Thread.sleep(1000); 40 } 41 } catch (Exception e) { 42 e.printStackTrace(); 43 } 44 } 45 } 46 | Popular Tags |