KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > proactive > ext > benchsocket > BenchSocketFactory


1 package org.objectweb.proactive.ext.benchsocket;
2
3 import java.io.IOException JavaDoc;
4 import java.io.Serializable JavaDoc;
5
6 import java.net.ServerSocket JavaDoc;
7 import java.net.Socket JavaDoc;
8
9 import java.rmi.server.RMIClientSocketFactory JavaDoc;
10 import java.rmi.server.RMIServerSocketFactory JavaDoc;
11
12
13 public class BenchSocketFactory implements RMIServerSocketFactory JavaDoc,
14     RMIClientSocketFactory JavaDoc, Serializable JavaDoc {
15     
16     protected static boolean measure=true;
17     
18     
19     public ServerSocket JavaDoc createServerSocket(int port) throws IOException JavaDoc {
20         return new BenchServerSocket(port); //ServerSocket(port);
21
}
22
23     public Socket JavaDoc createSocket(String JavaDoc host, int port) throws IOException JavaDoc {
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