hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [23/31] hadoop git commit: HDFS-11462. Fix occasional BindException in TestNameNodeMetricsLogger.
Date Mon, 27 Feb 2017 15:15:19 GMT
HDFS-11462. Fix occasional BindException in TestNameNodeMetricsLogger.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/120bef7d
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/120bef7d
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/120bef7d

Branch: refs/heads/HADOOP-13345
Commit: 120bef7de81de96854156da192c855035b7d3e7a
Parents: 4a58870
Author: Arpit Agarwal <arp@apache.org>
Authored: Fri Feb 24 19:53:39 2017 -0800
Committer: Arpit Agarwal <arp@apache.org>
Committed: Fri Feb 24 19:53:39 2017 -0800

----------------------------------------------------------------------
 .../hdfs/server/namenode/TestNameNodeMetricsLogger.java  | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/120bef7d/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameNodeMetricsLogger.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameNodeMetricsLogger.java
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameNodeMetricsLogger.java
index 6968bc4..9a0e67c 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameNodeMetricsLogger.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameNodeMetricsLogger.java
@@ -25,7 +25,6 @@ import org.apache.commons.logging.impl.Log4JLogger;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hdfs.HdfsConfiguration;
 import org.apache.hadoop.metrics2.util.MBeans;
-import org.apache.hadoop.net.ServerSocketUtil;
 import org.apache.hadoop.test.GenericTestUtils;
 import org.apache.log4j.Appender;
 import org.apache.log4j.AppenderSkeleton;
@@ -38,7 +37,6 @@ import org.junit.rules.Timeout;
 import java.io.IOException;
 import java.util.Collections;
 import java.util.List;
-import java.util.Random;
 import java.util.concurrent.TimeoutException;
 import java.util.regex.Pattern;
 
@@ -51,7 +49,6 @@ import static org.mockito.Mockito.mock;
  */
 public class TestNameNodeMetricsLogger {
   static final Log LOG = LogFactory.getLog(TestNameNodeMetricsLogger.class);
-  static final Random random = new Random(System.currentTimeMillis());
 
   @Rule
   public Timeout timeout = new Timeout(300000);
@@ -112,17 +109,13 @@ public class TestNameNodeMetricsLogger {
   private NameNode makeNameNode(boolean enableMetricsLogging)
       throws IOException {
     Configuration conf = new HdfsConfiguration();
-    conf.set(FS_DEFAULT_NAME_KEY, "hdfs://localhost:" + getRandomPort());
-    conf.set(DFS_NAMENODE_HTTP_ADDRESS_KEY, "0.0.0.0:" + getRandomPort());
+    conf.set(FS_DEFAULT_NAME_KEY, "hdfs://localhost:0");
+    conf.set(DFS_NAMENODE_HTTP_ADDRESS_KEY, "0.0.0.0:0");
     conf.setInt(DFS_NAMENODE_METRICS_LOGGER_PERIOD_SECONDS_KEY,
         enableMetricsLogging ? 1 : 0);  // If enabled, log early and log often
     return new TestNameNode(conf);
   }
 
-  private int getRandomPort() throws IOException {
-    return ServerSocketUtil.getPort(0, 10);
-  }
-
   private void addAppender(Log log, Appender appender) {
     org.apache.log4j.Logger logger = ((Log4JLogger) log).getLogger();
     @SuppressWarnings("unchecked")


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message