• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ScanRequest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



ScanRequest类属于org.apache.hadoop.hbase.protobuf.generated.ClientProtos包,在下文中一共展示了ScanRequest类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getDeadline

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest; //导入依赖的package包/类
/**
 * Based on the request content, returns the deadline of the request.
 *
 * @param header
 * @param param
 * @return Deadline of this request. 0 now, otherwise msec of 'delay'
 */
@Override
public long getDeadline(RequestHeader header, Message param) {
  if (param instanceof ScanRequest) {
    ScanRequest request = (ScanRequest)param;
    if (!request.hasScannerId()) {
      return 0;
    }

    // get the 'virtual time' of the scanner, and applies sqrt() to get a
    // nice curve for the delay. More a scanner is used the less priority it gets.
    // The weight is used to have more control on the delay.
    long vtime = rpcServices.getScannerVirtualTime(request.getScannerId());
    return Math.round(Math.sqrt(vtime * scanVirtualTimeWeight));
  }
  return 0;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:24,代码来源:AnnotationReadingPriorityFunction.java


示例2: 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


示例3: close

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest; //导入依赖的package包/类
private void close() {
  if (this.scannerId == -1L) {
    return;
  }
  try {
    incRPCcallsMetrics();
    ScanRequest request =
        RequestConverter.buildScanRequest(this.scannerId, 0, true, this.scanMetrics != null);
    try {
      getStub().scan(null, request);
    } catch (ServiceException se) {
      throw ProtobufUtil.getRemoteException(se);
    }
  } catch (IOException e) {
    LOG.warn("Ignore, probably already closed", e);
  }
  this.scannerId = -1L;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:19,代码来源:ScannerCallable.java


示例4: openScanner

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest; //导入依赖的package包/类
protected long openScanner() throws IOException {
  incRPCcallsMetrics();
  ScanRequest request =
    RequestConverter.buildScanRequest(
      getLocation().getRegionInfo().getRegionName(),
      this.scan, 0, false);
  try {
    ScanResponse response = getStub().scan(null, request);
    long id = response.getScannerId();
    if (logScannerActivity) {
      LOG.info("Open scanner=" + id + " for scan=" + scan.toString()
        + " on region " + getLocation().toString());
    }
    return id;
  } catch (ServiceException se) {
    throw ProtobufUtil.getRemoteException(se);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:19,代码来源:ScannerCallable.java


示例5: ScanOpenNextThenExceptionThenRecoverConnection

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest; //导入依赖的package包/类
ScanOpenNextThenExceptionThenRecoverConnection(Configuration conf,
    boolean managed, ExecutorService pool) throws IOException {
  super(conf, managed);
  // Mock up my stub so open scanner returns a scanner id and then on next, we throw
  // exceptions for three times and then after that, we return no more to scan.
  this.stub = Mockito.mock(ClientService.BlockingInterface.class);
  long sid = 12345L;
  try {
    Mockito.when(stub.scan((RpcController)Mockito.any(),
        (ClientProtos.ScanRequest)Mockito.any())).
      thenReturn(ClientProtos.ScanResponse.newBuilder().setScannerId(sid).build()).
      thenThrow(new ServiceException(new RegionServerStoppedException("From Mockito"))).
      thenReturn(ClientProtos.ScanResponse.newBuilder().setScannerId(sid).
          setMoreResults(false).build());
  } catch (ServiceException e) {
    throw new IOException(e);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:19,代码来源:TestClientNoCluster.java


示例6: RegionServerStoppedOnScannerOpenConnection

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest; //导入依赖的package包/类
RegionServerStoppedOnScannerOpenConnection(Configuration conf, boolean managed,
    ExecutorService pool, User user) throws IOException {
  super(conf, managed);
  // Mock up my stub so open scanner returns a scanner id and then on next, we throw
  // exceptions for three times and then after that, we return no more to scan.
  this.stub = Mockito.mock(ClientService.BlockingInterface.class);
  long sid = 12345L;
  try {
    Mockito.when(stub.scan((RpcController)Mockito.any(),
        (ClientProtos.ScanRequest)Mockito.any())).
      thenReturn(ClientProtos.ScanResponse.newBuilder().setScannerId(sid).build()).
      thenThrow(new ServiceException(new RegionServerStoppedException("From Mockito"))).
      thenReturn(ClientProtos.ScanResponse.newBuilder().setScannerId(sid).
          setMoreResults(false).build());
  } catch (ServiceException e) {
    throw new IOException(e);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:19,代码来源:TestClientNoCluster.java


示例7: getDeadline

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest; //导入依赖的package包/类
/**
 * Based on the request content, returns the deadline of the request.
 *
 * @param header
 * @param param
 * @return Deadline of this request. 0 now, otherwise msec of 'delay'
 */
@Override
public long getDeadline(RequestHeader header, Message param) {
  String methodName = header.getMethodName();
  if (methodName.equalsIgnoreCase("scan")) {
    ScanRequest request = (ScanRequest)param;
    if (!request.hasScannerId()) {
      return 0;
    }

    // get the 'virtual time' of the scanner, and applies sqrt() to get a
    // nice curve for the delay. More a scanner is used the less priority it gets.
    // The weight is used to have more control on the delay.
    long vtime = rpcServices.getScannerVirtualTime(request.getScannerId());
    return Math.round(Math.sqrt(vtime * scanVirtualTimeWeight));
  }
  return 0;
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:25,代码来源:AnnotationReadingPriorityFunction.java


示例8: test

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest; //导入依赖的package包/类
/**
 * attempt to locate the region and perform a get and scan
 * @return True if successful, False otherwise.
 */
private boolean test(HConnection con, TableName tableName, byte[] row,
    HRegionServer server) {
  // not using HTable to avoid timeouts and retries
  try {
    byte[] regionName = con.relocateRegion(tableName, row).getRegionInfo()
        .getRegionName();
    // get and scan should now succeed without exception
    ClientProtos.GetRequest request =
        RequestConverter.buildGetRequest(regionName, new Get(row));
    server.getRSRpcServices().get(null, request);
    ScanRequest scanRequest = RequestConverter.buildScanRequest(
      regionName, new Scan(row), 1, true);
    try {
      server.getRSRpcServices().scan(
        new PayloadCarryingRpcController(), scanRequest);
    } catch (ServiceException se) {
      throw ProtobufUtil.getRemoteException(se);
    }
  } catch (IOException x) {
    return false;
  } catch (ServiceException e) {
    return false;
  }
  return true;
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:30,代码来源:TestEndToEndSplitTransaction.java


示例9: close

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest; //导入依赖的package包/类
private void close() {
  if (this.scannerId == -1L) {
    return;
  }
  try {
    incRPCcallsMetrics();
    ScanRequest request =
      RequestConverter.buildScanRequest(this.scannerId, 0, true);
    try {
      getStub().scan(null, request);
    } catch (ServiceException se) {
      throw ProtobufUtil.getRemoteException(se);
    }
  } catch (IOException e) {
    LOG.warn("Ignore, probably already closed", e);
  }
  this.scannerId = -1L;
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:19,代码来源:ScannerCallable.java


示例10: call

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest; //导入依赖的package包/类
@Override
public Result[] call(int timeout) throws IOException {
  if (this.closed) return null;
  if (Thread.interrupted()) {
    throw new InterruptedIOException();
  }
  ScanRequest request = RequestConverter.buildScanRequest(getLocation()
      .getRegionInfo().getRegionName(), getScan(), getCaching(), true);
  ScanResponse response = null;
  PayloadCarryingRpcController controller = controllerFactory.newController();
  try {
    controller.setPriority(getTableName());
    controller.setCallTimeout(timeout);
    response = getStub().scan(controller, request);
    return ResponseConverter.getResults(controller.cellScanner(),
        response);
  } catch (ServiceException se) {
    throw ProtobufUtil.getRemoteException(se);
  }
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:21,代码来源:ClientSmallScanner.java


示例11: test

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest; //导入依赖的package包/类
/**
 * attempt to locate the region and perform a get and scan
 * @return True if successful, False otherwise.
 */
private boolean test(HConnection con, TableName tableName, byte[] row,
    HRegionServer server) {
  // not using HTable to avoid timeouts and retries
  try {
    byte[] regionName = con.relocateRegion(tableName, row).getRegionInfo()
        .getRegionName();
    // get and scan should now succeed without exception
    ProtobufUtil.get(server, regionName, new Get(row));
    ScanRequest scanRequest = RequestConverter.buildScanRequest(
      regionName, new Scan(row), 1, true);
    try {
      server.scan(new PayloadCarryingRpcController(), scanRequest);
    } catch (ServiceException se) {
      throw ProtobufUtil.getRemoteException(se);
    }
  } catch (IOException x) {
    return false;
  }
  return true;
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:25,代码来源:TestEndToEndSplitTransaction.java


示例12: getSmallScanCallable

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest; //导入依赖的package包/类
static RegionServerCallable<Result[]> getSmallScanCallable(
    final Scan sc, HConnection connection, TableName table, byte[] localStartKey,
    final int cacheNum, final RpcControllerFactory rpcControllerFactory) throws IOException { 
  sc.setStartRow(localStartKey);
  RegionServerCallable<Result[]> callable = new RegionServerCallable<Result[]>(
      connection, table, sc.getStartRow()) {
    public Result[] call() throws IOException {
      ScanRequest request = RequestConverter.buildScanRequest(getLocation()
        .getRegionInfo().getRegionName(), sc, cacheNum, true);
      ScanResponse response = null;
      PayloadCarryingRpcController controller = rpcControllerFactory.newController();
      try {
        controller.setPriority(getTableName());
        response = getStub().scan(controller, request);
        return ResponseConverter.getResults(controller.cellScanner(),
            response);
      } catch (ServiceException se) {
        throw ProtobufUtil.getRemoteException(se);
      }
    }
  };
  return callable;
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:24,代码来源:ClientSmallScanner.java


示例13: getSmallScanCallable

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest; //导入依赖的package包/类
static RegionServerCallable<Result[]> getSmallScanCallable(
    final Scan sc, HConnection connection, TableName table,
    byte[] localStartKey, final int cacheNum, final RpcControllerFactory rpcControllerFactory) {
  sc.setStartRow(localStartKey);
  RegionServerCallable<Result[]> callable = new RegionServerCallable<Result[]>(
      connection, table, sc.getStartRow()) {
    public Result[] call(int callTimeout) throws IOException {
      ScanRequest request = RequestConverter.buildScanRequest(getLocation()
          .getRegionInfo().getRegionName(), sc, cacheNum, true);
      PayloadCarryingRpcController controller = rpcControllerFactory.newController();
      controller.setPriority(getTableName());
      controller.setCallTimeout(callTimeout);
      try {
        ScanResponse response = getStub().scan(controller, request);
        return ResponseConverter.getResults(controller.cellScanner(), response);
      } catch (ServiceException se) {
        throw ProtobufUtil.getRemoteException(se);
      }
    }
  };
  return callable;
}
 
开发者ID:shenli-uiuc,项目名称:PyroDB,代码行数:23,代码来源:ClientSmallScanner.java


示例14: getSmallScanCallable

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest; //导入依赖的package包/类
private RegionServerCallable<Result[]> getSmallScanCallable(
    byte[] localStartKey, final int cacheNum) {
  this.scan.setStartRow(localStartKey);
  RegionServerCallable<Result[]> callable = new RegionServerCallable<Result[]>(
      getConnection(), getTable(), scan.getStartRow()) {
    public Result[] call() throws IOException {
      ScanRequest request = RequestConverter.buildScanRequest(getLocation()
          .getRegionInfo().getRegionName(), scan, cacheNum, true);
      ScanResponse response = null;
      PayloadCarryingRpcController controller = new PayloadCarryingRpcController();
      try {
        controller.setPriority(getTableName());
        response = getStub().scan(controller, request);
        return ResponseConverter.getResults(controller.cellScanner(),
            response);
      } catch (ServiceException se) {
        throw ProtobufUtil.getRemoteException(se);
      }
    }
  };
  return callable;
}
 
开发者ID:cloud-software-foundation,项目名称:c5,代码行数:23,代码来源:ClientSmallScanner.java


示例15: close

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest; //导入依赖的package包/类
private void close() {
  if (this.scannerId == -1L) {
    return;
  }
  try {
    incRPCcallsMetrics();
    ScanRequest request =
      RequestConverter.buildScanRequest(this.scannerId, 0, true);
    try {
      server.scan(null, request);
    } catch (ServiceException se) {
      throw ProtobufUtil.getRemoteException(se);
    }
  } catch (IOException e) {
    LOG.warn("Ignore, probably already closed", e);
  }
  this.scannerId = -1L;
}
 
开发者ID:daidong,项目名称:DominoHBase,代码行数:19,代码来源:ScannerCallable.java


示例16: openScanner

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest; //导入依赖的package包/类
protected long openScanner() throws IOException {
  incRPCcallsMetrics();
  ScanRequest request =
    RequestConverter.buildScanRequest(
      this.location.getRegionInfo().getRegionName(),
      this.scan, 0, false);
  try {
    ScanResponse response = server.scan(null, request);
    long id = response.getScannerId();
    if (logScannerActivity) {
      LOG.info("Open scanner=" + id + " for scan=" + scan.toString()
        + " on region " + this.location.toString() + " ip:"
        + this.location.getHostnamePort());
    }
    return id;
  } catch (ServiceException se) {
    throw ProtobufUtil.getRemoteException(se);
  }
}
 
开发者ID:daidong,项目名称:DominoHBase,代码行数:20,代码来源:ScannerCallable.java


示例17: test

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest; //导入依赖的package包/类
/**
 * attempt to locate the region and perform a get and scan
 * @return True if successful, False otherwise.
 */
private boolean test(HConnection con, byte[] tableName, byte[] row,
    HRegionServer server) {
  // not using HTable to avoid timeouts and retries
  try {
    byte[] regionName = con.relocateRegion(tableName, row).getRegionInfo()
        .getRegionName();
    // get and scan should now succeed without exception
    ProtobufUtil.get(server, regionName, new Get(row));
    ScanRequest scanRequest = RequestConverter.buildScanRequest(
      regionName, new Scan(row), 1, true);
    try {
      server.scan(null, scanRequest);
    } catch (ServiceException se) {
      throw ProtobufUtil.getRemoteException(se);
    }
  } catch (IOException x) {
    return false;
  }
  return true;
}
 
开发者ID:daidong,项目名称:DominoHBase,代码行数:25,代码来源:TestEndToEndSplitTransaction.java


示例18: isScanRequest

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest; //导入依赖的package包/类
private boolean isScanRequest(final RequestHeader header, final Message param) {
  if (param instanceof ScanRequest) {
    // The first scan request will be executed as a "short read"
    ScanRequest request = (ScanRequest)param;
    return request.hasScannerId();
  }
  return false;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:9,代码来源:RWQueueRpcExecutor.java


示例19: 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


示例20: scan

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest; //导入依赖的package包/类
@Override
public ScanResponse scan(RpcController controller, ScanRequest request) 
    throws ServiceException {
  ScanRequest.Builder builder = ScanRequest.newBuilder(request);
  builder.setClientHandlesHeartbeats(heartbeatsEnabled);
  return super.scan(controller, builder.build());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:8,代码来源:TestScannerHeartbeatMessages.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ZNetRxIoSampleResponse类代码示例发布时间:2022-05-22
下一篇:
Java BoundedMatcher类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap