Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-7704

JsonFactory can be created only once and used for every next request to create JsonGenerator inside JMXJsonServlet

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 0.24.0
    • Fix Version/s: 2.0.0-alpha
    • Component/s: None
    • Labels:
      None
    • Hadoop Flags:
      Reviewed
    • Release Note:
      Reduce number of object created by JMXJsonServlet. (Devaraj K via Eric Yang)

      Description

      1. Currently JMXJsonServlet creates JsonFactory for every http request.
      Its not efficient.
      JsonFactory can be created only once and used for every next request to create JsonGenerator.

      2. Also following null check is not required.

       if (mBeanServer == null) {
              jg.writeStringField("result", "ERROR");
              jg.writeStringField("message", "No MBeanServer could be found");
              jg.close();
              LOG.error("No MBeanServer could be found.");
              response.setStatus(HttpServletResponse.SC_NOT_FOUND);
              return;
       }
      

      Because ManagementFactory.getPlatformMBeanServer(); will not return null.

      3. Move the following code to finally so that any exception should not cause skipping of close method on JsonGenerator

      jg.close();
      

        Attachments

        1. HADOOP-7704.patch
          4 kB
          Devaraj Kavali
        2. MAPREDUCE-3129.patch
          4 kB
          Devaraj Kavali

          Activity

            People

            • Assignee:
              devaraj Devaraj Kavali
              Reporter:
              devaraj Devaraj Kavali
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: