hbase接続プールを作成しようとしています。私は以下のことを試しました。しかし、私はその結果を知らない。それは私のパフォーマンスに影響を及ぼしますか?誰でも助けてくれますか?ホストはリモートまたはローカルにすることもできます。Hbase接続プール
HashMap cons = new HashMap();
public void getDataFromHbase(String host, String tableid){
conf.set("hbase.zookeeper.quorum", host);
ThreadPoolExecutor executor= (ThreadPoolExecutor) Executors.newCachedThreadPool();
executor.setMaximumPoolSize(50);
if(cons.get(host+"tableA_"+tableid) != null){
table1 = cons.get(host+"tableA_"+tableid);
table2 = cons.get(host+"tableB_"+tableid);
}
else{
table1 = new HTable(conf,Bytes.toBytes("tableA_"+tableid),executor);
table2 = new HTable(conf,Bytes.toBytes("tableB_"+tableid),executor);
cons.put(host+"tableA_"+tableid,table1);
cons.put(host+"tableB_"+tableid,table2);
}
Scan scan = new Scan();
scan.addFamily(Bytes.toBytes("n"));
scan.setCaching(1000);
ResultScanner resultScanner = table1.getScanner(scan);
ResultScanner resultScannerB = table2.getScanner(scan);
}
私の回答が役に立ちました。もしあなたが何かを持っているなら、あなたは質問をする。 –