svn merge -c 1380921 from trunk for YARN-84. Use Builder to build RPC server.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1507582 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Tsz-wo Sze 2013-07-27 06:47:40 +00:00
parent e20cd46dea
commit 4c045ebafd
5 changed files with 18 additions and 9 deletions

View File

@ -91,8 +91,10 @@ public class TestUmbilicalProtocolWithJobToken {
.when(mockTT).getProtocolSignature(anyString(), anyLong(), anyInt()); .when(mockTT).getProtocolSignature(anyString(), anyLong(), anyInt());
JobTokenSecretManager sm = new JobTokenSecretManager(); JobTokenSecretManager sm = new JobTokenSecretManager();
final Server server = RPC.getServer(TaskUmbilicalProtocol.class, mockTT, final Server server = new RPC.Builder(conf)
ADDRESS, 0, 5, true, conf, sm); .setProtocol(TaskUmbilicalProtocol.class).setInstance(mockTT)
.setBindAddress(ADDRESS).setPort(0).setNumHandlers(5).setVerbose(true)
.setSecretManager(sm).build();
server.start(); server.start();

View File

@ -468,6 +468,8 @@ Release 2.1.0-beta - 2013-07-02
YARN-912. Move client facing exceptions to yarn-api module. (Mayank Bansal YARN-912. Move client facing exceptions to yarn-api module. (Mayank Bansal
via vinodkv) via vinodkv)
YARN-84. Use Builder to build RPC server. (Brandon Li via szetszwo)
OPTIMIZATIONS OPTIMIZATIONS
YARN-512. Log aggregation root directory check is more expensive than it YARN-512. Log aggregation root directory check is more expensive than it

View File

@ -166,9 +166,11 @@ public class RpcServerFactoryPBImpl implements RpcServerFactory {
SecretManager<? extends TokenIdentifier> secretManager, int numHandlers, SecretManager<? extends TokenIdentifier> secretManager, int numHandlers,
BlockingService blockingService, String portRangeConfig) throws IOException { BlockingService blockingService, String portRangeConfig) throws IOException {
RPC.setProtocolEngine(conf, pbProtocol, ProtobufRpcEngine.class); RPC.setProtocolEngine(conf, pbProtocol, ProtobufRpcEngine.class);
RPC.Server server = RPC.getServer(pbProtocol, blockingService, RPC.Server server = new RPC.Builder(conf).setProtocol(pbProtocol)
addr.getHostName(), addr.getPort(), numHandlers, false, conf, .setInstance(blockingService).setBindAddress(addr.getHostName())
secretManager, portRangeConfig); .setPort(addr.getPort()).setNumHandlers(numHandlers).setVerbose(false)
.setSecretManager(secretManager).setPortRangeConfig(portRangeConfig)
.build();
LOG.info("Adding protocol "+pbProtocol.getCanonicalName()+" to the server"); LOG.info("Adding protocol "+pbProtocol.getCanonicalName()+" to the server");
server.addProtocol(RPC.RpcKind.RPC_PROTOCOL_BUFFER, pbProtocol, blockingService); server.addProtocol(RPC.RpcKind.RPC_PROTOCOL_BUFFER, pbProtocol, blockingService);
return server; return server;

View File

@ -204,8 +204,10 @@ public class TestNMAuditLogger {
public void testNMAuditLoggerWithIP() throws Exception { public void testNMAuditLoggerWithIP() throws Exception {
Configuration conf = new Configuration(); Configuration conf = new Configuration();
// start the IPC server // start the IPC server
Server server = RPC.getServer(TestProtocol.class, Server server = new RPC.Builder(conf).setProtocol(TestProtocol.class)
new MyTestRPCServer(), "0.0.0.0", 0, 5, true, conf, null); .setInstance(new MyTestRPCServer()).setBindAddress("0.0.0.0")
.setPort(0).setNumHandlers(5).setVerbose(true).build();
server.start(); server.start();
InetSocketAddress addr = NetUtils.getConnectAddress(server); InetSocketAddress addr = NetUtils.getConnectAddress(server);

View File

@ -222,8 +222,9 @@ public class TestRMAuditLogger {
public void testRMAuditLoggerWithIP() throws Exception { public void testRMAuditLoggerWithIP() throws Exception {
Configuration conf = new Configuration(); Configuration conf = new Configuration();
// start the IPC server // start the IPC server
Server server = RPC.getServer(TestProtocol.class, Server server = new RPC.Builder(conf).setProtocol(TestProtocol.class)
new MyTestRPCServer(), "0.0.0.0", 0, 5, true, conf, null); .setInstance(new MyTestRPCServer()).setBindAddress("0.0.0.0")
.setPort(0).setNumHandlers(5).setVerbose(true).build();
server.start(); server.start();
InetSocketAddress addr = NetUtils.getConnectAddress(server); InetSocketAddress addr = NetUtils.getConnectAddress(server);