From 72efa3a4aa1df66234823282a0025a9820694997 Mon Sep 17 00:00:00 2001 From: Zhihong Yu Date: Sun, 27 Jan 2013 21:07:14 +0000 Subject: [PATCH] HBASE-7687 TestCatalogTracker.testServerNotRunningIOException fails occasionally (Ted Yu) git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1439180 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/hadoop/hbase/catalog/TestCatalogTracker.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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);