org.apache.hadoop.hbase.client.Table.setOperationTimeout()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(177)

本文整理了Java中org.apache.hadoop.hbase.client.Table.setOperationTimeout()方法的一些代码示例,展示了Table.setOperationTimeout()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table.setOperationTimeout()方法的具体详情如下:
包路径:org.apache.hadoop.hbase.client.Table
类名称:Table
方法名:setOperationTimeout

Table.setOperationTimeout介绍

[英]Set timeout (millisecond) of each operation in this Table instance, will override the value of hbase.client.operation.timeout in configuration. Operation timeout is a top-level restriction that makes sure a blocking method will not be blocked more than this. In each operation, if rpc request fails because of timeout or other reason, it will retry until success or throw a RetriesExhaustedException. But if the total time being blocking reach the operation timeout before retries exhausted, it will break early and throw SocketTimeoutException.
[中]设置此表实例中每个操作的超时(毫秒)将覆盖hbase的值。客户活动配置超时。操作超时是一个顶级限制,确保阻塞方法的阻塞不会超过此限制。在每个操作中,如果rpc请求由于超时或其他原因失败,它将重试直到成功,或者抛出RetriesHaustedException。但是,如果阻塞的总时间在重试耗尽之前达到操作超时,它将提前中断并抛出SocketTimeoutException。

代码示例

代码示例来源:origin: apache/hbase

  1. @Test
  2. public void testMultiRowRangeFilterWithExclusive() throws IOException {
  3. tableName = TableName.valueOf(name.getMethodName());
  4. TEST_UTIL.getConfiguration().setInt(HConstants.HBASE_CLIENT_SCANNER_TIMEOUT_PERIOD, 6000000);
  5. Table ht = TEST_UTIL.createTable(tableName, family, Integer.MAX_VALUE);
  6. ht.setReadRpcTimeout(600000);
  7. ht.setOperationTimeout(6000000);
  8. generateRows(numRows, ht, family, qf, value);
  9. Scan scan = new Scan();
  10. scan.setMaxVersions();
  11. List<RowRange> ranges = new ArrayList<>();
  12. ranges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(20), false));
  13. ranges.add(new RowRange(Bytes.toBytes(20), false, Bytes.toBytes(40), false));
  14. ranges.add(new RowRange(Bytes.toBytes(65), true, Bytes.toBytes(75), false));
  15. MultiRowRangeFilter filter = new MultiRowRangeFilter(ranges);
  16. scan.setFilter(filter);
  17. int resultsSize = getResultsSize(ht, scan);
  18. LOG.info("found " + resultsSize + " results");
  19. List<Cell> results1 = getScanResult(Bytes.toBytes(10), Bytes.toBytes(40), ht);
  20. List<Cell> results2 = getScanResult(Bytes.toBytes(65), Bytes.toBytes(75), ht);
  21. assertEquals((results1.size() - 1) + results2.size(), resultsSize);
  22. ht.close();
  23. }

代码示例来源:origin: apache/phoenix

  1. @Override
  2. public void setOperationTimeout(int operationTimeout) {
  3. delegate.setOperationTimeout(operationTimeout);
  4. }

代码示例来源:origin: apache/hbase

  1. @Test
  2. public void testgetColumnHint() throws IOException {
  3. try (Table t = createTable()) {
  4. t.setOperationTimeout(10000);
  5. t.setRpcTimeout(10000);
  6. t.put(new Put(ROW).addColumn(FAMILY, col1, 100, value));
  7. t.put(new Put(ROW).addColumn(FAMILY, col1, 101, value));
  8. t.put(new Put(ROW).addColumn(FAMILY, col1, 102, value));
  9. t.put(new Put(ROW).addColumn(FAMILY, col1, 103, value));
  10. t.put(new Put(ROW).addColumn(FAMILY, col1, 104, value));
  11. t.put(new Put(ROW2).addColumn(FAMILY, col1, 104, value));
  12. TEST_UTIL.getAdmin().flush(t.getName());
  13. t.delete(new Delete(ROW).addColumn(FAMILY, col1));
  14. }
  15. }

代码示例来源:origin: org.apache.phoenix/phoenix-core

  1. @Override
  2. public void setOperationTimeout(int operationTimeout) {
  3. delegate.setOperationTimeout(operationTimeout);
  4. }

代码示例来源:origin: com.aliyun.phoenix/ali-phoenix-core

  1. @Override
  2. public void setOperationTimeout(int operationTimeout) {
  3. delegate.setOperationTimeout(operationTimeout);
  4. }

代码示例来源:origin: ManbangGroup/cantor

  1. private Table getTable(String namespace, String tableName) throws Exception {
  2. Table table = connection.getTable(TableName.valueOf(namespace, tableName));
  3. table.setOperationTimeout(TABLE_OPERATION_TIMEOUT);
  4. return table;
  5. }

代码示例来源:origin: org.apache.hbase/hbase-server

  1. @Test
  2. public void testMultiRowRangeFilterWithExclusive() throws IOException {
  3. tableName = TableName.valueOf(name.getMethodName());
  4. TEST_UTIL.getConfiguration().setInt(HConstants.HBASE_CLIENT_SCANNER_TIMEOUT_PERIOD, 6000000);
  5. Table ht = TEST_UTIL.createTable(tableName, family, Integer.MAX_VALUE);
  6. ht.setReadRpcTimeout(600000);
  7. ht.setOperationTimeout(6000000);
  8. generateRows(numRows, ht, family, qf, value);
  9. Scan scan = new Scan();
  10. scan.setMaxVersions();
  11. List<RowRange> ranges = new ArrayList<>();
  12. ranges.add(new RowRange(Bytes.toBytes(10), true, Bytes.toBytes(20), false));
  13. ranges.add(new RowRange(Bytes.toBytes(20), false, Bytes.toBytes(40), false));
  14. ranges.add(new RowRange(Bytes.toBytes(65), true, Bytes.toBytes(75), false));
  15. MultiRowRangeFilter filter = new MultiRowRangeFilter(ranges);
  16. scan.setFilter(filter);
  17. int resultsSize = getResultsSize(ht, scan);
  18. LOG.info("found " + resultsSize + " results");
  19. List<Cell> results1 = getScanResult(Bytes.toBytes(10), Bytes.toBytes(40), ht);
  20. List<Cell> results2 = getScanResult(Bytes.toBytes(65), Bytes.toBytes(75), ht);
  21. assertEquals((results1.size() - 1) + results2.size(), resultsSize);
  22. ht.close();
  23. }

代码示例来源:origin: org.apache.hbase/hbase-server

  1. @Test
  2. public void testgetColumnHint() throws IOException {
  3. try (Table t = createTable()) {
  4. t.setOperationTimeout(10000);
  5. t.setRpcTimeout(10000);
  6. t.put(new Put(ROW).addColumn(FAMILY, col1, 100, value));
  7. t.put(new Put(ROW).addColumn(FAMILY, col1, 101, value));
  8. t.put(new Put(ROW).addColumn(FAMILY, col1, 102, value));
  9. t.put(new Put(ROW).addColumn(FAMILY, col1, 103, value));
  10. t.put(new Put(ROW).addColumn(FAMILY, col1, 104, value));
  11. t.put(new Put(ROW2).addColumn(FAMILY, col1, 104, value));
  12. TEST_UTIL.getAdmin().flush(t.getName());
  13. t.delete(new Delete(ROW).addColumn(FAMILY, col1));
  14. }
  15. }

相关文章