当前位置: 首页>>代码示例>>Java>>正文


Java RpcRequestHeaderProto.getRetryCount方法代码示例

本文整理汇总了Java中org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcRequestHeaderProto.getRetryCount方法的典型用法代码示例。如果您正苦于以下问题:Java RpcRequestHeaderProto.getRetryCount方法的具体用法?Java RpcRequestHeaderProto.getRetryCount怎么用?Java RpcRequestHeaderProto.getRetryCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcRequestHeaderProto的用法示例。


在下文中一共展示了RpcRequestHeaderProto.getRetryCount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processOneRpc

import org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcRequestHeaderProto; //导入方法依赖的package包/类
/**
 * Process one RPC Request from buffer read from socket stream 
 *  - decode rpc in a rpc-Call
 *  - handle out-of-band RPC requests such as the initial connectionContext
 *  - A successfully decoded RpcCall will be deposited in RPC-Q and
 *    its response will be sent later when the request is processed.
 * 
 * Prior to this call the connectionHeader ("hrpc...") has been handled and
 * if SASL then SASL has been established and the buf we are passed
 * has been unwrapped from SASL.
 * 
 * @param buf - contains the RPC request header and the rpc request
 * @throws IOException - internal error that should not be returned to
 *         client, typically failure to respond to client
 * @throws WrappedRpcServerException - an exception that is sent back to the
 *         client in this method and does not require verbose logging by the
 *         Listener thread
 * @throws InterruptedException
 */    
private void processOneRpc(byte[] buf)
    throws IOException, WrappedRpcServerException, InterruptedException {
  int callId = -1;
  int retry = RpcConstants.INVALID_RETRY_COUNT;
  try {
    final DataInputStream dis =
        new DataInputStream(new ByteArrayInputStream(buf));
    final RpcRequestHeaderProto header =
        decodeProtobufFromStream(RpcRequestHeaderProto.newBuilder(), dis);
    callId = header.getCallId();
    retry = header.getRetryCount();
    if (LOG.isDebugEnabled()) {
      LOG.debug(" got #" + callId);
    }
    checkRpcHeaders(header);
    
    if (callId < 0) { // callIds typically used during connection setup
      processRpcOutOfBandRequest(header, dis);
    } else if (!connectionContextRead) {
      throw new WrappedRpcServerException(
          RpcErrorCodeProto.FATAL_INVALID_RPC_HEADER,
          "Connection context not established");
    } else {
      processRpcRequest(header, dis);
    }
  } catch (WrappedRpcServerException wrse) { // inform client of error
    Throwable ioe = wrse.getCause();
    final Call call = new Call(callId, retry, null, this);
    setupResponse(authFailedResponse, call,
        RpcStatusProto.FATAL, wrse.getRpcErrorCodeProto(), null,
        ioe.getClass().getName(), ioe.getMessage());
    call.sendResponse();
    throw wrse;
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:55,代码来源:Server.java

示例2: processOneRpc

import org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcRequestHeaderProto; //导入方法依赖的package包/类
/**
 * Process an RPC Request - handle connection setup and decoding of
 * request into a Call
 * @param buf - contains the RPC request header and the rpc request
 * @throws IOException - internal error that should not be returned to
 *         client, typically failure to respond to client
 * @throws WrappedRpcServerException - an exception to be sent back to
 *         the client that does not require verbose logging by the
 *         Listener thread
 * @throws InterruptedException
 */    
private void processOneRpc(byte[] buf)
    throws IOException, WrappedRpcServerException, InterruptedException {
  int callId = -1;
  int retry = RpcConstants.INVALID_RETRY_COUNT;
  try {
    final DataInputStream dis =
        new DataInputStream(new ByteArrayInputStream(buf));
    final RpcRequestHeaderProto header =
        decodeProtobufFromStream(RpcRequestHeaderProto.newBuilder(), dis);
    callId = header.getCallId();
    retry = header.getRetryCount();
    if (LOG.isDebugEnabled()) {
      LOG.debug(" got #" + callId);
    }
    checkRpcHeaders(header);
    
    if (callId < 0) { // callIds typically used during connection setup
      processRpcOutOfBandRequest(header, dis);
    } else if (!connectionContextRead) {
      throw new WrappedRpcServerException(
          RpcErrorCodeProto.FATAL_INVALID_RPC_HEADER,
          "Connection context not established");
    } else {
      processRpcRequest(header, dis);
    }
  } catch (WrappedRpcServerException wrse) { // inform client of error
    Throwable ioe = wrse.getCause();
    final Call call = new Call(callId, retry, null, this);
    setupResponse(authFailedResponse, call,
        RpcStatusProto.FATAL, wrse.getRpcErrorCodeProto(), null,
        ioe.getClass().getName(), ioe.getMessage());
    responder.doRespond(call);
    throw wrse;
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:47,代码来源:Server.java

示例3: processOneRpc

import org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcRequestHeaderProto; //导入方法依赖的package包/类
/**
 * Process one RPC Request from buffer read from socket stream 
 *  - decode rpc in a rpc-Call
 *  - handle out-of-band RPC requests such as the initial connectionContext
 *  - A successfully decoded RpcCall will be deposited in RPC-Q and
 *    its response will be sent later when the request is processed.
 * 
 * Prior to this call the connectionHeader ("hrpc...") has been handled and
 * if SASL then SASL has been established and the buf we are passed
 * has been unwrapped from SASL.
 * 
 * @param bb - contains the RPC request header and the rpc request
 * @throws IOException - internal error that should not be returned to
 *         client, typically failure to respond to client
 * @throws InterruptedException
 */
private void processOneRpc(ByteBuffer bb)
    throws IOException, InterruptedException {
  // exceptions that escape this method are fatal to the connection.
  // setupResponse will use the rpc status to determine if the connection
  // should be closed.
  int callId = -1;
  int retry = RpcConstants.INVALID_RETRY_COUNT;
  try {
    final RpcWritable.Buffer buffer = RpcWritable.Buffer.wrap(bb);
    final RpcRequestHeaderProto header =
        getMessage(RpcRequestHeaderProto.getDefaultInstance(), buffer);
    callId = header.getCallId();
    retry = header.getRetryCount();
    if (LOG.isDebugEnabled()) {
      LOG.debug(" got #" + callId);
    }
    checkRpcHeaders(header);

    if (callId < 0) { // callIds typically used during connection setup
      processRpcOutOfBandRequest(header, buffer);
    } else if (!connectionContextRead) {
      throw new FatalRpcServerException(
          RpcErrorCodeProto.FATAL_INVALID_RPC_HEADER,
          "Connection context not established");
    } else {
      processRpcRequest(header, buffer);
    }
  } catch (RpcServerException rse) {
    // inform client of error, but do not rethrow else non-fatal
    // exceptions will close connection!
    if (LOG.isDebugEnabled()) {
      LOG.debug(Thread.currentThread().getName() +
          ": processOneRpc from client " + this +
          " threw exception [" + rse + "]");
    }
    // use the wrapped exception if there is one.
    Throwable t = (rse.getCause() != null) ? rse.getCause() : rse;
    final RpcCall call = new RpcCall(this, callId, retry);
    setupResponse(call,
        rse.getRpcStatusProto(), rse.getRpcErrorCodeProto(), null,
        t.getClass().getName(), t.getMessage());
    sendResponse(call);
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:61,代码来源:Server.java


注:本文中的org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcRequestHeaderProto.getRetryCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。