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 13:38:48 UTC 2018


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 hotspot-dev mailing list