8303136: MemoryPoolMBean/isCollectionUsageThresholdExceeded/isexceeded005 failed with "isCollectionUsageThresholdExceeded() returned true, while threshold = 1 and used = 0"

Reviewed-by: cjplummer, sspitsyn
This commit is contained in:
Kevin Walls 2023-03-08 08:20:27 +00:00
parent 1d071d0817
commit afda8fbf0b

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -120,15 +120,11 @@ public class isexceeded001 {
isExceeded = monitor.isCollectionThresholdExceeded(pool);
if (!isExceeded) {
// Refresh the values
threshold = monitor.getCollectionThreshold(pool);
usage = monitor.getCollectionUsage(pool);
if (used >= threshold) {
log.complain("isCollectionUsageThresholdExceeded() "
+ "returned false, while threshold = "
+ threshold + " and " + "used = " + used);
testFailed = true;
}
// Don't refresh the values: usage may have decreased outside our control.
log.complain("isCollectionUsageThresholdExceeded() "
+ "returned false, while threshold = "
+ threshold + " and " + "used = " + used);
testFailed = true;
}
} else {
log.display(" used value (" + used + ") did not cross the "
@ -137,9 +133,10 @@ public class isexceeded001 {
isExceeded = monitor.isCollectionThresholdExceeded(pool);
if (isExceeded) {
// Refresh the values
// Refresh the values: usage may have increased outside our control.
threshold = monitor.getCollectionThreshold(pool);
usage = monitor.getCollectionUsage(pool);
used = usage.getUsed();
if (used < threshold) {
log.complain("isCollectionUsageThresholdExceeded() "
+ "returned true, while threshold = "