jmx-dev RFR: 8010285 Enforce the requirement of Management Interfaces being public

Jaroslav Bachorik jaroslav.bachorik at oracle.com
Wed May 29 02:04:06 PDT 2013


On Wed 29 May 2013 10:09:38 AM CEST, David Holmes wrote:
> Hi Jaroslav,
>
> Just wondering why this needs to be public:
>
> +     public static void testComplianceMBeanInterface(Class<?>
> interfaceClass)
> +             throws NotCompliantMBeanException{
> + StandardMBeanIntrospector.getInstance().getAnalyzer(interfaceClass);
> +     }
>
> Same question goes for the existing testComplianceMXBeanInterface.
> These are public methods on public classes but have no specification
> written for them. ???

The problem is that those methods need to be accessible from 
javax.management.JMX - the package private access would not work. Even 
though they are not meant to be used outside of the JDK code we can not 
prevent it and adding javadocs to them is definitely needed.

-JB-

>
> David
>
> On 29/05/2013 5:32 AM, Jaroslav Bachorik wrote:
>> And the webrev would come handy, of course.
>>
>> http://cr.openjdk.java.net/~jbachorik/8010285/webrev.00/
>>
>> -JB-
>>
>> On 05/28/2013 04:22 PM, Jaroslav Bachorik wrote:
>>> The fix enforces the management interfaces (read MBean and MXBean
>>> interfaces) being public. While this is defined in the specification it
>>> was not enforced in any way and it was allowed to create MBeans for eg.
>>> private MBean interfaces.
>>>
>>> The fix adds checks when creating and registering MBeans and throws
>>> javax.management.NotCompliantMBeanException when a user tries to create
>>> an MBean with non-public management interface.
>>>
>>> Since this change can cause problems for users having non-public
>>> management interfaces a system property is introduced that will revert
>>> to the old behaviour when set (com.sun.jmx.mbeans.allowNonPublic).
>>>
>>> Thanks,
>>>
>>> -JB-
>>>
>>




More information about the serviceability-dev mailing list