private static void waitForAllRegionsOnline() throws Exception { // Wait for regions to come back on line again. boolean done = false; while (!done) { Thread.sleep(1); // Nothing in ZK RIT for a start ZKAssign.blockUntilNoRIT(TEST_UTIL.getZooKeeperWatcher()); // Then we want all the regions to be marked as available... if (!isAllRegionsOnline()) continue; // And without any work in progress on the master side if (TEST_UTIL .getMiniHBaseCluster() .getMaster() .getAssignmentManager() .getRegionStates() .isRegionsInTransition()) continue; // nor on the region server side done = true; for (JVMClusterUtil.RegionServerThread rs : TEST_UTIL.getMiniHBaseCluster().getLiveRegionServerThreads()) { if (!rs.getRegionServer().getRegionsInTransitionInRS().isEmpty()) { done = false; } } } }