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

Add methods for class interrogation to DynamicMBean

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 6
    • Fix Version/s: 7
    • Component/s: core-svc
    • Labels:

      Description

      It would be useful if DynamicMBean had the following methods:

      public boolean isInstanceOf(String className);
      public ClassLoader getClassLoader();

      The isInstanceOf method would be called by MBeanServer.isInstanceOf, and would allow an MBean to say whether it should be considered to be an instance of the named class or not. For example, if you create a StandardMBean like this:
          new javax.management.StandardMBean(impl, MyMBean.class);
      then MBeanServer.isInstanceOf(objectName, MyMBean.class.getName()) should return true. Today StandardMBean only returns true if the StandardMBean class itself is a subclass of the named class. Similarly for Model MBeans.

      The getClassLoader method would be called by MBeanServer.getClassLoaderFor. The usage would be similar. For example, in the StandardMBean example above, it would return MyMBean.class.getClassLoader() or maybe impl.getClassLoader().

      There are some compatibility requirements. We cannot in fact add new methods to the DynamicMBean interface, because existing code that implements that interface would then no longer compile, since it would not implement the new methods. Therefore there needs to be a new subinterface of DynamicMBean, say DynamicMBean2, ExtendedDynamicMBean, ClassAwareDynamicMBean, or whatever.

      Concerning the StandardMBean class, having it return different values for isInstanceOf and getClassLoaderFor from what it returns today would be an incompatible change and could break existing code. Therefore it should only do this if explicitly asked to through a new API, for example a new constructor with a boolean argument that says whether to do this or not.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sjiang Shanliang Jiang (Inactive)
                Reporter:
                emcmanus Eamonn McManus
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: