hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r478346 - in /lucene/hadoop/trunk: ./ bin/ lib/ lib/jetty-ext/ lib/jsp-2.0/ src/java/org/apache/hadoop/mapred/
Date Wed, 22 Nov 2006 22:26:52 GMT
Author: cutting
Date: Wed Nov 22 14:26:51 2006
New Revision: 478346

URL: http://svn.apache.org/viewvc?view=rev&rev=478346
Log:
HADOOP-736.  Roll back to Jetty 5.1.4, reverting changes in revisions 472349 and 472202, from
HADOOP-565.

Added:
    lucene/hadoop/trunk/lib/jetty-5.1.4.LICENSE.txt
      - copied unchanged from r472201, lucene/hadoop/trunk/lib/jetty-5.1.4.LICENSE.txt
    lucene/hadoop/trunk/lib/jetty-5.1.4.jar
      - copied unchanged from r472201, lucene/hadoop/trunk/lib/jetty-5.1.4.jar
    lucene/hadoop/trunk/lib/jetty-ext/
      - copied from r472201, lucene/hadoop/trunk/lib/jetty-ext/
    lucene/hadoop/trunk/lib/jetty-ext/ant.jar
      - copied unchanged from r472201, lucene/hadoop/trunk/lib/jetty-ext/ant.jar
    lucene/hadoop/trunk/lib/jetty-ext/commons-el.jar
      - copied unchanged from r472201, lucene/hadoop/trunk/lib/jetty-ext/commons-el.jar
    lucene/hadoop/trunk/lib/jetty-ext/jasper-compiler.jar
      - copied unchanged from r472201, lucene/hadoop/trunk/lib/jetty-ext/jasper-compiler.jar
    lucene/hadoop/trunk/lib/jetty-ext/jasper-runtime.jar
      - copied unchanged from r472201, lucene/hadoop/trunk/lib/jetty-ext/jasper-runtime.jar
    lucene/hadoop/trunk/lib/jetty-ext/jsp-api.jar
      - copied unchanged from r472201, lucene/hadoop/trunk/lib/jetty-ext/jsp-api.jar
    lucene/hadoop/trunk/lib/servlet-api.jar
      - copied unchanged from r472201, lucene/hadoop/trunk/lib/servlet-api.jar
Removed:
    lucene/hadoop/trunk/lib/jetty-6.0.1.jar
    lucene/hadoop/trunk/lib/jetty-util-6.0.1.jar
    lucene/hadoop/trunk/lib/jsp-2.0/
    lucene/hadoop/trunk/lib/servlet-api-2.5-6.0.1.jar
    lucene/hadoop/trunk/lib/slf4j-jcl.LICENSE.txt
    lucene/hadoop/trunk/lib/slf4j-jcl.jar
Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/bin/hadoop
    lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/StatusHttpServer.java

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?view=diff&rev=478346&r1=478345&r2=478346
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Wed Nov 22 14:26:51 2006
@@ -122,6 +122,9 @@
     location and moved to the final location when reduce is complete.
     (Sanjay Dahiya via cutting)
 
+36. HADOOP-736.  Roll back to Jetty 5.1.4, due to performance problems
+    with Jetty 6.0.1.
+
 
 Release 0.8.0 - 2006-11-03
 

Modified: lucene/hadoop/trunk/bin/hadoop
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/bin/hadoop?view=diff&rev=478346&r1=478345&r2=478346
==============================================================================
--- lucene/hadoop/trunk/bin/hadoop (original)
+++ lucene/hadoop/trunk/bin/hadoop Wed Nov 22 14:26:51 2006
@@ -103,7 +103,7 @@
   CLASSPATH=${CLASSPATH}:$f;
 done
 
-for f in $HADOOP_HOME/lib/jsp-2.0/*.jar; do
+for f in $HADOOP_HOME/lib/jetty-ext/*.jar; do
   CLASSPATH=${CLASSPATH}:$f;
 done
 

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/StatusHttpServer.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/StatusHttpServer.java?view=diff&rev=478346&r1=478345&r2=478346
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/StatusHttpServer.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/StatusHttpServer.java Wed Nov 22
14:26:51 2006
@@ -18,7 +18,6 @@
 package org.apache.hadoop.mapred;
 
 import java.io.*;
-import java.net.BindException;
 import java.net.URL;
 import java.net.URLDecoder;
 
@@ -27,16 +26,13 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.mortbay.jetty.handler.ContextHandlerCollection;
-import org.mortbay.jetty.servlet.Context;
-import org.mortbay.jetty.servlet.ServletHolder;
-import org.mortbay.jetty.webapp.WebAppContext;
-import org.mortbay.thread.BoundedThreadPool;
-import org.mortbay.util.MultiException;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.util.*;
-
+import org.mortbay.http.HttpContext;
+import org.mortbay.http.handler.ResourceHandler;
+import org.mortbay.http.SocketListener;
+import org.mortbay.jetty.servlet.WebApplicationContext;
 
 /**
  * Create a Jetty embedded server to answer http requests. The primary goal
@@ -51,8 +47,9 @@
   private static final boolean isWindows = 
     System.getProperty("os.name").startsWith("Windows");
   private org.mortbay.jetty.Server webServer;
-  private WebAppContext webAppContext ;  
+  private SocketListener listener;
   private boolean findPort;
+  private WebApplicationContext webAppContext;
   private static final Log LOG =
     LogFactory.getLog(StatusHttpServer.class.getName());
   
@@ -66,37 +63,34 @@
    */
   public StatusHttpServer(String name, String bindAddress, int port, 
                           boolean findPort) throws IOException {
-    webServer = new org.mortbay.jetty.Server(port);
+    webServer = new org.mortbay.jetty.Server();
     this.findPort = findPort;
-
-    ContextHandlerCollection contexts = new ContextHandlerCollection();
+    listener = new SocketListener();
+    listener.setPort(port);
+    listener.setHost(bindAddress);
+    webServer.addListener(listener);
 
     // set up the context for "/logs/"
-    Context logContext = new Context(contexts,"/logs");
-    
+    HttpContext logContext = new HttpContext();
+    logContext.setContextPath("/logs/*");
     String logDir = System.getProperty("hadoop.log.dir");
     logContext.setResourceBase(logDir);
-    logContext.addServlet("org.mortbay.jetty.servlet.DefaultServlet","/");
-    
+    logContext.addHandler(new ResourceHandler());
+    webServer.addContext(logContext);
+
     // set up the context for "/static/*"
     String appDir = getWebAppsPath();
-    Context staticContext = new Context(contexts,"/static");
+    HttpContext staticContext = new HttpContext();
+    staticContext.setContextPath("/static/*");
     staticContext.setResourceBase(appDir + File.separator + "static");
-    staticContext.addServlet("org.mortbay.jetty.servlet.DefaultServlet","/");
+    staticContext.addHandler(new ResourceHandler());
+    webServer.addContext(staticContext);
 
     // set up the context for "/" jsp files
-    webAppContext = new WebAppContext() ;
-    webAppContext.setContextPath("/");
-    webAppContext.setWar(appDir + File.separator + name); 
-    contexts.addHandler(webAppContext); 
-
-    Context stackContext = new Context(contexts,"/stacks");
-    stackContext.addServlet(StackServlet.class, "/"); 
-    // used as default but still set, in case it changes in future versions
-    webServer.setThreadPool(new BoundedThreadPool()); 
-    webServer.setHandler(contexts);
+    webAppContext = 
+      webServer.addWebApplication("/", appDir + File.separator + name);
+    addServlet("stacks", "/stacks", StackServlet.class);
   }
-  
 
   /**
    * Set a value in the webapp context. These values are available to the jsp
@@ -117,18 +111,20 @@
   public <T extends HttpServlet> 
   void addServlet(String name, String pathSpec, 
                   Class<T> servletClass) {
-    WebAppContext context = webAppContext;
+    WebApplicationContext context = webAppContext;
     try {
       if (name == null) {
-        context.addServlet(servletClass, pathSpec);
+        context.addServlet(pathSpec, servletClass.getName());
       } else {
-        ServletHolder holder = new ServletHolder(servletClass); 
-        holder.setName(name); 
-        context.addServlet(holder, pathSpec);
+        context.addServlet(name, pathSpec, servletClass.getName());
       } 
-    } catch (Throwable ex) {
+    } catch (ClassNotFoundException ex) {
+      throw makeRuntimeException("Problem instantiating class", ex);
+    } catch (InstantiationException ex) {
       throw makeRuntimeException("Problem instantiating class", ex);
-    } 
+    } catch (IllegalAccessException ex) {
+      throw makeRuntimeException("Problem instantiating class", ex);
+    }
   }
   
   private static RuntimeException makeRuntimeException(String msg, 
@@ -171,13 +167,12 @@
    * @return the port
    */
   public int getPort() {
-    return webServer.getConnectors()[0].getPort(); 
+    return listener.getPort();
   }
 
   public void setThreads(int min, int max) {
-    BoundedThreadPool pool = (BoundedThreadPool) webServer.getThreadPool() ;
-    pool.setMinThreads(min); 
-    pool.setMaxThreads(max); 
+    listener.setMinThreads(min);
+    listener.setMaxThreads(max);
   }
   /**
    * Start the server. Does not wait for the server to start.
@@ -188,34 +183,27 @@
         try {
           webServer.start();
           break;
-        } catch(BindException be){
-          if( findPort ){
-            webServer.getConnectors()[0].setPort(getPort() + 1);
-          }else{
-            throw be ; 
-          }
-        }catch (MultiException ex) {
+        } catch (org.mortbay.util.MultiException ex) {
           // look for the multi exception containing a bind exception,
           // in that case try the next port number.
           boolean needNewPort = false;
           for(int i=0; i < ex.size(); ++i) {
-            Throwable sub = ex.getThrowable(i);
-            
+            Exception sub = ex.getException(i);
             if (sub instanceof java.net.BindException) {
               needNewPort = true;
+              break;
             }
           }
           if (!findPort || !needNewPort) {
             throw ex;
           } else {
-            // Not using multiple connectors
-           webServer.getConnectors()[0].setPort(getPort() + 1);
+            listener.setPort(listener.getPort() + 1);
           }
         }
       }
-    }catch (IOException ie) {
+    } catch (IOException ie) {
       throw ie;
-    }catch (Exception e) {
+    } catch (Exception e) {
       IOException ie = new IOException("Problem starting http server");
       ie.initCause(e);
       throw ie;
@@ -226,13 +214,7 @@
    * stop the server
    */
   public void stop() throws InterruptedException {
-    try{
-      webServer.stop();
-    }catch(InterruptedException ex){
-      throw ex ; 
-    }catch(Exception e){
-      e.printStackTrace(); 
-    }
+    webServer.stop();
   }
   
   /**



Mime
View raw message