hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vinayakum...@apache.org
Subject [1/2] hadoop git commit: HDFS-8268. Port conflict log for data node server is not sufficient (Contributed by Mohammad Shahid Khan)
Date Fri, 22 May 2015 10:46:04 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 b95d21c37 -> 658f5cf98
  refs/heads/trunk ab7958f22 -> 0c6638c2e


HDFS-8268. Port conflict log for data node server is not sufficient (Contributed by Mohammad
Shahid Khan)


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

Branch: refs/heads/trunk
Commit: 0c6638c2ea278bd460df88e7118945e461266a8b
Parents: ab7958f
Author: Vinayakumar B <vinayakumarb@apache.org>
Authored: Fri May 22 16:15:15 2015 +0530
Committer: Vinayakumar B <vinayakumarb@apache.org>
Committed: Fri May 22 16:15:15 2015 +0530

----------------------------------------------------------------------
 hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt     |  3 ++
 .../server/datanode/web/DatanodeHttpServer.java | 36 ++++++++++++++++----
 2 files changed, 33 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/0c6638c2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
index 50fccd2..68775da 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
@@ -802,6 +802,9 @@ Release 2.8.0 - UNRELEASED
     HDFS-8454. Remove unnecessary throttling in TestDatanodeDeath.
     (Arpit Agarwal)
 
+    HDFS-8268. Port conflict log for data node server is not sufficient
+    (Mohammad Shahid Khan via vinayakumarb)
+
 Release 2.7.1 - UNRELEASED
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/0c6638c2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/DatanodeHttpServer.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/DatanodeHttpServer.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/DatanodeHttpServer.java
index b620ba6..f461dda 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/DatanodeHttpServer.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/DatanodeHttpServer.java
@@ -42,8 +42,10 @@ import org.apache.hadoop.security.ssl.SSLFactory;
 
 import java.io.Closeable;
 import java.io.IOException;
+import java.net.BindException;
 import java.net.InetSocketAddress;
 import java.net.SocketAddress;
+import java.net.SocketException;
 import java.nio.channels.ServerSocketChannel;
 import java.security.GeneralSecurityException;
 
@@ -142,19 +144,41 @@ public class DatanodeHttpServer implements Closeable {
     return httpsAddress;
   }
 
-  public void start() {
+  public void start() throws IOException {
     if (httpServer != null) {
-      ChannelFuture f = httpServer.bind(DataNode.getInfoAddr(conf));
-      f.syncUninterruptibly();
+      InetSocketAddress infoAddr = DataNode.getInfoAddr(conf);
+      ChannelFuture f = httpServer.bind(infoAddr);
+      try {
+        f.syncUninterruptibly();
+      } catch (Throwable e) {
+        if (e instanceof BindException) {
+          throw NetUtils.wrapException(null, 0, infoAddr.getHostName(),
+              infoAddr.getPort(), (SocketException) e);
+        } else {
+          throw e;
+        }
+      }
       httpAddress = (InetSocketAddress) f.channel().localAddress();
       LOG.info("Listening HTTP traffic on " + httpAddress);
     }
 
     if (httpsServer != null) {
-      InetSocketAddress secInfoSocAddr = NetUtils.createSocketAddr(conf.getTrimmed(
-        DFS_DATANODE_HTTPS_ADDRESS_KEY, DFS_DATANODE_HTTPS_ADDRESS_DEFAULT));
+      InetSocketAddress secInfoSocAddr =
+          NetUtils.createSocketAddr(conf.getTrimmed(
+              DFS_DATANODE_HTTPS_ADDRESS_KEY,
+              DFS_DATANODE_HTTPS_ADDRESS_DEFAULT));
       ChannelFuture f = httpsServer.bind(secInfoSocAddr);
-      f.syncUninterruptibly();
+
+      try {
+        f.syncUninterruptibly();
+      } catch (Throwable e) {
+        if (e instanceof BindException) {
+          throw NetUtils.wrapException(null, 0, secInfoSocAddr.getHostName(),
+              secInfoSocAddr.getPort(), (SocketException) e);
+        } else {
+          throw e;
+        }
+      }
       httpsAddress = (InetSocketAddress) f.channel().localAddress();
       LOG.info("Listening HTTPS traffic on " + httpsAddress);
     }


Mime
View raw message