Hbase1.1.2的HTablePool已经被弃用,用什么回代替HTablePool呢
Hbase1.1.2的HTablePool已经被弃用,用什么来代替HTablePool呢?
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.client.ConnectionFactory; import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbsae.client.Table; int main() { // create a new hbase configuration object. (singleton) Configuration conf = HBaseConfiguration.create(); // create a new hbase connection object. (singleton) Connection connection = ConnectionFactory.createConnection(conf); try { while (true) { // create a table instance everytime you need. // you don't have to pool this object, because hbase client implementation // do necessary resource caching & control internally. Table table = connection.getTable(TableName.valueOf("table")); ... table.close(); } } finally { // close the hbase connection on application shutdown. connection.close(); } }