< prev index next >

test/java/lang/management/MemoryMXBean/CollectionUsageThreshold.java

Print this page
rev 16783 : 8176176: fix @modules in jdk_svc tests
Reviewed-by: duke


  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug     4959889 6992968
  27  * @summary Basic unit test of memory management testing:
  28  *          1) setCollectionUsageThreshold() and getCollectionUsageThreshold()
  29  *          2) test notification emitted for two different memory pools.
  30  *
  31  * @author  Mandy Chung
  32  *

  33  * @library /lib/testlibrary/
  34  * @modules jdk.management

  35  * @build jdk.testlibrary.* CollectionUsageThreshold MemoryUtil RunUtil
  36  * @requires vm.opt.ExplicitGCInvokesConcurrent == "false" | vm.opt.ExplicitGCInvokesConcurrent == "null"
  37  * @run main/timeout=300 CollectionUsageThreshold
  38  */
  39 
  40 import java.util.*;
  41 import java.util.concurrent.*;
  42 import java.util.concurrent.atomic.AtomicInteger;
  43 import javax.management.*;
  44 import javax.management.openmbean.CompositeData;
  45 import java.lang.management.*;
  46 import static java.lang.management.MemoryNotificationInfo.*;;
  47 import static java.lang.management.ManagementFactory.*;
  48 
  49 public class CollectionUsageThreshold {
  50     private static final MemoryMXBean mm = getMemoryMXBean();
  51     private static final Map<String, PoolRecord> result = new HashMap<>();
  52     private static boolean trace = false;
  53     private static volatile int numMemoryPools = 1;
  54     private static final int NUM_GCS = 3;
  55     private static final int THRESHOLD = 10;
  56     private static volatile int numGCs = 0;




  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug     4959889 6992968
  27  * @summary Basic unit test of memory management testing:
  28  *          1) setCollectionUsageThreshold() and getCollectionUsageThreshold()
  29  *          2) test notification emitted for two different memory pools.

  30  * @author  Mandy Chung
  31  *
  32  * @requires vm.opt.ExplicitGCInvokesConcurrent == "false" | vm.opt.ExplicitGCInvokesConcurrent == "null"
  33  * @library /lib/testlibrary/
  34  * @modules jdk.management
  35  *
  36  * @build jdk.testlibrary.* CollectionUsageThreshold MemoryUtil RunUtil

  37  * @run main/timeout=300 CollectionUsageThreshold
  38  */
  39 
  40 import java.util.*;
  41 import java.util.concurrent.*;
  42 import java.util.concurrent.atomic.AtomicInteger;
  43 import javax.management.*;
  44 import javax.management.openmbean.CompositeData;
  45 import java.lang.management.*;
  46 import static java.lang.management.MemoryNotificationInfo.*;;
  47 import static java.lang.management.ManagementFactory.*;
  48 
  49 public class CollectionUsageThreshold {
  50     private static final MemoryMXBean mm = getMemoryMXBean();
  51     private static final Map<String, PoolRecord> result = new HashMap<>();
  52     private static boolean trace = false;
  53     private static volatile int numMemoryPools = 1;
  54     private static final int NUM_GCS = 3;
  55     private static final int THRESHOLD = 10;
  56     private static volatile int numGCs = 0;


< prev index next >