|
@@ -396,24 +396,44 @@ public class ProtobufRpcEngine implements RpcEngine {
|
|
|
* it is.</li>
|
|
|
* </ol>
|
|
|
*/
|
|
|
- public Writable call(RPC.Server server, String protocol,
|
|
|
+ public Writable call(RPC.Server server, String connectionProtocolName,
|
|
|
Writable writableRequest, long receiveTime) throws Exception {
|
|
|
RpcRequestWritable request = (RpcRequestWritable) writableRequest;
|
|
|
HadoopRpcRequestProto rpcRequest = request.message;
|
|
|
String methodName = rpcRequest.getMethodName();
|
|
|
- String protoName = rpcRequest.getDeclaringClassProtocolName();
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * RPCs for a particular interface (ie protocol) are done using a
|
|
|
+ * IPC connection that is setup using rpcProxy.
|
|
|
+ * The rpcProxy's has a declared protocol name that is
|
|
|
+ * sent form client to server at connection time.
|
|
|
+ *
|
|
|
+ * Each Rpc call also sends a protocol name
|
|
|
+ * (called declaringClassprotocolName). This name is usually the same
|
|
|
+ * as the connection protocol name except in some cases.
|
|
|
+ * For example metaProtocols such ProtocolInfoProto which get info
|
|
|
+ * about the protocol reuse the connection but need to indicate that
|
|
|
+ * the actual protocol is different (i.e. the protocol is
|
|
|
+ * ProtocolInfoProto) since they reuse the connection; in this case
|
|
|
+ * the declaringClassProtocolName field is set to the ProtocolInfoProto.
|
|
|
+ */
|
|
|
+
|
|
|
+ String declaringClassProtoName =
|
|
|
+ rpcRequest.getDeclaringClassProtocolName();
|
|
|
long clientVersion = rpcRequest.getClientProtocolVersion();
|
|
|
if (server.verbose)
|
|
|
- LOG.info("Call: protocol=" + protocol + ", method=" + methodName);
|
|
|
+ LOG.info("Call: connectionProtocolName=" + connectionProtocolName +
|
|
|
+ ", method=" + methodName);
|
|
|
|
|
|
- ProtoClassProtoImpl protocolImpl = getProtocolImpl(server, protoName,
|
|
|
- clientVersion);
|
|
|
+ ProtoClassProtoImpl protocolImpl = getProtocolImpl(server,
|
|
|
+ declaringClassProtoName, clientVersion);
|
|
|
BlockingService service = (BlockingService) protocolImpl.protocolImpl;
|
|
|
MethodDescriptor methodDescriptor = service.getDescriptorForType()
|
|
|
.findMethodByName(methodName);
|
|
|
if (methodDescriptor == null) {
|
|
|
- String msg = "Unknown method " + methodName + " called on " + protocol
|
|
|
- + " protocol.";
|
|
|
+ String msg = "Unknown method " + methodName + " called on "
|
|
|
+ + connectionProtocolName + " protocol.";
|
|
|
LOG.warn(msg);
|
|
|
throw new RpcServerException(msg);
|
|
|
}
|