Package com.alibaba.wasp.util

Examples of com.alibaba.wasp.util.ByteBufferOutputStream


      }
    }

    protected List<ByteBuffer> prepareResponse(Object value, Status status,
        String errorClass, String error) {
      ByteBufferOutputStream buf = new ByteBufferOutputStream();
      DataOutputStream out = new DataOutputStream(buf);
      try {
        RpcResponseHeader.Builder builder = RpcResponseHeader.newBuilder();
        builder.setStatus(status);
        builder.build().writeDelimitedTo(out);
        if (error != null) {
          RpcException.Builder b = RpcException.newBuilder();
          b.setExceptionName(errorClass);
          b.setStackTrace(error);
          b.build().writeDelimitedTo(out);
        } else {
          if (value != null) {
            ((Message) value).writeDelimitedTo(out);
          }
        }
      } catch (IOException e) {
        LOG.warn("Exception while creating response " + e);
      }
      return buf.getBufferList();
    }
View Full Code Here


      headerBuilder.setTinfo(RPCTInfo.newBuilder().setParentId(s.getSpanId())
          .setTraceId(s.getTraceId()));
    }
    RpcRequestHeader rpcHeader = headerBuilder.build();

    ByteBufferOutputStream bbo = new ByteBufferOutputStream();
    connectionHeader.writeDelimitedTo(bbo);
    rpcHeader.writeDelimitedTo(bbo);
    param.writeDelimitedTo(bbo);

    List<ByteBuffer> res = transceive(bbo.getBufferList());

    return processResponse(res, protocol, param);
  }
View Full Code Here

TOP

Related Classes of com.alibaba.wasp.util.ByteBufferOutputStream

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.