Examples of RpcRequest


Examples of org.apache.tajo.rpc.RpcProtos.RpcRequest

    @Override
    public void messageReceived(ChannelHandlerContext ctx, MessageEvent e)
        throws Exception {

      final RpcRequest request = (RpcRequest) e.getMessage();

      String methodName = request.getMethodName();
      MethodDescriptor methodDescriptor = service.getDescriptorForType().
          findMethodByName(methodName);

      if (methodDescriptor == null) {
        throw new RemoteCallException(request.getId(),
            new NoSuchMethodException(methodName));
      }

      Message paramProto = null;
      if (request.hasRequestMessage()) {
        try {
          paramProto = service.getRequestPrototype(methodDescriptor)
                  .newBuilderForType().mergeFrom(request.getRequestMessage()).
                  build();
        } catch (Throwable t) {
          throw new RemoteCallException(request.getId(), methodDescriptor, t);
        }
      }

      final Channel channel = e.getChannel();
      final RpcController controller = new NettyRpcController();

      RpcCallback<Message> callback =
          !request.hasId() ? null : new RpcCallback<Message>() {

        public void run(Message returnValue) {

          RpcResponse.Builder builder = RpcResponse.newBuilder()
              .setId(request.getId());

          if (returnValue != null) {
            builder.setResponseMessage(returnValue.toByteString());
          }
View Full Code Here

Examples of org.apache.tajo.rpc.RpcProtos.RpcRequest

    @Override
    public void messageReceived(ChannelHandlerContext ctx, MessageEvent e)
        throws Exception {

      final RpcRequest request = (RpcRequest) e.getMessage();

      String methodName = request.getMethodName();
      MethodDescriptor methodDescriptor = service.getDescriptorForType().
          findMethodByName(methodName);

      if (methodDescriptor == null) {
        throw new RemoteCallException(request.getId(),
            new NoSuchMethodException(methodName));
      }

      Message paramProto = null;
      if (request.hasRequestMessage()) {
        try {
          paramProto = service.getRequestPrototype(methodDescriptor)
                  .newBuilderForType().mergeFrom(request.getRequestMessage()).
                  build();
        } catch (Throwable t) {
          throw new RemoteCallException(request.getId(), methodDescriptor, t);
        }
      }

      final Channel channel = e.getChannel();
      final RpcController controller = new NettyRpcController();

      RpcCallback<Message> callback =
          !request.hasId() ? null : new RpcCallback<Message>() {

        public void run(Message returnValue) {

          RpcResponse.Builder builder = RpcResponse.newBuilder()
              .setId(request.getId());

          if (returnValue != null) {
            builder.setResponseMessage(returnValue.toByteString());
          }
View Full Code Here

Examples of org.apache.tajo.rpc.RpcProtos.RpcRequest

  private class ServerHandler extends SimpleChannelUpstreamHandler {

    @Override
    public void messageReceived(ChannelHandlerContext ctx, MessageEvent e)
        throws Exception {
      final RpcRequest request = (RpcRequest) e.getMessage();

      String methodName = request.getMethodName();
      MethodDescriptor methodDescriptor =
          service.getDescriptorForType().findMethodByName(methodName);

      if (methodDescriptor == null) {
        throw new RemoteCallException(request.getId(),
            new NoSuchMethodException(methodName));
      }
      Message paramProto = null;
      if (request.hasRequestMessage()) {
        try {
          paramProto = service.getRequestPrototype(methodDescriptor)
              .newBuilderForType().mergeFrom(request.getRequestMessage()).
                  build();

        } catch (Throwable t) {
          throw new RemoteCallException(request.getId(), methodDescriptor, t);
        }
      }
      Message returnValue;
      RpcController controller = new NettyRpcController();

      try {
        returnValue = service.callBlockingMethod(methodDescriptor,
            controller, paramProto);
      } catch (Throwable t) {
        throw new RemoteCallException(request.getId(), methodDescriptor, t);
      }

      RpcResponse.Builder builder =
          RpcResponse.newBuilder().setId(request.getId());

      if (returnValue != null) {
        builder.setResponseMessage(returnValue.toByteString());
      }
View Full Code Here

Examples of org.rstudio.core.client.jsonrpc.RpcRequest

      // we may need to restart event listening.
      ensureListeningForEvents();

      // create request
      String rserverURL = getApplicationURL(scope) + "/" + method;
      RpcRequest rpcRequest = new RpcRequest(rserverURL,
                                             method,
                                             params,
                                             null,
                                             redactLog,
                                             sourceWindow,
                                             clientId_,
                                             clientVersion_);
     
      if (isDisconnected())
         return rpcRequest;

      // send the request
      rpcRequest.send(new RpcRequestCallback() {
         public void onError(RpcRequest request, RpcError error)
         {
            // ignore errors if we are disconnected
            if (isDisconnected())          
               return;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.