YARN-84. Use Builder to build RPC server. Contributed by Brandon Li
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1380921 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f5943c1eef
commit
60af999c73
@ -88,8 +88,10 @@ public void testJobTokenRpc() throws Exception {
|
||||
.when(mockTT).getProtocolSignature(anyString(), anyLong(), anyInt());
|
||||
|
||||
JobTokenSecretManager sm = new JobTokenSecretManager();
|
||||
final Server server = RPC.getServer(TaskUmbilicalProtocol.class, mockTT,
|
||||
ADDRESS, 0, 5, true, conf, sm);
|
||||
final Server server = new RPC.Builder(conf)
|
||||
.setProtocol(TaskUmbilicalProtocol.class).setInstance(mockTT)
|
||||
.setBindAddress(ADDRESS).setPort(0).setNumHandlers(5).setVerbose(true)
|
||||
.setSecretManager(sm).build();
|
||||
|
||||
server.start();
|
||||
|
||||
|
@ -8,6 +8,8 @@ Trunk (unreleased changes)
|
||||
|
||||
IMPROVEMENTS
|
||||
|
||||
YARN-84. Use Builder to build RPC server. (Brandon Li via suresh)
|
||||
|
||||
OPTIMAZATIONS
|
||||
|
||||
BUG FIXES
|
||||
|
@ -166,9 +166,11 @@ private Server createServer(Class<?> pbProtocol, InetSocketAddress addr, Configu
|
||||
SecretManager<? extends TokenIdentifier> secretManager, int numHandlers,
|
||||
BlockingService blockingService, String portRangeConfig) throws IOException {
|
||||
RPC.setProtocolEngine(conf, pbProtocol, ProtobufRpcEngine.class);
|
||||
RPC.Server server = RPC.getServer(pbProtocol, blockingService,
|
||||
addr.getHostName(), addr.getPort(), numHandlers, false, conf,
|
||||
secretManager, portRangeConfig);
|
||||
RPC.Server server = new RPC.Builder(conf).setProtocol(pbProtocol)
|
||||
.setInstance(blockingService).setBindAddress(addr.getHostName())
|
||||
.setPort(addr.getPort()).setNumHandlers(numHandlers).setVerbose(false)
|
||||
.setSecretManager(secretManager).setPortRangeConfig(portRangeConfig)
|
||||
.build();
|
||||
LOG.info("Adding protocol "+pbProtocol.getCanonicalName()+" to the server");
|
||||
server.addProtocol(RPC.RpcKind.RPC_PROTOCOL_BUFFER, pbProtocol, blockingService);
|
||||
return server;
|
||||
|
@ -204,8 +204,10 @@ public void ping() {
|
||||
public void testNMAuditLoggerWithIP() throws Exception {
|
||||
Configuration conf = new Configuration();
|
||||
// start the IPC server
|
||||
Server server = RPC.getServer(TestProtocol.class,
|
||||
new MyTestRPCServer(), "0.0.0.0", 0, 5, true, conf, null);
|
||||
Server server = new RPC.Builder(conf).setProtocol(TestProtocol.class)
|
||||
.setInstance(new MyTestRPCServer()).setBindAddress("0.0.0.0")
|
||||
.setPort(0).setNumHandlers(5).setVerbose(true).build();
|
||||
|
||||
server.start();
|
||||
|
||||
InetSocketAddress addr = NetUtils.getConnectAddress(server);
|
||||
|
@ -222,8 +222,9 @@ public void ping() {
|
||||
public void testRMAuditLoggerWithIP() throws Exception {
|
||||
Configuration conf = new Configuration();
|
||||
// start the IPC server
|
||||
Server server = RPC.getServer(TestProtocol.class,
|
||||
new MyTestRPCServer(), "0.0.0.0", 0, 5, true, conf, null);
|
||||
Server server = new RPC.Builder(conf).setProtocol(TestProtocol.class)
|
||||
.setInstance(new MyTestRPCServer()).setBindAddress("0.0.0.0")
|
||||
.setPort(0).setNumHandlers(5).setVerbose(true).build();
|
||||
server.start();
|
||||
|
||||
InetSocketAddress addr = NetUtils.getConnectAddress(server);
|
||||
|
Loading…
Reference in New Issue
Block a user