vinayakumarb commented on a change in pull request #2767:
URL: https://github.com/apache/hadoop/pull/2767#discussion_r637551571
##########
File path:
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/RPC.java
##########
@@ -937,11 +937,18 @@ public int hashCode() {
*/
static class ProtoClassProtoImpl {
final Class<?> protocolClass;
- final Object protocolImpl;
+ final Object protocolImpl;
+ private final boolean newPBImpl;
+
ProtoClassProtoImpl(Class<?> protocolClass, Object protocolImpl) {
this.protocolClass = protocolClass;
this.protocolImpl = protocolImpl;
+ this.newPBImpl = protocolImpl instanceof BlockingService;
}
+
+ public boolean isNewPBImpl() {
Review comment:
Done
##########
File path:
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/ProtobufRpcEngine.java
##########
@@ -443,144 +430,52 @@ public Server(Class<?> protocolClass, Object
protocolImpl,
SecretManager<? extends TokenIdentifier> secretManager,
String portRangeConfig, AlignmentContext alignmentContext)
throws IOException {
- super(bindAddress, port, null, numHandlers,
- numReaders, queueSizePerHandler, conf,
- serverNameFromClass(protocolImpl.getClass()), secretManager,
- portRangeConfig);
- setAlignmentContext(alignmentContext);
- this.verbose = verbose;
- registerProtocolAndImpl(RPC.RpcKind.RPC_PROTOCOL_BUFFER, protocolClass,
- protocolImpl);
+ super(protocolClass, protocolImpl, conf, bindAddress, port, numHandlers,
+ numReaders, queueSizePerHandler, verbose, secretManager,
+ portRangeConfig, alignmentContext);
}
- @Override
- protected RpcInvoker getServerRpcInvoker(RpcKind rpcKind) {
- if (rpcKind == RpcKind.RPC_PROTOCOL_BUFFER) {
- return RPC_INVOKER;
- }
- return super.getServerRpcInvoker(rpcKind);
- }
-
- /**
- * Protobuf invoker for {@link RpcInvoker}
- */
- static class ProtoBufRpcInvoker implements RpcInvoker {
- private static ProtoClassProtoImpl getProtocolImpl(RPC.Server server,
- String protoName, long clientVersion) throws RpcServerException {
- ProtoNameVer pv = new ProtoNameVer(protoName, clientVersion);
- ProtoClassProtoImpl impl =
- server.getProtocolImplMap(RPC.RpcKind.RPC_PROTOCOL_BUFFER).get(pv);
- if (impl == null) { // no match for Protocol AND Version
- VerProtocolImpl highest =
-
server.getHighestSupportedProtocol(RPC.RpcKind.RPC_PROTOCOL_BUFFER,
- protoName);
- if (highest == null) {
- throw new RpcNoSuchProtocolException(
- "Unknown protocol: " + protoName);
- }
- // protocol supported but not the version that client wants
- throw new RPC.VersionMismatch(protoName, clientVersion,
- highest.version);
- }
- return impl;
+ static RpcWritable processCall(RPC.Server server,
Review comment:
Done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]