Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6471916

HotSpotDiagnostic MXBean's getDiagnosticOptions() should return Map<String,VMOption>

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • 6
    • core-svc
    • None

      The HotSpotDiagnosticMXBean (com.sun.management.HotSpotDiagnosticMXBean, a public API) includes the following method:
          List<VMOption> getDiagnosticOptions()
      Logically this should be instead:
          Map<String,VMOption> getDiagnosticOptions()
      since two options cannot have the same name (presumably). This would mean that a caller could find the value of a given option by using something like:
          String value = hotSpotDiagnosticProxy.getDiagnosticOptions().get("PrintGC");
      With the existing definition, the caller has to iterate over the list to find the element with the name of interest.

      Of course it is too late to fix this in JDK 6 and it would be an incompatible change if we made it in JDK 7. However, we could envision adding a second method getDiagnosticOptionMap() that does return Map<String,VMOption>.

      One consequence of the current design is that jconsole cannot show the value of this attribute usefully. List<VMOption> gets mapped by the MXBean mapping rules into CompositeData[], and jconsole currently doesn't know how to display that cleanly. (This is bug 6333561.)

            Unassigned Unassigned
            emcmanus Eamonn McManus
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: