|
@@ -27,6 +27,7 @@ import java.io.IOException;
|
|
import java.net.URI;
|
|
import java.net.URI;
|
|
import java.util.Collection;
|
|
import java.util.Collection;
|
|
|
|
|
|
|
|
+import com.google.common.base.Supplier;
|
|
import org.apache.hadoop.conf.Configuration;
|
|
import org.apache.hadoop.conf.Configuration;
|
|
import org.apache.hadoop.fs.FileUtil;
|
|
import org.apache.hadoop.fs.FileUtil;
|
|
import org.apache.hadoop.hdfs.DFSTestUtil;
|
|
import org.apache.hadoop.hdfs.DFSTestUtil;
|
|
@@ -48,6 +49,7 @@ import org.mockito.internal.util.reflection.Whitebox;
|
|
import java.util.concurrent.CountDownLatch;
|
|
import java.util.concurrent.CountDownLatch;
|
|
import java.util.concurrent.ExecutorService;
|
|
import java.util.concurrent.ExecutorService;
|
|
import java.util.concurrent.Executors;
|
|
import java.util.concurrent.Executors;
|
|
|
|
+import java.util.concurrent.TimeoutException;
|
|
|
|
|
|
public class TestFSNamesystem {
|
|
public class TestFSNamesystem {
|
|
|
|
|
|
@@ -241,8 +243,16 @@ public class TestFSNamesystem {
|
|
}
|
|
}
|
|
|
|
|
|
latch.await();
|
|
latch.await();
|
|
- Assert.assertEquals("Expected number of blocked thread not found",
|
|
|
|
- threadCount, rwLock.getQueueLength());
|
|
|
|
|
|
+ try {
|
|
|
|
+ GenericTestUtils.waitFor(new Supplier<Boolean>() {
|
|
|
|
+ @Override
|
|
|
|
+ public Boolean get() {
|
|
|
|
+ return (threadCount == rwLock.getQueueLength());
|
|
|
|
+ }
|
|
|
|
+ }, 10, 1000);
|
|
|
|
+ } catch (TimeoutException e) {
|
|
|
|
+ fail("Expected number of blocked thread not found");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|