@Override protected void channelRead0(final ChannelHandlerContext ctx, final RpcRequest request) throws Exception { String methodName = request.getMethodName(); final MethodDescriptor methodDescriptor = service.getDescriptorForType().findMethodByName(methodName); if (methodDescriptor == null) { exceptionCaught(ctx, new RemoteCallException(request.getId(), new NoSuchMethodException(methodName))); return; } try { Message paramProto = null; if (request.hasRequestMessage()) { paramProto = service.getRequestPrototype(methodDescriptor).newBuilderForType() .mergeFrom(request.getRequestMessage()).build(); } RpcController controller = new NettyRpcController(); Message returnValue = service.callBlockingMethod(methodDescriptor, controller, paramProto); RpcProtos.RpcResponse.Builder builder = RpcProtos.RpcResponse.newBuilder().setId(request.getId()); if (returnValue != null) { builder.setResponseMessage(returnValue.toByteString()); } if (controller.failed()) { builder.setErrorMessage(controller.errorText()); } ctx.writeAndFlush(builder.build()); } catch (RemoteCallException e) { exceptionCaught(ctx, e); } catch (Throwable throwable) { exceptionCaught(ctx, new RemoteCallException(request.getId(), methodDescriptor, throwable)); } }
if (request.hasRequestMessage()) { try { paramProto = service.getRequestPrototype(methodDescriptor).newBuilderForType()
if (request.hasRequestMessage()) { try { paramProto = service.getRequestPrototype(methodDescriptor).newBuilderForType()
if (request.hasRequestMessage()) { paramProto = service.getRequestPrototype(methodDescriptor).newBuilderForType() .mergeFrom(request.getRequestMessage()).build();
if (request.hasRequestMessage()) { paramProto = service.getRequestPrototype(methodDescriptor).newBuilderForType() .mergeFrom(request.getRequestMessage()).build();
@Override protected void channelRead0(final ChannelHandlerContext ctx, final RpcRequest request) throws Exception { String methodName = request.getMethodName(); final MethodDescriptor methodDescriptor = service.getDescriptorForType().findMethodByName(methodName); if (methodDescriptor == null) { exceptionCaught(ctx, new RemoteCallException(request.getId(), new NoSuchMethodException(methodName))); return; } try { Message paramProto = null; if (request.hasRequestMessage()) { paramProto = service.getRequestPrototype(methodDescriptor).newBuilderForType() .mergeFrom(request.getRequestMessage()).build(); } RpcController controller = new NettyRpcController(); Message returnValue = service.callBlockingMethod(methodDescriptor, controller, paramProto); RpcProtos.RpcResponse.Builder builder = RpcProtos.RpcResponse.newBuilder().setId(request.getId()); if (returnValue != null) { builder.setResponseMessage(returnValue.toByteString()); } if (controller.failed()) { builder.setErrorMessage(controller.errorText()); } ctx.writeAndFlush(builder.build()); } catch (RemoteCallException e) { exceptionCaught(ctx, e); } catch (Throwable throwable) { exceptionCaught(ctx, new RemoteCallException(request.getId(), methodDescriptor, throwable)); } }
public Builder mergeFrom(org.apache.tajo.rpc.RpcProtos.RpcRequest other) { if (other == org.apache.tajo.rpc.RpcProtos.RpcRequest.getDefaultInstance()) return this; if (other.hasId()) { setId(other.getId()); } if (other.hasMethodName()) { bitField0_ |= 0x00000002; methodName_ = other.methodName_; onChanged(); } if (other.hasRequestMessage()) { setRequestMessage(other.getRequestMessage()); } this.mergeUnknownFields(other.getUnknownFields()); return this; }
public Builder mergeFrom(org.apache.tajo.rpc.RpcProtos.RpcRequest other) { if (other == org.apache.tajo.rpc.RpcProtos.RpcRequest.getDefaultInstance()) return this; if (other.hasId()) { setId(other.getId()); } if (other.hasMethodName()) { bitField0_ |= 0x00000002; methodName_ = other.methodName_; onChanged(); } if (other.hasRequestMessage()) { setRequestMessage(other.getRequestMessage()); } this.mergeUnknownFields(other.getUnknownFields()); return this; }
public Builder mergeFrom(org.apache.tajo.rpc.RpcProtos.RpcRequest other) { if (other == org.apache.tajo.rpc.RpcProtos.RpcRequest.getDefaultInstance()) return this; if (other.hasId()) { setId(other.getId()); } if (other.hasMethodName()) { bitField0_ |= 0x00000002; methodName_ = other.methodName_; onChanged(); } if (other.hasRequestMessage()) { setRequestMessage(other.getRequestMessage()); } this.mergeUnknownFields(other.getUnknownFields()); return this; }