HBASE-2828 HTable unnecessarily coupled with HMaster; missing piece

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1030694 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2010-11-03 21:21:47 +00:00
parent a8e10147ac
commit 5f6a76d68f
1 changed files with 8 additions and 2 deletions

View File

@ -54,6 +54,8 @@ import org.apache.hadoop.hbase.client.MetaScanner.MetaScannerVisitor;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.Pair;
import org.apache.hadoop.hbase.util.Writables;
import org.apache.hadoop.hbase.zookeeper.ZKUtil;
import org.apache.zookeeper.KeeperException;
/**
* Used to communicate with a single HBase table.
@ -201,8 +203,12 @@ public class HTable implements HTableInterface {
* @throws IOException if a remote or network exception occurs
*/
int getCurrentNrHRS() throws IOException {
HBaseAdmin admin = new HBaseAdmin(this.configuration);
return admin.getClusterStatus().getServers();
try {
return ZKUtil.getNumberOfChildren(this.connection.getZooKeeperWatcher(),
this.connection.getZooKeeperWatcher().rsZNode);
} catch (KeeperException ke) {
throw new IOException("Unexpected ZooKeeper exception", ke);
}
}
/**