1 package org.objectweb.proactive.ext.benchsocket; 2 3 import java.io.IOException ; 4 import java.io.Serializable ; 5 6 import java.net.ServerSocket ; 7 import java.net.Socket ; 8 9 import java.rmi.server.RMIClientSocketFactory ; 10 import java.rmi.server.RMIServerSocketFactory ; 11 12 13 public class BenchSocketFactory implements RMIServerSocketFactory , 14 RMIClientSocketFactory , Serializable { 15 16 protected static boolean measure=true; 17 18 19 public ServerSocket createServerSocket(int port) throws IOException { 20 return new BenchServerSocket(port); } 22 23 public Socket createSocket(String host, int port) throws IOException { 24 return new BenchClientSocket(host, port); 25 } 26 27 28 public static void startMeasure() { 29 BenchSocketFactory.measure = true; 30 } 31 32 public static void endMeasure() { 33 BenchSocketFactory.measure = false; 34 } 35 36 37 } 38 | Popular Tags |