Class NetworkTopologyServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.apache.hadoop.hdfs.server.namenode.DfsServlet
org.apache.hadoop.hdfs.server.namenode.NetworkTopologyServlet
- All Implemented Interfaces:
Serializable,javax.servlet.Servlet,javax.servlet.ServletConfig
A servlet to print out the network topology.
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddoGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) protected static StringparseAcceptHeader(javax.servlet.http.HttpServletRequest request) protected voidprintJsonFormat(PrintStream stream, Map<String, TreeSet<String>> tree, ArrayList<String> racks) protected voidprintTextFormat(PrintStream stream, Map<String, TreeSet<String>> tree, ArrayList<String> racks) protected voidprintTopology(PrintStream stream, List<org.apache.hadoop.net.Node> leaves, String format) Display each rack and the nodes assigned to that rack, as determined by the NameNode, in a hierarchical manner.Methods inherited from class org.apache.hadoop.hdfs.server.namenode.DfsServlet
getUGIMethods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, serviceMethods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
-
Field Details
-
SERVLET_NAME
- See Also:
-
PATH_SPEC
- See Also:
-
FORMAT_JSON
- See Also:
-
FORMAT_TEXT
- See Also:
-
-
Constructor Details
-
NetworkTopologyServlet
public NetworkTopologyServlet()
-
-
Method Details
-
doGet
public void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException - Overrides:
doGetin classjavax.servlet.http.HttpServlet- Throws:
IOException
-
printTopology
protected void printTopology(PrintStream stream, List<org.apache.hadoop.net.Node> leaves, String format) throws NetworkTopologyServlet.BadFormatException, IOException Display each rack and the nodes assigned to that rack, as determined by the NameNode, in a hierarchical manner. The nodes and racks are sorted alphabetically.- Parameters:
stream- print streamleaves- leaves nodes under base scopeformat- the response format- Throws:
NetworkTopologyServlet.BadFormatExceptionIOException
-
printJsonFormat
protected void printJsonFormat(PrintStream stream, Map<String, TreeSet<String>> tree, ArrayList<String> racks) throws IOException- Throws:
IOException
-
printTextFormat
-
parseAcceptHeader
@VisibleForTesting protected static String parseAcceptHeader(javax.servlet.http.HttpServletRequest request)
-