Index: src/test/org/apache/hadoop/hbase/HBaseClusterTestCase.java =================================================================== --- src/test/org/apache/hadoop/hbase/HBaseClusterTestCase.java (revision 692551) +++ src/test/org/apache/hadoop/hbase/HBaseClusterTestCase.java (working copy) @@ -145,7 +145,7 @@ protected void tearDown() throws Exception { super.tearDown(); try { - HConnectionManager.deleteConnectionInfo(conf); + HConnectionManager.deleteConnectionInfo(conf, true); if (this.cluster != null) { try { this.cluster.shutdown(); Index: src/test/org/apache/hadoop/hbase/util/DisabledTestMetaUtils.java =================================================================== --- src/test/org/apache/hadoop/hbase/util/DisabledTestMetaUtils.java (revision 692551) +++ src/test/org/apache/hadoop/hbase/util/DisabledTestMetaUtils.java (working copy) @@ -50,7 +50,7 @@ utils.deleteColumn(editTable, Bytes.toBytes(oldColumn)); utils.shutdown(); // Delete again so we go get it all fresh. - HConnectionManager.deleteConnectionInfo(); + HConnectionManager.deleteConnectionInfo(conf, false); // Now assert columns were added and deleted. this.cluster = new MiniHBaseCluster(this.conf, 1); // Now assert columns were added and deleted. Index: src/test/org/apache/hadoop/hbase/util/TestMigrate.java =================================================================== --- src/test/org/apache/hadoop/hbase/util/TestMigrate.java (revision 692551) +++ src/test/org/apache/hadoop/hbase/util/TestMigrate.java (working copy) @@ -134,7 +134,7 @@ // Delete any cached connections. Need to do this because connection was // created earlier when no master was around. The fact that there was no // master gets cached. Need to delete so we go get master afresh. - HConnectionManager.deleteConnectionInfo(); + HConnectionManager.deleteConnectionInfo(conf, false); LOG.info("Start a cluster against migrated FS"); // Up number of retries. Needed while cluster starts up. Its been set to 1 @@ -159,7 +159,7 @@ "changes before opening a scanner"); waitOnStartCodeChange(retries); // Delete again so we go get it all fresh. - HConnectionManager.deleteConnectionInfo(); + HConnectionManager.deleteConnectionInfo(conf, false); HTable t = new HTable(this.conf, TABLENAME); int count = 0; LOG.info("OPENING SCANNER"); @@ -179,7 +179,7 @@ s.close(); } } finally { - HConnectionManager.deleteConnectionInfo(); + HConnectionManager.deleteConnectionInfo(conf, false); cluster.shutdown(); } } Index: src/java/org/apache/hadoop/hbase/HMerge.java =================================================================== --- src/java/org/apache/hadoop/hbase/HMerge.java (revision 692551) +++ src/java/org/apache/hadoop/hbase/HMerge.java (working copy) @@ -76,7 +76,7 @@ throws IOException { HConnection connection = HConnectionManager.getConnection(conf); boolean masterIsRunning = connection.isMasterRunning(); - HConnectionManager.deleteConnectionInfo(conf); + HConnectionManager.deleteConnectionInfo(conf, false); if (Bytes.equals(tableName, META_TABLE_NAME)) { if (masterIsRunning) { throw new IllegalStateException( Index: src/java/org/apache/hadoop/hbase/client/HConnectionManager.java =================================================================== --- src/java/org/apache/hadoop/hbase/client/HConnectionManager.java (revision 692551) +++ src/java/org/apache/hadoop/hbase/client/HConnectionManager.java (working copy) @@ -95,29 +95,18 @@ /** * Delete connection information for the instance specified by the configuration * @param conf + * @param stopProxy */ - public static void deleteConnectionInfo(HBaseConfiguration conf) { + public static void deleteConnectionInfo(HBaseConfiguration conf, + boolean stopProxy) { synchronized (HBASE_INSTANCES) { TableServers t = HBASE_INSTANCES.remove(conf.get(HBASE_DIR)); if (t != null) { - t.close(); + t.close(stopProxy); } } } - /** - * Clear the static map of connection info. - */ - public static void deleteConnectionInfo() { - synchronized (HBASE_INSTANCES) { - for (TableServers t: HBASE_INSTANCES.values()) { - t.close(); - } - HBASE_INSTANCES.clear(); - } - } - - /* Encapsulates finding the servers for an HBase instance */ private static class TableServers implements HConnection, HConstants { private static final Log LOG = LogFactory.getLog(TableServers.class); @@ -894,15 +883,19 @@ return null; } - void close() { + void close(boolean stopProxy) { if (master != null) { - HbaseRPC.stopProxy(master); + if (stopProxy) { + HbaseRPC.stopProxy(master); + } master = null; masterChecked = false; } - synchronized (servers) { - for (HRegionInterface i: servers.values()) { - HbaseRPC.stopProxy(i); + if (stopProxy) { + synchronized (servers) { + for (HRegionInterface i: servers.values()) { + HbaseRPC.stopProxy(i); + } } } } Index: src/java/org/apache/hadoop/hbase/client/HBaseAdmin.java =================================================================== --- src/java/org/apache/hadoop/hbase/client/HBaseAdmin.java (revision 692551) +++ src/java/org/apache/hadoop/hbase/client/HBaseAdmin.java (working copy) @@ -267,7 +267,7 @@ } } // Delete cached information to prevent clients from using old locations - HConnectionManager.deleteConnectionInfo(conf); + HConnectionManager.deleteConnectionInfo(conf, false); LOG.info("Deleted " + Bytes.toString(tableName)); }