8373111: Test java/lang/management/MemoryMXBean/MemoryManagement.java timed out

Reviewed-by: shade
Backport-of: 9c91c68d1d5938d7e2b9a90c82b0a36ef1a063cd
This commit is contained in:
Kevin Walls 2025-12-10 19:10:26 +00:00
parent 15b5789f55
commit 7dc8f786fe

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2025, 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
@ -49,7 +49,7 @@
*
* @modules jdk.management
*
* @run main/timeout=600 MemoryManagement
* @run main/othervm/timeout=600 -Xmn8m MemoryManagement
*/
import java.lang.management.*;
@ -58,6 +58,10 @@ import javax.management.*;
import javax.management.openmbean.CompositeData;
public class MemoryManagement {
private static final int YOUNG_GEN_SIZE = 8 * 1024 * 1024; // Must match -Xmn set on the @run line
private static final int NUM_CHUNKS = 2;
private static final MemoryMXBean mm = ManagementFactory.getMemoryMXBean();
private static final List pools =
Collections.synchronizedList(ManagementFactory.getMemoryPoolMXBeans());
@ -66,9 +70,6 @@ public class MemoryManagement {
private static volatile MemoryPoolMXBean mpool = null;
private static volatile boolean trace = false;
private static volatile boolean testFailed = false;
private static final int NUM_CHUNKS = 2;
// Must match -Xmn set on the @run line
private static final int YOUNG_GEN_SIZE = 8 * 1024 * 1024;
private static volatile long chunkSize;
private static volatile int listenerInvoked = 0;