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


Java ScanRequest.getScannerId方法代码示例

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


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

示例1: scan

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest; //导入方法依赖的package包/类
@Override
public ScanResponse scan(final RpcController controller, final ScanRequest request)
    throws ServiceException {
  if (request.hasScannerId()) {
    ScanResponse scanResponse = super.scan(controller, request);
    if (this.tableScannerId == request.getScannerId() && 
        (sleepAlways || (!slept && seqNoToSleepOn == request.getNextCallSeq()))) {
      try {
        LOG.info("SLEEPING " + (rpcTimeout + 500));
        Thread.sleep(rpcTimeout + 500);
      } catch (InterruptedException e) {
      }
      slept = true;
      tryNumber++;
      if (tryNumber > 2 * CLIENT_RETRIES_NUMBER) {
        sleepAlways = false;
      }
    }
    return scanResponse;
  } else {
    ScanResponse scanRes = super.scan(controller, request);
    String regionName = Bytes.toString(request.getRegion().getValue().toByteArray());
    if (!regionName.contains(TableName.META_TABLE_NAME.getNameAsString())) {
      tableScannerId = scanRes.getScannerId();
    }
    return scanRes;
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:29,代码来源:TestClientScannerRPCTimeout.java

示例2: scan

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest; //导入方法依赖的package包/类
@Override
public ScanResponse scan(RpcController controller, ScanRequest request)
    throws ServiceException {
  ScanResponse.Builder builder = ScanResponse.newBuilder();
  try {
    if (request.hasScan()) {
      byte[] regionName = request.getRegion().getValue().toByteArray();
      builder.setScannerId(openScanner(regionName, null));
      builder.setMoreResults(true);
    }
    else {
      long scannerId = request.getScannerId();
      Result result = next(scannerId);
      if (result != null) {
        builder.addCellsPerResult(result.size());
        List<CellScannable> results = new ArrayList<CellScannable>(1);
        results.add(result);
        ((PayloadCarryingRpcController) controller).setCellScanner(CellUtil
            .createCellScanner(results));
        builder.setMoreResults(true);
      }
      else {
        builder.setMoreResults(false);
        close(scannerId);
      }
    }
  } catch (IOException ie) {
    throw new ServiceException(ie);
  }
  return builder.build();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:32,代码来源:MockRegionServer.java

示例3: scan

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest; //导入方法依赖的package包/类
@Override
public ScanResponse scan(final RpcController controller, final ScanRequest request)
    throws ServiceException {
  if (request.hasScannerId()) {
    ScanResponse scanResponse = super.scan(controller, request);
    if (this.tableScannerId == request.getScannerId() && 
        (sleepAlways || (!slept && seqNoToSleepOn == request.getNextCallSeq()))) {
      try {
        Thread.sleep(rpcTimeout + 500);
      } catch (InterruptedException e) {
      }
      slept = true;
      tryNumber++;
      if (tryNumber > 2 * CLIENT_RETRIES_NUMBER) {
        sleepAlways = false;
      }
    }
    return scanResponse;
  } else {
    ScanResponse scanRes = super.scan(controller, request);
    String regionName = Bytes.toString(request.getRegion().getValue().toByteArray());
    if (!regionName.contains("-ROOT-") && !regionName.contains(".META.")) {
      tableScannerId = scanRes.getScannerId();
    }
    return scanRes;
  }
}
 
开发者ID:daidong,项目名称:DominoHBase,代码行数:28,代码来源:TestClientScannerRPCTimeout.java

示例4: scan

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest; //导入方法依赖的package包/类
@Override
public ScanResponse scan(RpcController controller, ScanRequest request)
    throws ServiceException {
  ScanResponse.Builder builder = ScanResponse.newBuilder();
  try {
    if (request.hasScan()) {
      byte[] regionName = request.getRegion().getValue().toByteArray();
      builder.setScannerId(openScanner(regionName, null));
      builder.setMoreResults(true);
    }
    else {
      long scannerId = request.getScannerId();
      Result result = next(scannerId);
      if (result != null) {
        builder.addResult(ProtobufUtil.toResult(result));
        builder.setMoreResults(true);
      }
      else {
        builder.setMoreResults(false);
        close(scannerId);
      }
    }
  } catch (IOException ie) {
    throw new ServiceException(ie);
  }
  return builder.build();
}
 
开发者ID:daidong,项目名称:DominoHBase,代码行数:28,代码来源:MockRegionServer.java


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