diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestWebHdfsTimeouts.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestWebHdfsTimeouts.java index a693ac3d5e9..7b445153884 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestWebHdfsTimeouts.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestWebHdfsTimeouts.java @@ -35,7 +35,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; -import java.util.concurrent.TimeoutException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -48,7 +47,6 @@ import org.apache.hadoop.net.NetUtils; import org.apache.hadoop.security.authentication.client.ConnectionConfigurator; import org.apache.hadoop.test.GenericTestUtils; import org.junit.After; -import org.junit.AssumptionViolatedException; import org.junit.Before; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -87,7 +85,6 @@ public class TestWebHdfsTimeouts { return conn; } }); - private volatile boolean failedToConsumeBacklog; public enum TimeoutSource { ConnectionFactory, Configuration }; @@ -126,7 +123,6 @@ public class TestWebHdfsTimeouts { clients = new ArrayList(); serverThread = null; - failedToConsumeBacklog = false; } @After @@ -217,7 +213,6 @@ public class TestWebHdfsTimeouts { fs.getFileChecksum(new Path("/file")); fail("expected timeout"); } catch (SocketTimeoutException e) { - assumeBacklogConsumed(); GenericTestUtils.assertExceptionContains( fs.getUri().getAuthority() + ": connect timed out", e); } @@ -251,7 +246,6 @@ public class TestWebHdfsTimeouts { os = fs.create(new Path("/file")); fail("expected timeout"); } catch (SocketTimeoutException e) { - assumeBacklogConsumed(); GenericTestUtils.assertExceptionContains( fs.getUri().getAuthority() + ": connect timed out", e); } finally { @@ -365,28 +359,6 @@ public class TestWebHdfsTimeouts { client.connect(nnHttpAddress); clients.add(client); } - try { - GenericTestUtils.waitFor(() -> { - try (SocketChannel c = SocketChannel.open()) { - c.socket().connect(nnHttpAddress, 100); - } catch (SocketTimeoutException e) { - return true; - } catch (IOException e) { - LOG.debug("unexpected exception: " + e); - } - return false; - }, 100, 10000); - } catch (TimeoutException | InterruptedException e) { - failedToConsumeBacklog = true; - assumeBacklogConsumed(); - } - } - - private void assumeBacklogConsumed() { - if (failedToConsumeBacklog) { - throw new AssumptionViolatedException( - "failed to fill up connection backlog."); - } } /**