|
@@ -61,11 +61,20 @@ public class RpcServerFactoryPBImpl implements RpcServerFactory {
|
|
|
private RpcServerFactoryPBImpl() {
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
public Server getServer(Class<?> protocol, Object instance,
|
|
|
InetSocketAddress addr, Configuration conf,
|
|
|
SecretManager<? extends TokenIdentifier> secretManager, int numHandlers)
|
|
|
throws YarnException {
|
|
|
+ return getServer(protocol, instance, addr, conf, secretManager, numHandlers,
|
|
|
+ null);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Server getServer(Class<?> protocol, Object instance,
|
|
|
+ InetSocketAddress addr, Configuration conf,
|
|
|
+ SecretManager<? extends TokenIdentifier> secretManager, int numHandlers,
|
|
|
+ String portRangeConfig)
|
|
|
+ throws YarnException {
|
|
|
|
|
|
Constructor<?> constructor = serviceCache.get(protocol);
|
|
|
if (constructor == null) {
|
|
@@ -121,7 +130,7 @@ public class RpcServerFactoryPBImpl implements RpcServerFactory {
|
|
|
|
|
|
try {
|
|
|
return createServer(pbProtocol, addr, conf, secretManager, numHandlers,
|
|
|
- (BlockingService)method.invoke(null, service));
|
|
|
+ (BlockingService)method.invoke(null, service), portRangeConfig);
|
|
|
} catch (InvocationTargetException e) {
|
|
|
throw new YarnException(e);
|
|
|
} catch (IllegalAccessException e) {
|
|
@@ -155,11 +164,11 @@ public class RpcServerFactoryPBImpl implements RpcServerFactory {
|
|
|
|
|
|
private Server createServer(Class<?> pbProtocol, InetSocketAddress addr, Configuration conf,
|
|
|
SecretManager<? extends TokenIdentifier> secretManager, int numHandlers,
|
|
|
- BlockingService blockingService) throws IOException {
|
|
|
+ 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);
|
|
|
+ secretManager, portRangeConfig);
|
|
|
LOG.info("Adding protocol "+pbProtocol.getCanonicalName()+" to the server");
|
|
|
server.addProtocol(RPC.RpcKind.RPC_PROTOCOL_BUFFER, pbProtocol, blockingService);
|
|
|
return server;
|