Java 类org.apache.hadoop.hbase.ipc.RpcCallContext 实例源码

项目:ditb    文件:RSRpcServices.java   
/**
 * Method to account for the size of retained cells and retained data blocks.
 * @return an object that represents the last referenced block from this response.
 */
Object addSize(RpcCallContext context, Result r, Object lastBlock) {
  if (context != null && !r.isEmpty()) {
    for (Cell c : r.rawCells()) {
      context.incrementResponseCellSize(CellUtil.estimatedHeapSizeOf(c));
      // We're using the last block being the same as the current block as
      // a proxy for pointing to a new block. This won't be exact.
      // If there are multiple gets that bounce back and forth
      // Then it's possible that this will over count the size of
      // referenced blocks. However it's better to over count and
      // use two RPC's than to OOME the RegionServer.
      byte[] valueArray = c.getValueArray();
      if (valueArray != lastBlock) {
        context.incrementResponseBlockSize(valueArray.length);
        lastBlock = valueArray;
      }
    }
  }
  return lastBlock;
}
项目:hbase    文件:RSRpcServices.java   
private void closeScanner(HRegion region, RegionScanner scanner, String scannerName,
    RpcCallContext context) throws IOException {
  if (region.getCoprocessorHost() != null) {
    if (region.getCoprocessorHost().preScannerClose(scanner)) {
      // bypass the actual close.
      return;
    }
  }
  RegionScannerHolder rsh = scanners.remove(scannerName);
  if (rsh != null) {
    if (context != null) {
      context.setCallBack(rsh.closeCallBack);
    } else {
      rsh.s.close();
    }
    if (region.getCoprocessorHost() != null) {
      region.getCoprocessorHost().postScannerClose(scanner);
    }
    closedScanners.put(scannerName, scannerName);
  }
}
项目:hbase    文件:RSRpcServices.java   
/**
 * Method to account for the size of retained cells and retained data blocks.
 * @return an object that represents the last referenced block from this response.
 */
Object addSize(RpcCallContext context, Result r, Object lastBlock) {
  if (context != null && r != null && !r.isEmpty()) {
    for (Cell c : r.rawCells()) {
      context.incrementResponseCellSize(PrivateCellUtil.estimatedSerializedSizeOf(c));

      // Since byte buffers can point all kinds of crazy places it's harder to keep track
      // of which blocks are kept alive by what byte buffer.
      // So we make a guess.
      if (c instanceof ByteBufferExtendedCell) {
        ByteBufferExtendedCell bbCell = (ByteBufferExtendedCell) c;
        ByteBuffer bb = bbCell.getValueByteBuffer();
        if (bb != lastBlock) {
          context.incrementResponseBlockSize(bb.capacity());
          lastBlock = bb;
        }
      } else {
        // We're using the last block being the same as the current block as
        // a proxy for pointing to a new block. This won't be exact.
        // If there are multiple gets that bounce back and forth
        // Then it's possible that this will over count the size of
        // referenced blocks. However it's better to over count and
        // use two rpcs than to OOME the regionserver.
        byte[] valueArray = c.getValueArray();
        if (valueArray != lastBlock) {
          context.incrementResponseBlockSize(valueArray.length);
          lastBlock = valueArray;
        }
      }

    }
  }
  return lastBlock;
}
项目:spliceengine    文件:RegionServerControl.java   
private static void checkCallerDisconnect(HRegion region, String task) throws CallerDisconnectedException{
    RpcCallContext currentCall = RpcServer.getCurrentCall();
    if(currentCall!=null){
        long afterTime =  currentCall.disconnectSince();
        if(afterTime>0){
            throw new CallerDisconnectedException(
                    "Aborting on region " + region.getRegionInfo().getRegionNameAsString() + ", call " +
                            task + " after " + afterTime + " ms, since " +
                            "caller disconnected");
        }
    }
}
项目:ditb    文件:VersionInfoUtil.java   
public static boolean currentClientHasMinimumVersion(int major, int minor) {
  RpcCallContext call = RpcServer.getCurrentCall();
  HBaseProtos.VersionInfo versionInfo = call != null ? call.getClientVersionInfo() : null;
  return hasMinimumVersion(versionInfo, major, minor);
}
项目:ditb    文件:RSRpcServices.java   
/**
 * @return True if current call supports cellblocks
 */
private boolean isClientCellBlockSupport() {
  RpcCallContext context = RpcServer.getCurrentCall();
  return context != null && context.isClientCellBlockSupported();
}
项目:pbase    文件:RSRpcServices.java   
/**
 * @return True if current call supports cellblocks
 */
private boolean isClientCellBlockSupport() {
    RpcCallContext context = RpcServer.getCurrentCall();
    return context != null && context.isClientCellBlockSupport();
}
项目:HIndex    文件:HRegionServer.java   
/**
 * @return True if current call supports cellblocks
 */
private boolean isClientCellBlockSupport() {
  RpcCallContext context = RpcServer.getCurrentCall();
  return context != null && context.isClientCellBlockSupport();
}
项目:hbase    文件:VersionInfoUtil.java   
/**
 * @return the versionInfo extracted from the current RpcCallContext
 */
private static HBaseProtos.VersionInfo getCurrentClientVersionInfo() {
  return RpcServer.getCurrentCall().map(RpcCallContext::getClientVersionInfo).orElse(null);
}
项目:hbase    文件:RSRpcServices.java   
private boolean isClientCellBlockSupport(RpcCallContext context) {
  return context != null && context.isClientCellBlockSupported();
}
项目:PyroDB    文件:RSRpcServices.java   
/**
 * @return True if current call supports cellblocks
 */
private boolean isClientCellBlockSupport() {
  RpcCallContext context = RpcServer.getCurrentCall();
  return context != null && context.isClientCellBlockSupport();
}
项目:c5    文件:HRegionServer.java   
/**
 * @return True if current call supports cellblocks
 */
private boolean isClientCellBlockSupport() {
  RpcCallContext context = RpcServer.getCurrentCall();
  return context != null && context.isClientCellBlockSupport();
}