Reverting the commit r1433222 to fix the commit message
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1433223 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
68cf069f20
commit
26de042a09
|
@ -230,9 +230,6 @@ Release 2.0.3-alpha - Unreleased
|
||||||
|
|
||||||
HADOOP-9183. Potential deadlock in ActiveStandbyElector. (tomwhite)
|
HADOOP-9183. Potential deadlock in ActiveStandbyElector. (tomwhite)
|
||||||
|
|
||||||
HADOOP-9203. RPCCallBenchmark should find a random available port.
|
|
||||||
(Andrew Purtell via suresh)
|
|
||||||
|
|
||||||
Release 2.0.2-alpha - 2012-09-07
|
Release 2.0.2-alpha - 2012-09-07
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -25,7 +25,6 @@ import java.net.InetAddress;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.net.NetworkInterface;
|
import java.net.NetworkInterface;
|
||||||
import java.net.NoRouteToHostException;
|
import java.net.NoRouteToHostException;
|
||||||
import java.net.ServerSocket;
|
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.net.SocketAddress;
|
import java.net.SocketAddress;
|
||||||
import java.net.SocketException;
|
import java.net.SocketException;
|
||||||
|
@ -866,23 +865,4 @@ public class NetUtils {
|
||||||
}
|
}
|
||||||
return addrs;
|
return addrs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a free port number. There is no guarantee it will remain free, so
|
|
||||||
* it should be used immediately.
|
|
||||||
*
|
|
||||||
* @returns A free port for binding a local socket
|
|
||||||
*/
|
|
||||||
public static int getFreeSocketPort() {
|
|
||||||
int port = 0;
|
|
||||||
try {
|
|
||||||
ServerSocket s = new ServerSocket(0);
|
|
||||||
port = s.getLocalPort();
|
|
||||||
s.close();
|
|
||||||
return port;
|
|
||||||
} catch (IOException e) {
|
|
||||||
// Could not get a free port. Return default port 0.
|
|
||||||
}
|
|
||||||
return port;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class RPCCallBenchmark implements Tool, Configurable {
|
||||||
private int serverReaderThreads = 1;
|
private int serverReaderThreads = 1;
|
||||||
private int clientThreads = 0;
|
private int clientThreads = 0;
|
||||||
private String host = "0.0.0.0";
|
private String host = "0.0.0.0";
|
||||||
private int port = 0;
|
private int port = 12345;
|
||||||
public int secondsToRun = 15;
|
public int secondsToRun = 15;
|
||||||
private int msgSize = 1024;
|
private int msgSize = 1024;
|
||||||
public Class<? extends RpcEngine> rpcEngine =
|
public Class<? extends RpcEngine> rpcEngine =
|
||||||
|
@ -201,21 +201,11 @@ public class RPCCallBenchmark implements Tool, Configurable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPort() {
|
|
||||||
if (port == 0) {
|
|
||||||
port = NetUtils.getFreeSocketPort();
|
|
||||||
if (port == 0) {
|
|
||||||
throw new RuntimeException("Could not find a free port");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return port;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "rpcEngine=" + rpcEngine + "\nserverThreads=" + serverThreads
|
return "rpcEngine=" + rpcEngine + "\nserverThreads=" + serverThreads
|
||||||
+ "\nserverReaderThreads=" + serverReaderThreads + "\nclientThreads="
|
+ "\nserverReaderThreads=" + serverReaderThreads + "\nclientThreads="
|
||||||
+ clientThreads + "\nhost=" + host + "\nport=" + getPort()
|
+ clientThreads + "\nhost=" + host + "\nport=" + port
|
||||||
+ "\nsecondsToRun=" + secondsToRun + "\nmsgSize=" + msgSize;
|
+ "\nsecondsToRun=" + secondsToRun + "\nmsgSize=" + msgSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -238,12 +228,12 @@ public class RPCCallBenchmark implements Tool, Configurable {
|
||||||
.newReflectiveBlockingService(serverImpl);
|
.newReflectiveBlockingService(serverImpl);
|
||||||
|
|
||||||
server = new RPC.Builder(conf).setProtocol(TestRpcService.class)
|
server = new RPC.Builder(conf).setProtocol(TestRpcService.class)
|
||||||
.setInstance(service).setBindAddress(opts.host).setPort(opts.getPort())
|
.setInstance(service).setBindAddress(opts.host).setPort(opts.port)
|
||||||
.setNumHandlers(opts.serverThreads).setVerbose(false).build();
|
.setNumHandlers(opts.serverThreads).setVerbose(false).build();
|
||||||
} else if (opts.rpcEngine == WritableRpcEngine.class) {
|
} else if (opts.rpcEngine == WritableRpcEngine.class) {
|
||||||
server = new RPC.Builder(conf).setProtocol(TestProtocol.class)
|
server = new RPC.Builder(conf).setProtocol(TestProtocol.class)
|
||||||
.setInstance(new TestRPC.TestImpl()).setBindAddress(opts.host)
|
.setInstance(new TestRPC.TestImpl()).setBindAddress(opts.host)
|
||||||
.setPort(opts.getPort()).setNumHandlers(opts.serverThreads)
|
.setPort(opts.port).setNumHandlers(opts.serverThreads)
|
||||||
.setVerbose(false).build();
|
.setVerbose(false).build();
|
||||||
} else {
|
} else {
|
||||||
throw new RuntimeException("Bad engine: " + opts.rpcEngine);
|
throw new RuntimeException("Bad engine: " + opts.rpcEngine);
|
||||||
|
@ -388,7 +378,7 @@ public class RPCCallBenchmark implements Tool, Configurable {
|
||||||
* Create a client proxy for the specified engine.
|
* Create a client proxy for the specified engine.
|
||||||
*/
|
*/
|
||||||
private RpcServiceWrapper createRpcClient(MyOptions opts) throws IOException {
|
private RpcServiceWrapper createRpcClient(MyOptions opts) throws IOException {
|
||||||
InetSocketAddress addr = NetUtils.createSocketAddr(opts.host, opts.getPort());
|
InetSocketAddress addr = NetUtils.createSocketAddr(opts.host, opts.port);
|
||||||
|
|
||||||
if (opts.rpcEngine == ProtobufRpcEngine.class) {
|
if (opts.rpcEngine == ProtobufRpcEngine.class) {
|
||||||
final TestRpcService proxy = RPC.getProxy(TestRpcService.class, 0, addr, conf);
|
final TestRpcService proxy = RPC.getProxy(TestRpcService.class, 0, addr, conf);
|
||||||
|
|
Loading…
Reference in New Issue