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

Add GetResource interface to control MBeanServer.getClassLoaderFor and .isInstanceOf

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 6, 7
    • Fix Version/s: 7
    • Component/s: core-svc
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b30
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Not verified

      Description

      It is often desirable to have getClassLoaderFor and isInstanceOf return values based on some object other than the actual MBean object. The classic example is javax.management.StandardMBean, where getClassLoaderFor is utterly uninteresting. We know that some users have resorted to writing
          Object mbean = new StandardMBean(...) {}
      to create an anonymous subclass of StandardMBean that is defined by that code's ClassLoader. That is clunky, and not always an option.

      An example of when you might want to do this is if you want to access resources from the MBean's ClassLoader, for example to control localization or permission checking. If the MBean is an instance of StandardMBean, then what you really want to see is the ClassLoader of the wrapped object, because that's where the resources will live.

      The proposal is to define a new interface javax.management.GetResource with just one method:
          public Object getResource();
      If an MBean is an instance of GetResource, then MBeanServer.getClassLoaderFor and .isInstanceOf will operate on the object returned by getResource() rather than the MBean object itself.

      The classes StandardMBean and RequiredModelMBean will implement GetResource. To avoid changing the behavior of existing code, the default getResource() will return the StandardMBean or RequiredModelMBean object itself, but an option will allow the MBean to be configured to return the wrapped object instead.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                emcmanus Eamonn McManus
                Reporter:
                emcmanus Eamonn McManus
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: