hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r472202 - in /lucene/hadoop/trunk: ./ lib/ lib/jetty-ext/ lib/jsp-2.0/ src/java/org/apache/hadoop/mapred/
Date Tue, 07 Nov 2006 18:59:39 GMT
Author: cutting
Date: Tue Nov  7 10:59:38 2006
New Revision: 472202

URL: http://svn.apache.org/viewvc?view=rev&rev=472202
Log:
HADOOP-565.  Upgrade to Jetty version 6.  Contributed by Sanjay.

Added:
    lucene/hadoop/trunk/lib/jetty-6.0.1.jar   (with props)
    lucene/hadoop/trunk/lib/jetty-util-6.0.1.jar   (with props)
    lucene/hadoop/trunk/lib/jsp-2.0/
    lucene/hadoop/trunk/lib/jsp-2.0/._.DS_Store   (with props)
    lucene/hadoop/trunk/lib/jsp-2.0/ant-1.6.5.jar   (with props)
    lucene/hadoop/trunk/lib/jsp-2.0/commons-el-1.0.jar   (with props)
    lucene/hadoop/trunk/lib/jsp-2.0/jasper-compiler-5.5.15.jar   (with props)
    lucene/hadoop/trunk/lib/jsp-2.0/jasper-compiler-jdt-5.5.15.jar   (with props)
    lucene/hadoop/trunk/lib/jsp-2.0/jasper-runtime-5.5.15.jar   (with props)
    lucene/hadoop/trunk/lib/jsp-2.0/jsp-api-2.0.jar   (with props)
    lucene/hadoop/trunk/lib/jsp-2.0/xercesImpl-2.6.2.jar   (with props)
    lucene/hadoop/trunk/lib/jsp-2.0/xmlParserAPIs-2.6.2.jar   (with props)
    lucene/hadoop/trunk/lib/servlet-api-2.5-6.0.1.jar   (with props)
    lucene/hadoop/trunk/lib/slf4j-jcl.LICENSE.txt
    lucene/hadoop/trunk/lib/slf4j-jcl.jar   (with props)
Removed:
    lucene/hadoop/trunk/lib/jetty-5.1.4.LICENSE.txt
    lucene/hadoop/trunk/lib/jetty-5.1.4.jar
    lucene/hadoop/trunk/lib/jetty-ext/
    lucene/hadoop/trunk/lib/servlet-api.jar
Modified:
    lucene/hadoop/trunk/CHANGES.txt
    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=472202&r1=472201&r2=472202
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Tue Nov  7 10:59:38 2006
@@ -8,6 +8,8 @@
     Also cleaned up constructors for SequenceFile, MapFile, SetFile,
     and ArrayFile a bit.  (cutting)
 
+ 2. HADOOP-565.  Upgrade to Jetty version 6. (Sanjay Dahiya via cutting)
+
 
 Release 0.8.0 - 2006-11-03
 

Added: lucene/hadoop/trunk/lib/jetty-6.0.1.jar
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/lib/jetty-6.0.1.jar?view=auto&rev=472202
==============================================================================
Binary file - no diff available.

Propchange: lucene/hadoop/trunk/lib/jetty-6.0.1.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: lucene/hadoop/trunk/lib/jetty-util-6.0.1.jar
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/lib/jetty-util-6.0.1.jar?view=auto&rev=472202
==============================================================================
Binary file - no diff available.

Propchange: lucene/hadoop/trunk/lib/jetty-util-6.0.1.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: lucene/hadoop/trunk/lib/jsp-2.0/._.DS_Store
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/lib/jsp-2.0/._.DS_Store?view=auto&rev=472202
==============================================================================
Binary file - no diff available.

Propchange: lucene/hadoop/trunk/lib/jsp-2.0/._.DS_Store
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: lucene/hadoop/trunk/lib/jsp-2.0/ant-1.6.5.jar
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/lib/jsp-2.0/ant-1.6.5.jar?view=auto&rev=472202
==============================================================================
Binary file - no diff available.

Propchange: lucene/hadoop/trunk/lib/jsp-2.0/ant-1.6.5.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: lucene/hadoop/trunk/lib/jsp-2.0/commons-el-1.0.jar
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/lib/jsp-2.0/commons-el-1.0.jar?view=auto&rev=472202
==============================================================================
Binary file - no diff available.

Propchange: lucene/hadoop/trunk/lib/jsp-2.0/commons-el-1.0.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: lucene/hadoop/trunk/lib/jsp-2.0/jasper-compiler-5.5.15.jar
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/lib/jsp-2.0/jasper-compiler-5.5.15.jar?view=auto&rev=472202
==============================================================================
Binary file - no diff available.

Propchange: lucene/hadoop/trunk/lib/jsp-2.0/jasper-compiler-5.5.15.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: lucene/hadoop/trunk/lib/jsp-2.0/jasper-compiler-jdt-5.5.15.jar
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/lib/jsp-2.0/jasper-compiler-jdt-5.5.15.jar?view=auto&rev=472202
==============================================================================
Binary file - no diff available.

Propchange: lucene/hadoop/trunk/lib/jsp-2.0/jasper-compiler-jdt-5.5.15.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: lucene/hadoop/trunk/lib/jsp-2.0/jasper-runtime-5.5.15.jar
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/lib/jsp-2.0/jasper-runtime-5.5.15.jar?view=auto&rev=472202
==============================================================================
Binary file - no diff available.

Propchange: lucene/hadoop/trunk/lib/jsp-2.0/jasper-runtime-5.5.15.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: lucene/hadoop/trunk/lib/jsp-2.0/jsp-api-2.0.jar
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/lib/jsp-2.0/jsp-api-2.0.jar?view=auto&rev=472202
==============================================================================
Binary file - no diff available.

Propchange: lucene/hadoop/trunk/lib/jsp-2.0/jsp-api-2.0.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: lucene/hadoop/trunk/lib/jsp-2.0/xercesImpl-2.6.2.jar
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/lib/jsp-2.0/xercesImpl-2.6.2.jar?view=auto&rev=472202
==============================================================================
Binary file - no diff available.

Propchange: lucene/hadoop/trunk/lib/jsp-2.0/xercesImpl-2.6.2.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: lucene/hadoop/trunk/lib/jsp-2.0/xmlParserAPIs-2.6.2.jar
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/lib/jsp-2.0/xmlParserAPIs-2.6.2.jar?view=auto&rev=472202
==============================================================================
Binary file - no diff available.

Propchange: lucene/hadoop/trunk/lib/jsp-2.0/xmlParserAPIs-2.6.2.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: lucene/hadoop/trunk/lib/servlet-api-2.5-6.0.1.jar
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/lib/servlet-api-2.5-6.0.1.jar?view=auto&rev=472202
==============================================================================
Binary file - no diff available.

Propchange: lucene/hadoop/trunk/lib/servlet-api-2.5-6.0.1.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: lucene/hadoop/trunk/lib/slf4j-jcl.LICENSE.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/lib/slf4j-jcl.LICENSE.txt?view=auto&rev=472202
==============================================================================
--- lucene/hadoop/trunk/lib/slf4j-jcl.LICENSE.txt (added)
+++ lucene/hadoop/trunk/lib/slf4j-jcl.LICENSE.txt Tue Nov  7 10:59:38 2006
@@ -0,0 +1,29 @@
+ Copyright (c) 2004-2005 SLF4J.ORG
+ Copyright (c) 2004-2005 QOS.ch
+
+ All rights reserved.
+ 
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to  deal in  the Software without  restriction, including
+ without limitation  the rights to  use, copy, modify,  merge, publish,
+ distribute, and/or sell copies of  the Software, and to permit persons
+ to whom  the Software is furnished  to do so, provided  that the above
+ copyright notice(s) and this permission notice appear in all copies of
+ the  Software and  that both  the above  copyright notice(s)  and this
+ permission notice appear in supporting documentation.
+ 
+ THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
+ EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR  A PARTICULAR PURPOSE AND NONINFRINGEMENT
+ OF  THIRD PARTY  RIGHTS. IN  NO EVENT  SHALL THE  COPYRIGHT  HOLDER OR
+ HOLDERS  INCLUDED IN  THIS  NOTICE BE  LIABLE  FOR ANY  CLAIM, OR  ANY
+ SPECIAL INDIRECT  OR CONSEQUENTIAL DAMAGES, OR  ANY DAMAGES WHATSOEVER
+ RESULTING FROM LOSS  OF USE, DATA OR PROFITS, WHETHER  IN AN ACTION OF
+ CONTRACT, NEGLIGENCE  OR OTHER TORTIOUS  ACTION, ARISING OUT OF  OR IN
+ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ 
+ Except as  contained in  this notice, the  name of a  copyright holder
+ shall not be used in advertising or otherwise to promote the sale, use
+ or other dealings in this Software without prior written authorization
+ of the copyright holder.

Added: lucene/hadoop/trunk/lib/slf4j-jcl.jar
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/lib/slf4j-jcl.jar?view=auto&rev=472202
==============================================================================
Binary file - no diff available.

Propchange: lucene/hadoop/trunk/lib/slf4j-jcl.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

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=472202&r1=472201&r2=472202
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/StatusHttpServer.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/StatusHttpServer.java Tue Nov  7
10:59:38 2006
@@ -18,6 +18,7 @@
 package org.apache.hadoop.mapred;
 
 import java.io.*;
+import java.net.BindException;
 import java.net.URL;
 import java.net.URLDecoder;
 
@@ -26,13 +27,16 @@
 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
@@ -47,9 +51,8 @@
   private static final boolean isWindows = 
     System.getProperty("os.name").startsWith("Windows");
   private org.mortbay.jetty.Server webServer;
-  private SocketListener listener;
+  private WebAppContext webAppContext ;  
   private boolean findPort;
-  private WebApplicationContext webAppContext;
   private static final Log LOG =
     LogFactory.getLog(StatusHttpServer.class.getName());
   
@@ -63,34 +66,37 @@
    */
   public StatusHttpServer(String name, String bindAddress, int port, 
                           boolean findPort) throws IOException {
-    webServer = new org.mortbay.jetty.Server();
+    webServer = new org.mortbay.jetty.Server(port);
     this.findPort = findPort;
-    listener = new SocketListener();
-    listener.setPort(port);
-    listener.setHost(bindAddress);
-    webServer.addListener(listener);
+
+    ContextHandlerCollection contexts = new ContextHandlerCollection();
 
     // set up the context for "/logs/"
-    HttpContext logContext = new HttpContext();
-    logContext.setContextPath("/logs/*");
+    Context logContext = new Context(contexts,"/logs");
+    
     String logDir = System.getProperty("hadoop.log.dir");
     logContext.setResourceBase(logDir);
-    logContext.addHandler(new ResourceHandler());
-    webServer.addContext(logContext);
-
+    logContext.addServlet("org.mortbay.jetty.servlet.DefaultServlet","/");
+    
     // set up the context for "/static/*"
     String appDir = getWebAppsPath();
-    HttpContext staticContext = new HttpContext();
-    staticContext.setContextPath("/static/*");
+    Context staticContext = new Context(contexts,"/static");
     staticContext.setResourceBase(appDir + File.separator + "static");
-    staticContext.addHandler(new ResourceHandler());
-    webServer.addContext(staticContext);
+    staticContext.addServlet("org.mortbay.jetty.servlet.DefaultServlet","/");
 
     // set up the context for "/" jsp files
-    webAppContext = 
-      webServer.addWebApplication("/", appDir + File.separator + name);
-    addServlet("stacks", "/stacks", StackServlet.class);
+    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);
   }
+  
 
   /**
    * Set a value in the webapp context. These values are available to the jsp
@@ -111,20 +117,18 @@
   public <T extends HttpServlet> 
   void addServlet(String name, String pathSpec, 
                   Class<T> servletClass) {
-    WebApplicationContext context = webAppContext;
+    WebAppContext context = webAppContext;
     try {
       if (name == null) {
-        context.addServlet(pathSpec, servletClass.getName());
+        context.addServlet(servletClass, pathSpec);
       } else {
-        context.addServlet(name, pathSpec, servletClass.getName());
+        ServletHolder holder = new ServletHolder(servletClass); 
+        holder.setName(name); 
+        context.addServlet(holder, pathSpec);
       } 
-    } catch (ClassNotFoundException ex) {
-      throw makeRuntimeException("Problem instantiating class", ex);
-    } catch (InstantiationException ex) {
+    } catch (Throwable ex) {
       throw makeRuntimeException("Problem instantiating class", ex);
-    } catch (IllegalAccessException ex) {
-      throw makeRuntimeException("Problem instantiating class", ex);
-    }
+    } 
   }
   
   private static RuntimeException makeRuntimeException(String msg, 
@@ -167,12 +171,13 @@
    * @return the port
    */
   public int getPort() {
-    return listener.getPort();
+    return webServer.getConnectors()[0].getPort(); 
   }
 
   public void setThreads(int min, int max) {
-    listener.setMinThreads(min);
-    listener.setMaxThreads(max);
+    BoundedThreadPool pool = (BoundedThreadPool) webServer.getThreadPool() ;
+    pool.setMinThreads(min); 
+    pool.setMaxThreads(max); 
   }
   /**
    * Start the server. Does not wait for the server to start.
@@ -183,27 +188,34 @@
         try {
           webServer.start();
           break;
-        } catch (org.mortbay.util.MultiException ex) {
+        } catch(BindException be){
+          if( findPort ){
+            webServer.getConnectors()[0].setPort(getPort() + 1);
+          }else{
+            throw be ; 
+          }
+        }catch (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) {
-            Exception sub = ex.getException(i);
+            Throwable sub = ex.getThrowable(i);
+            
             if (sub instanceof java.net.BindException) {
               needNewPort = true;
-              break;
             }
           }
           if (!findPort || !needNewPort) {
             throw ex;
           } else {
-            listener.setPort(listener.getPort() + 1);
+            // Not using multiple connectors
+           webServer.getConnectors()[0].setPort(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;
@@ -214,7 +226,13 @@
    * stop the server
    */
   public void stop() throws InterruptedException {
-    webServer.stop();
+    try{
+      webServer.stop();
+    }catch(InterruptedException ex){
+      throw ex ; 
+    }catch(Exception e){
+      e.printStackTrace(); 
+    }
   }
   
   /**



Mime
View raw message