Package com.google.protobuf

Examples of com.google.protobuf.Message$Builder


                if(filter.accept(key, null)) {
                    recordFetched();

                    VAdminProto.FetchPartitionEntriesResponse.Builder response = VAdminProto.FetchPartitionEntriesResponse.newBuilder();
                    response.setKey(ProtoUtils.encodeBytes(key));
                    Message message = response.build();

                    sendMessage(outputStream, message);
                }

                accountForScanProgress("keys");
View Full Code Here


            if(filter.accept(key, null)) {
                accountForFetchedKey(key.get());

                VAdminProto.FetchPartitionEntriesResponse.Builder response = VAdminProto.FetchPartitionEntriesResponse.newBuilder();
                response.setKey(ProtoUtils.encodeBytes(key));
                Message message = response.build();

                sendMessage(outputStream, message);
            }
        }
View Full Code Here

            type = RequestRoutingType.getRequestRoutingType(request.getRequestRouteType());
        }

        String storeName = request.getStore();
        Store<ByteArray, byte[], byte[]> store = getStore(storeName, type);
        Message response;
        if(store == null) {
            response = unknownStore(storeName, request.getType());
        } else {
            switch(request.getType()) {
                case GET:
View Full Code Here

                    VAdminProto.PartitionEntry partitionEntry = VAdminProto.PartitionEntry.newBuilder()
                                                                                          .setKey(ProtoUtils.encodeBytes(key))
                                                                                          .setVersioned(ProtoUtils.encodeVersioned(value))
                                                                                          .build();
                    response.setPartitionEntry(partitionEntry);
                    Message message = response.build();

                    sendMessage(outputStream, message);

                    throttler.maybeThrottle(AdminServiceRequestHandler.valueSize(value));
                }
View Full Code Here

                    VAdminProto.PartitionEntry partitionEntry = VAdminProto.PartitionEntry.newBuilder()
                                                                                          .setKey(ProtoUtils.encodeBytes(key))
                                                                                          .setVersioned(ProtoUtils.encodeVersioned(value))
                                                                                          .build();
                    response.setPartitionEntry(partitionEntry);
                    Message message = response.build();

                    sendMessage(outputStream, message);

                    throttler.maybeThrottle(AdminServiceRequestHandler.valueSize(value));
                }
View Full Code Here

    if (Timing.isEnabled()) {
      Timing.enterScope();
      Timing.setScopeValue(SessionContext.class, sessionContext);
    }
    try {
      Message message;

      MessageWrapper wrapper = MessageWrapper.deserialize(gson, data);

      try {
        message = serializer.fromJson(wrapper.message, wrapper.messageType);
View Full Code Here

    public void messageReceived(ChannelHandlerContext ctx, MessageEvent e)
        throws Exception {
      try {
        String errorClass = null;
        String error = null;
        Message returnValue = null;
        thread2Address.put(Thread.currentThread(), (InetSocketAddress) ctx
            .getChannel().getRemoteAddress());
        NettyDataPack dataPack = (NettyDataPack) e.getMessage();
        List<ByteBuffer> req = dataPack.getDatas();
        ByteBufferInputStream dis = new ByteBufferInputStream(req);
View Full Code Here

        throw new EOFException();
      }

      Status status = response.getStatus();
      if (status == Status.SUCCESS) {
        Message rpcResponseType;
        try {
          rpcResponseType = ProtobufRpcEngine.Invoker
              .getReturnProtoType(ProtobufRpcEngine.Server.getMethod(protocol,
                  param.getMethodName()));
        } catch (Exception e) {
          throw new RuntimeException(e); // local exception
        }
        Builder builder = rpcResponseType.newBuilderForType();
        builder.mergeDelimitedFrom(in);
        Message value = builder.build();

        return value;
      } else if (status == Status.ERROR) {
        RpcException exceptionResponse = RpcException.parseDelimitedFrom(in);
        RemoteException remoteException = new RemoteException(
View Full Code Here

    private RPCProtos.RpcRequestBody constructRpcRequest(Method method, Object[] params)
        throws ServiceException {
      RPCProtos.RpcRequestBody rpcRequest;
      RPCProtos.RpcRequestBody.Builder builder = RPCProtos.RpcRequestBody.newBuilder();
      builder.setMethodName(method.getName());
      Message param;
      int length = params.length;
      if (length == 2) {
        // RpcController + Message in the method args
        // (generated code from RPC bits in .proto files have RpcController)
        param = (Message) params[1];
      } else if (length == 1) { // Message
        param = (Message) params[0];
      } else {
        throw new ServiceException("Too many parameters for request. Method: ["
            + method.getName() + "]" + ", Expected: 2, Actual: "
            + params.length);
      }
      builder.setRequestClassName(param.getClass().getName());
      builder.setRequest(param.toByteString());
      builder.setClientProtocolVersion(clientProtocolVersion);
      rpcRequest = builder.build();
      return rpcRequest;
    }
View Full Code Here

      if (LOG.isDebugEnabled()) {
        startTime = System.currentTimeMillis();
      }

      RPCProtos.RpcRequestBody rpcRequest = constructRpcRequest(method, args);
      Message val = null;
      try {
        val = client.call(rpcRequest, address, protocol, rpcTimeout);

        if (LOG.isDebugEnabled()) {
          long callTime = System.currentTimeMillis() - startTime;
View Full Code Here

TOP

Related Classes of com.google.protobuf.Message$Builder

Copyright © 2018 www.massapicom. 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.