org.apache.hadoop.mapred
Class StatusHttpServer
java.lang.Object
org.apache.hadoop.mapred.StatusHttpServer
public class StatusHttpServer
- extends Object
Create a Jetty embedded server to answer http requests. The primary goal
is to serve up status information for the server.
There are three contexts:
"/logs/" -> points to the log directory
"/static/" -> points to common static files (src/webapps/static)
"/" -> the jsp server code from (src/webapps/)
- Author:
- Owen O'Malley
Nested Class Summary |
static class |
StatusHttpServer.StackServlet
A very simple servlet to serve up a text representation of the current
stack traces. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StatusHttpServer
public StatusHttpServer(String name,
String bindAddress,
int port,
boolean findPort)
throws IOException
- Create a status server on the given port.
The jsp scripts are taken from src/webapps/.
- Parameters:
name
- The name of the serverport
- The port to use on the serverfindPort
- whether the server should start at the given port and
increment by 1 until it finds a free port.
- Throws:
IOException
setAttribute
public void setAttribute(String name,
Object value)
- Set a value in the webapp context. These values are available to the jsp
pages as "application.getAttribute(name)".
- Parameters:
name
- The name of the attributevalue
- The value of the attribute
addServlet
public <T extends javax.servlet.http.HttpServlet> void addServlet(String name,
String pathSpec,
Class<T> servletClass)
- Add a servlet in the server.
- Parameters:
name
- The name of the servlet (can be passed as null)pathSpec
- The path spec for the servletservletClass
- The servlet class
getAttribute
public Object getAttribute(String name)
- Get the value in the webapp context.
- Parameters:
name
- The name of the attribute
- Returns:
- The value of the attribute
getPort
public int getPort()
- Get the port that the server is on
- Returns:
- the port
setThreads
public void setThreads(int min,
int max)
start
public void start()
throws IOException
- Start the server. Does not wait for the server to start.
- Throws:
IOException
stop
public void stop()
throws InterruptedException
- stop the server
- Throws:
InterruptedException
Copyright © 2006 The Apache Software Foundation