RFR: 8204170: MXBeanException.java assumes the existence of a pool that doesn't support usage threshold

Stefan Karlsson stefan.karlsson at oracle.com
Thu May 31 17:01:53 UTC 2018


Hi Mandy,

On 2018-05-31 18:44, mandy chung wrote:
> Hi Stefan,
>
> I think a better fix is to find another operation that will throw an 
> exception.  ThreadMXBean::getThreadInfo throws IAE and it can be a 
> candidate.

Thanks for taking a look at this patch.

The test checks a number of different operations, and the suggestion 
would change the test significantly. I'm not sure this is the time to 
completely rewrite this test. If the null check is problematic, then I 
think it would be better to just exclude this test when running with 
ZGC, and get the current testing when running with the other GCs.

Does this sound reasonable?

Thanks,
StefanK

> Mandy
>
> On 5/31/18 6:38 AM, Stefan Karlsson wrote:
>> Hi all,
>>
>> Please review this patch to deal with the case when all available 
>> MemoryPoolMXBeans support usage thresholds.
>>
>> http://cr.openjdk.java.net/~stefank/8204170/webrev.01/
>> https://bugs.openjdk.java.net/browse/JDK-8204170
>>
>> The tests searches for a MemoryPoolMXBean that returns false for 
>> isUsageThresholdSupported(), and then uses one of those pools to 
>> trigger UnsupportedOperationExceptions when setUsageThreshold is used.
>>
>> ZGC doesn't provide a pool that doesn't support usage threshold, and 
>> the test therefore throws an NPE.
>>
>> The suggested fix is to add:
>>          if (pool == null) {
>>            return; // All pools support usage threshold
>>          }
>>
>> An alternative fix would be to filter out the test if ZGC is used.
>>
>> Thanks,
>> StefanK




More information about the serviceability-dev mailing list