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
This commit is contained in:
Zhihong Yu 2013-01-27 21:07:14 +00:00
parent 275382a7c7
commit 72efa3a4aa
1 changed files with 5 additions and 2 deletions

View File

@ -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);