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.

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

Reply via email to