/** * Retrieve an {@link AsyncTable} implementation for accessing a table. * <p> * This method no longer checks table existence. An exception will be thrown if the table does not * exist only when the first operation is attempted. * @param tableName the name of the table * @param pool the thread pool to use for executing callback * @return an AsyncTable to use for interactions with this table */ default AsyncTable<ScanResultConsumer> getTable(TableName tableName, ExecutorService pool) { return getTableBuilder(tableName, pool).build(); }
/** * Retrieve an {@link AsyncTable} implementation for accessing a table. * <p> * The returned instance will use default configs. Use {@link #getTableBuilder(TableName)} if * you want to customize some configs. * <p> * This method no longer checks table existence. An exception will be thrown if the table does not * exist only when the first operation is attempted. * <p> * The returned {@code CompletableFuture} will be finished directly in the rpc framework's * callback thread, so typically you should not do any time consuming work inside these methods. * And also the observer style scan API will use {@link AdvancedScanResultConsumer} which is * designed for experts only. Only use it when you know what you are doing. * @param tableName the name of the table * @return an AsyncTable to use for interactions with this table * @see #getTableBuilder(TableName) */ default AsyncTable<AdvancedScanResultConsumer> getTable(TableName tableName) { return getTableBuilder(tableName).build(); }
protected static void setUp(MemoryCompactionPolicy memoryCompaction) throws Exception { TEST_UTIL.getConfiguration().set(TABLES_ON_MASTER, "none"); TEST_UTIL.getConfiguration().setLong(HBASE_CLIENT_META_OPERATION_TIMEOUT, 60000L); TEST_UTIL.getConfiguration().setInt(ByteBufferPool.MAX_POOL_SIZE_KEY, 100); TEST_UTIL.getConfiguration().set(CompactingMemStore.COMPACTING_MEMSTORE_TYPE_KEY, String.valueOf(memoryCompaction)); TEST_UTIL.startMiniCluster(5); SPLIT_KEYS = new byte[8][]; for (int i = 111; i < 999; i += 111) { SPLIT_KEYS[i / 111 - 1] = Bytes.toBytes(String.format("%03d", i)); } TEST_UTIL.createTable(TABLE_NAME, FAMILY); TEST_UTIL.waitTableAvailable(TABLE_NAME); CONN = ConnectionFactory.createAsyncConnection(TEST_UTIL.getConfiguration()).get(); TABLE = CONN.getTableBuilder(TABLE_NAME).setReadRpcTimeout(1, TimeUnit.SECONDS) .setMaxRetries(1000).build(); TABLE.putAll( IntStream.range(0, COUNT).mapToObj(i -> new Put(Bytes.toBytes(String.format("%03d", i))) .addColumn(FAMILY, QUALIFIER, Bytes.toBytes(i))).collect(Collectors.toList())) .get(); }
try (AsyncConnection conn = ConnectionFactory.createAsyncConnection(UTIL1.getConfiguration()).get()) { AsyncTable<?> table = conn.getTableBuilder(TABLE_NAME).setMaxAttempts(1).build(); try { table.put(new Put(Bytes.toBytes(0)).addColumn(CF, CQ, Bytes.toBytes(0))).get();
AsyncTable<?> table = conn.getTableBuilder(TABLE_NAME).setMaxAttempts(1).build(); CompletableFuture<Void> future = table.put(new Put(Bytes.toBytes(1000)).addColumn(CF, CQ, Bytes.toBytes(1000)));
try (AsyncConnection conn = ConnectionFactory.createAsyncConnection(UTIL1.getConfiguration()).get()) { AsyncTable<?> table = conn.getTableBuilder(TABLE_NAME).setMaxAttempts(1) .setWriteRpcTimeout(5, TimeUnit.SECONDS).build(); try {
/** * Retrieve an {@link AsyncTable} implementation for accessing a table. * <p> * This method no longer checks table existence. An exception will be thrown if the table does not * exist only when the first operation is attempted. * @param tableName the name of the table * @param pool the thread pool to use for executing callback * @return an AsyncTable to use for interactions with this table */ default AsyncTable<ScanResultConsumer> getTable(TableName tableName, ExecutorService pool) { return getTableBuilder(tableName, pool).build(); }
/** * Retrieve an {@link AsyncTable} implementation for accessing a table. * <p> * The returned instance will use default configs. Use {@link #getTableBuilder(TableName)} if * you want to customize some configs. * <p> * This method no longer checks table existence. An exception will be thrown if the table does not * exist only when the first operation is attempted. * <p> * The returned {@code CompletableFuture} will be finished directly in the rpc framework's * callback thread, so typically you should not do any time consuming work inside these methods. * And also the observer style scan API will use {@link AdvancedScanResultConsumer} which is * designed for experts only. Only use it when you know what you are doing. * @param tableName the name of the table * @return an AsyncTable to use for interactions with this table * @see #getTableBuilder(TableName) */ default AsyncTable<AdvancedScanResultConsumer> getTable(TableName tableName) { return getTableBuilder(tableName).build(); }
/** * Retrieve an {@link AsyncTable} implementation for accessing a table. * <p> * This method no longer checks table existence. An exception will be thrown if the table does not * exist only when the first operation is attempted. * @param tableName the name of the table * @param pool the thread pool to use for executing callback * @return an AsyncTable to use for interactions with this table */ default AsyncTable<ScanResultConsumer> getTable(TableName tableName, ExecutorService pool) { return getTableBuilder(tableName, pool).build(); }
/** * Retrieve an {@link AsyncTable} implementation for accessing a table. * <p> * The returned instance will use default configs. Use {@link #getTableBuilder(TableName)} if * you want to customize some configs. * <p> * This method no longer checks table existence. An exception will be thrown if the table does not * exist only when the first operation is attempted. * <p> * The returned {@code CompletableFuture} will be finished directly in the rpc framework's * callback thread, so typically you should not do any time consuming work inside these methods. * And also the observer style scan API will use {@link AdvancedScanResultConsumer} which is * designed for experts only. Only use it when you know what you are doing. * @param tableName the name of the table * @return an AsyncTable to use for interactions with this table * @see #getTableBuilder(TableName) */ default AsyncTable<AdvancedScanResultConsumer> getTable(TableName tableName) { return getTableBuilder(tableName).build(); }
protected static void setUp(MemoryCompactionPolicy memoryCompaction) throws Exception { TEST_UTIL.getConfiguration().set(TABLES_ON_MASTER, "none"); TEST_UTIL.getConfiguration().setLong(HBASE_CLIENT_META_OPERATION_TIMEOUT, 60000L); TEST_UTIL.getConfiguration().setInt(ByteBufferPool.MAX_POOL_SIZE_KEY, 100); TEST_UTIL.getConfiguration().set(CompactingMemStore.COMPACTING_MEMSTORE_TYPE_KEY, String.valueOf(memoryCompaction)); TEST_UTIL.startMiniCluster(5); SPLIT_KEYS = new byte[8][]; for (int i = 111; i < 999; i += 111) { SPLIT_KEYS[i / 111 - 1] = Bytes.toBytes(String.format("%03d", i)); } TEST_UTIL.createTable(TABLE_NAME, FAMILY); TEST_UTIL.waitTableAvailable(TABLE_NAME); CONN = ConnectionFactory.createAsyncConnection(TEST_UTIL.getConfiguration()).get(); TABLE = CONN.getTableBuilder(TABLE_NAME).setReadRpcTimeout(1, TimeUnit.SECONDS) .setMaxRetries(1000).build(); TABLE.putAll( IntStream.range(0, COUNT).mapToObj(i -> new Put(Bytes.toBytes(String.format("%03d", i))) .addColumn(FAMILY, QUALIFIER, Bytes.toBytes(i))).collect(Collectors.toList())) .get(); }