hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yiqun Lin (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HDFS-10658) Reduce JsonFactory instance allocation in StartupProgressServlet
Date Wed, 20 Jul 2016 12:07:21 GMT
Yiqun Lin created HDFS-10658:

             Summary: Reduce JsonFactory instance allocation in StartupProgressServlet
                 Key: HDFS-10658
                 URL: https://issues.apache.org/jira/browse/HDFS-10658
             Project: Hadoop HDFS
          Issue Type: Bug
            Reporter: Yiqun Lin
            Assignee: Yiqun Lin

Now in class {{StartupProgressServlet}}, it will always create a new {{JsonFactory}} instance
to create a JsonGenerator. The codes:
  protected void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws IOException {
    resp.setContentType("application/json; charset=UTF-8");
    StartupProgress prog = NameNodeHttpServer.getStartupProgressFromContext(
    StartupProgressView view = prog.createView();
    JsonGenerator json = new JsonFactory().createJsonGenerator(resp.getWriter());
    try {
      json.writeNumberField(ELAPSED_TIME, view.getElapsedTime());
      json.writeNumberField(PERCENT_COMPLETE, view.getPercentComplete());
We can reuse the instance and reduce {{JsonFactory instance}} allocation.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org

View raw message