1 26 27 package org.objectweb.benchmark.fractal.latency; 28 29 import java.util.HashMap ; 31 import java.util.Map ; 32 import java.util.Properties ; 33 34 import org.objectweb.fractal.adl.Factory; 35 import org.objectweb.fractal.adl.FactoryFactory; 36 import org.objectweb.fractal.api.Component; 37 import org.objectweb.fractal.rmi.registry.NamingService; 38 import org.objectweb.fractal.rmi.registry.Registry; 39 import org.objectweb.fractal.util.Fractal; 40 41 50 public class ClientLauncher 51 { 52 public static void main(String [] args) 53 { 54 String name = "org.objectweb.benchmark.fractal.latency.Latency"; 55 NamingService ns = null; 56 Component client = null; 57 Properties properties = new Properties (); 58 String host = null; 59 60 try { 62 java.io.InputStream propStream = null; 63 64 propStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("benchmark.properties"); 66 properties.load(propStream); 67 host = properties.getProperty("com.host"); 68 } catch (Exception e) { 69 e.printStackTrace(); 70 } 71 72 try{ 74 System.setSecurityManager(new SecurityManager ()); 75 76 ns = Registry.getRegistry(host); 77 78 Map context = new HashMap (); 79 context.put("remote-node", ns.lookup("PingServer")); 80 81 Factory f = FactoryFactory.getFactory(FactoryFactory.FRACTAL_BACKEND); 82 client = (Component) f.newComponent(name, context); 83 84 Fractal.getLifeCycleController(client).startFc(); 86 Runnable r = (Runnable ) client.getFcInterface("Runnable"); 87 r.run(); 88 Fractal.getLifeCycleController(client).stopFc(); 89 System.out.println("Client stopped"); 90 }catch(Exception ex){ 91 ex.printStackTrace(); 92 } 93 } 94 } 95 | Popular Tags |