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

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 0.24.0
    • 2.0.0-alpha
    • None
    • None
    • Reviewed
    • 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. MAPREDUCE-3129.patch
          4 kB
          Devaraj Kavali
        2. HADOOP-7704.patch
          4 kB
          Devaraj Kavali

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: