HBASE-9581 Few tests broken since HBASE-9551; ADDENDUM -- aditya followup

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1524870 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2013-09-20 00:26:13 +00:00
parent ccbdd1bc58
commit 107e99b2ca
1 changed files with 20 additions and 4 deletions

View File

@ -953,7 +953,7 @@ public class HBaseTestingUtility extends HBaseCommonTestingUtility {
*/
public void shutdownMiniHBaseCluster() throws IOException {
if (hbaseAdmin != null) {
hbaseAdmin.close();
hbaseAdmin.close0();
hbaseAdmin = null;
}
@ -2274,7 +2274,7 @@ public class HBaseTestingUtility extends HBaseCommonTestingUtility {
/**
* Returns a HBaseAdmin instance.
* This instance is shared between HBaseTestingUtility instance users.
* Don't close it, it will be closed automatically when the
* Closing it has no effect, it will be closed automatically when the
* cluster shutdowns
*
* @return The HBaseAdmin instance.
@ -2283,11 +2283,27 @@ public class HBaseTestingUtility extends HBaseCommonTestingUtility {
public synchronized HBaseAdmin getHBaseAdmin()
throws IOException {
if (hbaseAdmin == null){
hbaseAdmin = new HBaseAdmin(getConfiguration());
hbaseAdmin = new HBaseAdminForTests(getConfiguration());
}
return hbaseAdmin;
}
private HBaseAdmin hbaseAdmin = null;
private HBaseAdminForTests hbaseAdmin = null;
private static class HBaseAdminForTests extends HBaseAdmin {
public HBaseAdminForTests(Configuration c) throws MasterNotRunningException,
ZooKeeperConnectionException, IOException {
super(c);
}
@Override
public synchronized void close() throws IOException {
LOG.warn("close() called on HBaseAdmin instance returned from HBaseTestingUtility.getHBaseAdmin()");
}
private synchronized void close0() throws IOException {
super.close();
}
}
/**
* Returns a ZooKeeperWatcher instance.