1 23 24 package rmi.clt; 25 26 import org.objectweb.fractal.api.control.BindingController; 27 28 public class ClientImpl implements Main, BindingController { 29 30 private Service service; 31 32 public ClientImpl () { 33 System.err.println("CLIENT CREATED"); 34 } 35 36 public void main (final String [] args) { 37 service.print("hello world"); 38 int l = 0; 40 float n = 0; 41 float total = 0; 42 while (true) { 43 long t = System.currentTimeMillis(); 44 for (int i = 0; i < 10000; ++i) { 45 service.init(); 46 } 47 float d = System.currentTimeMillis() - t; 48 ++l; 49 if (l > 5) { 50 d = d/10000f; 51 n = n + 1; 52 total = total + d; 53 System.err.println( 54 "empty remote method call: " + d + " ms (mean = " + total/n+ ")"); 55 } 56 } 57 } 59 60 public String [] listFc () { 61 return new String [] { "s" }; 62 } 63 64 public Object lookupFc (final String cItf) { 65 if (cItf.equals("s")) { 66 return service; 67 } 68 return null; 69 } 70 71 public void bindFc (final String cItf, final Object sItf) { 72 if (cItf.equals("s")) { 73 service = (Service)sItf; 74 } 75 } 76 77 public void unbindFc (final String cItf) { 78 if (cItf.equals("s")) { 79 service = null; 80 } 81 } 82 } 83 | Popular Tags |