@Test public void testRpcTimeout() throws IOException { Configuration c = new Configuration(TEST_UTIL.getConfiguration()); try (Table table = TEST_UTIL.getConnection().getTableBuilder(tableName, null) .setRpcTimeout(SleepCoprocessor.SLEEP_TIME / 2) .setReadRpcTimeout(SleepCoprocessor.SLEEP_TIME / 2) .setWriteRpcTimeout(SleepCoprocessor.SLEEP_TIME / 2) .setOperationTimeout(SleepCoprocessor.SLEEP_TIME * 100).build()) { execute(table); fail("Get should not have succeeded"); } catch (RetriesExhaustedException e) { LOG.info("We received an exception, as expected ", e); } // Again, with configuration based override c.setInt(HConstants.HBASE_RPC_TIMEOUT_KEY, SleepCoprocessor.SLEEP_TIME / 2); c.setInt(HConstants.HBASE_RPC_READ_TIMEOUT_KEY, SleepCoprocessor.SLEEP_TIME / 2); c.setInt(HConstants.HBASE_RPC_WRITE_TIMEOUT_KEY, SleepCoprocessor.SLEEP_TIME / 2); c.setInt(HConstants.HBASE_CLIENT_OPERATION_TIMEOUT, SleepCoprocessor.SLEEP_TIME * 100); try (Connection conn = ConnectionFactory.createConnection(c)) { try (Table table = conn.getTable(tableName)) { execute(table); fail("Get should not have succeeded"); } catch (RetriesExhaustedException e) { LOG.info("We received an exception, as expected ", e); } } } }
public void testOperationTimeout() throws IOException { TableBuilder builder = TEST_UTIL.getConnection().getTableBuilder(tableName, null).setRpcTimeout(Integer.MAX_VALUE) .setReadRpcTimeout(Integer.MAX_VALUE).setWriteRpcTimeout(Integer.MAX_VALUE);
@Test public void testRpcTimeout() throws IOException { Configuration c = new Configuration(TEST_UTIL.getConfiguration()); try (Table table = TEST_UTIL.getConnection().getTableBuilder(tableName, null) .setRpcTimeout(SleepCoprocessor.SLEEP_TIME / 2) .setReadRpcTimeout(SleepCoprocessor.SLEEP_TIME / 2) .setWriteRpcTimeout(SleepCoprocessor.SLEEP_TIME / 2) .setOperationTimeout(SleepCoprocessor.SLEEP_TIME * 100).build()) { execute(table); fail("Get should not have succeeded"); } catch (RetriesExhaustedException e) { LOG.info("We received an exception, as expected ", e); } // Again, with configuration based override c.setInt(HConstants.HBASE_RPC_TIMEOUT_KEY, SleepCoprocessor.SLEEP_TIME / 2); c.setInt(HConstants.HBASE_RPC_READ_TIMEOUT_KEY, SleepCoprocessor.SLEEP_TIME / 2); c.setInt(HConstants.HBASE_RPC_WRITE_TIMEOUT_KEY, SleepCoprocessor.SLEEP_TIME / 2); c.setInt(HConstants.HBASE_CLIENT_OPERATION_TIMEOUT, SleepCoprocessor.SLEEP_TIME * 100); try (Connection conn = ConnectionFactory.createConnection(c)) { try (Table table = conn.getTable(tableName)) { execute(table); fail("Get should not have succeeded"); } catch (RetriesExhaustedException e) { LOG.info("We received an exception, as expected ", e); } } } }
public void testOperationTimeout() throws IOException { TableBuilder builder = TEST_UTIL.getConnection().getTableBuilder(tableName, null).setRpcTimeout(Integer.MAX_VALUE) .setReadRpcTimeout(Integer.MAX_VALUE).setWriteRpcTimeout(Integer.MAX_VALUE);