jojochuang commented on a change in pull request #2767:
URL: https://github.com/apache/hadoop/pull/2767#discussion_r637485155
##########
File path:
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/ProtobufRpcEngine2.java
##########
@@ -495,6 +524,7 @@ private static ProtoClassProtoImpl
getProtocolImpl(RPC.Server server,
* it is.</li>
* </ol>
*/
+ @SuppressWarnings("deprecation")
Review comment:
It would help a lot for the applications using the new
ProtobufRpcEngine2 what API replaces this deprecated API.
Maybe it can be written in the javadoc; or in the release note.
##########
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:
can you add a comment here that this is practically the same as
ProtobufRpccEngine2.call() except the Message class, and that if this method is
modified, the other method should be updated as well? (Or add the comment in
the ProtobufRpccEngine2.call())
##########
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:
Might be easier to understand to call it "isShadedPBImpl()" instead
--
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]