hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c..@apache.org
Subject svn commit: r888565 - in /hadoop/common/trunk: CHANGES.txt src/java/org/apache/hadoop/http/HttpServer.java
Date Tue, 08 Dec 2009 20:50:48 GMT
Author: cos
Date: Tue Dec  8 20:50:47 2009
New Revision: 888565

URL: http://svn.apache.org/viewvc?rev=888565&view=rev
Log:
HADOOP-6386. NameNode's HttpServer can't instantiate InetSocketAddress: IllegalArgumentException
is thrown. Contributed by Konstantin Boudnik.

Modified:
    hadoop/common/trunk/CHANGES.txt
    hadoop/common/trunk/src/java/org/apache/hadoop/http/HttpServer.java

Modified: hadoop/common/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/CHANGES.txt?rev=888565&r1=888564&r2=888565&view=diff
==============================================================================
--- hadoop/common/trunk/CHANGES.txt (original)
+++ hadoop/common/trunk/CHANGES.txt Tue Dec  8 20:50:47 2009
@@ -59,6 +59,9 @@
 
     HADOOP-6411. Remove deprecated file src/test/hadoop-site.xml. (cos)
 
+    HADOOP-6386. NameNode's HttpServer can't instantiate InetSocketAddress:
+    IllegalArgumentException is thrown (cos)
+
 Release 0.21.0 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/trunk/src/java/org/apache/hadoop/http/HttpServer.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/java/org/apache/hadoop/http/HttpServer.java?rev=888565&r1=888564&r2=888565&view=diff
==============================================================================
--- hadoop/common/trunk/src/java/org/apache/hadoop/http/HttpServer.java (original)
+++ hadoop/common/trunk/src/java/org/apache/hadoop/http/HttpServer.java Tue Dec  8 20:50:47
2009
@@ -27,6 +27,7 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Random;
 
 import javax.servlet.Filter;
 import javax.servlet.FilterChain;
@@ -469,6 +470,33 @@
           } //Workaround end
           LOG.info("Jetty bound to port " + port);
           webServer.start();
+          // Workaround for HADOOP-6386
+          port = listener.getLocalPort();
+          if (port < 0) {
+            LOG.warn("Bounds port is " + port + " after webserver start");
+            Random r = new Random(1000);
+            for (int i = 0; i < MAX_RETRIES/2; i++) {
+              try {
+                webServer.stop();
+              } catch (Exception e) {
+                LOG.warn("Can't stop  web-server", e);
+              }
+              Thread.sleep(r.nextInt());
+              
+              listener.setPort(oriPort == 0 ? 0 : (oriPort += 1));
+              listener.open();
+              Thread.sleep(100);
+              webServer.start();
+              LOG.info(i + "attempts to restart webserver");
+              port = listener.getLocalPort();
+              if (port > 0)
+                break;
+            }
+            if (port < 0)
+              throw new Exception("listener.getLocalPort() is returning " +
+                		"less than 0 even after " +MAX_RETRIES+" resets");
+          }
+          // End of HADOOP-6386 workaround
           break;
         } catch (IOException ex) {
           // if this is a bind exception,



Mime
View raw message