On Thu, 4 Jan 2024 10:02:39 GMT, Kevin Walls <kev...@openjdk.org> wrote:

>> test/jdk/javax/management/Introspector/ClassLeakTest.java line 53:
>> 
>>> 51: 
>>> 52:         MBeanServer mbs = MBeanServerFactory.createMBeanServer();
>>> 53:         ObjectName testName = new ObjectName("x:name=Test");
>> 
>> Q: I'd just like to understand why it is `x:name=Test` instead of 
>> `x:type=Test` as it was before.
>
> These ObjectName patterns (domain:key=value) don't matter very much for these 
> test mbeans.
> We just need an ObjectName to pass when registering the MBean, and also to 
> use when querying, e.g. calling getMBeanInfo.
> 
> The domain part was "x" but could be empty, but it must also define at least 
> one key=value.
> The "type=mlet" might still work (I just tested: it does 8-) ), but I wanted 
> to remove it as it would be misleading.
> So we need to add some key=value and just giving a name is enough.

In ClassLeakTest.java, it was creating two MBeans, but now only creates one.
It was creating a PrivateMLet (which it registers using type=mlet) and 
comparing classloader with another MBean.  The second MBean is created using 
the m-let name as the "loader name" parameter to mbs.createMBean().  This 
doesn't make sense without MLets, which are classloaders.  

The test retains is stated goal of checking a reference to the MBean class is 
not retained after it is unloaded.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/16363#discussion_r1441576425

Reply via email to