diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/catalog/TestCatalogTracker.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/catalog/TestCatalogTracker.java index 4ae4f2ba408..f6054be9641 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/catalog/TestCatalogTracker.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/catalog/TestCatalogTracker.java @@ -22,6 +22,7 @@ import static org.junit.Assert.assertTrue; import java.io.IOException; import java.net.ConnectException; +import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; @@ -230,18 +231,20 @@ public class TestCatalogTracker { // So, do this in a thread and then reset meta location to break it out // of its wait after a bit of time. final AtomicBoolean metaSet = new AtomicBoolean(false); + final CountDownLatch latch = new CountDownLatch(1); Thread t = new Thread() { @Override public void run() { try { - metaSet.set(ct.waitForMetaServerConnection(100000) != null); + latch.countDown(); + metaSet.set(ct.waitForMeta(100000) != null); } catch (Exception e) { throw new RuntimeException(e); } } }; t.start(); - while(!t.isAlive()) Threads.sleep(1); + latch.await(); Threads.sleep(1); // Now reset the meta as though it were redeployed. ct.setMetaLocation(SN);