8199375: [TESTBUG] Open source vm testbase monitoring tests
authoriignatyev
Wed, 02 May 2018 16:43:56 -0700
changeset 49958 cc29d7717e3a
parent 49957 746229cc1ab0
child 49959 313dd42409d6
8199375: [TESTBUG] Open source vm testbase monitoring tests Reviewed-by: kvn, ihse, sspitsyn
make/test/JtregNativeHotspot.gmk
test/hotspot/jtreg/ProblemList.txt
test/hotspot/jtreg/TEST.groups
test/hotspot/jtreg/vmTestbase/nsk/monitoring/CompilationMXBean/comptimemon001/comptimemon001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/CompilationMXBean/comptimemon002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/CompilationMXBean/comptimemon003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/CompilationMXBean/comptimemon004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/CompilationMXBean/comptimemon005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/GarbageCollectorMXBean/CollectionCounters/CollectionCounters001/CollectionCounters001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/GarbageCollectorMXBean/CollectionCounters/CollectionCounters002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/GarbageCollectorMXBean/CollectionCounters/CollectionCounters003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/GarbageCollectorMXBean/CollectionCounters/CollectionCounters004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/GarbageCollectorMXBean/CollectionCounters/CollectionCounters005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/GarbageCollectorMXBean/getCollectionCount/getcollectioncount001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/GarbageCollectorMXBean/getCollectionCount/getcollectioncount001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/GarbageCollectorMXBean/getCollectionCount/getcollectioncount002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/GarbageCollectorMXBean/getCollectionCount/getcollectioncount003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/GarbageCollectorMXBean/getCollectionCount/getcollectioncount004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/GarbageCollectorMXBean/getCollectionCount/getcollectioncount005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/GarbageCollectorMXBean/getCollectionTime/getcollectiontime001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/GarbageCollectorMXBean/getCollectionTime/getcollectiontime001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/GarbageCollectorMXBean/getCollectionTime/getcollectiontime002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/GarbageCollectorMXBean/getCollectionTime/getcollectiontime003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/GarbageCollectorMXBean/getCollectionTime/getcollectiontime004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/GarbageCollectorMXBean/getCollectionTime/getcollectiontime005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/LockTest/LockTest001/LockTest001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/LockTest/LockTest002/LockTest002.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/getLoggerLevel/getloggerlevel001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/getLoggerLevel/getloggerlevel001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/getLoggerLevel/getloggerlevel002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/getLoggerLevel/getloggerlevel003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/getLoggerLevel/getloggerlevel004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/getLoggerLevel/getloggerlevel005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/getLoggerNames/getloggernames001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/getLoggerNames/getloggernames001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/getLoggerNames/getloggernames002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/getLoggerNames/getloggernames003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/getLoggerNames/getloggernames004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/getLoggerNames/getloggernames005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/getParentLoggerName/getparentloggername001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/getParentLoggerName/getparentloggername001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/getParentLoggerName/getparentloggername002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/getParentLoggerName/getparentloggername003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/getParentLoggerName/getparentloggername004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/getParentLoggerName/getparentloggername005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/setLoggerLevel/setloggerlevel001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/setLoggerLevel/setloggerlevel001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/setLoggerLevel/setloggerlevel002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/setLoggerLevel/setloggerlevel003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/setLoggerLevel/setloggerlevel004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/setLoggerLevel/setloggerlevel005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryNotificationInfo/MemoryNotificationInfo/info001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryNotificationInfo/MemoryNotificationInfo/info001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryNotificationInfo/from/from001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryNotificationInfo/from/from001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryNotificationInfo/getCount/getcount001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryNotificationInfo/getCount/getcount001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryNotificationInfo/getPoolName/getpoolname001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryNotificationInfo/getPoolName/getpoolname001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryNotificationInfo/getUsage/getusage001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryNotificationInfo/getUsage/getusage001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsage/getusage001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsage/getusage001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsage/getusage002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsage/getusage003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsage/getusage004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsage/getusage005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsageThreshold/getthreshold001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsageThreshold/getthreshold001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsageThreshold/getthreshold002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsageThreshold/getthreshold003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsageThreshold/getthreshold004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsageThreshold/getthreshold005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsageThresholdCount/getcount001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsageThresholdCount/getcount001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsageThresholdCount/getcount002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsageThresholdCount/getcount003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsageThresholdCount/getcount004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsageThresholdCount/getcount005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getPeakUsage/getpeak001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getPeakUsage/getpeak001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getPeakUsage/getpeak002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getPeakUsage/getpeak003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getPeakUsage/getpeak004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getPeakUsage/getpeak005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsage/getusage001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsage/getusage001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsage/getusage002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsage/getusage003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsage/getusage004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsage/getusage005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsageThreshold/getthreshold001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsageThreshold/getthreshold001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsageThreshold/getthreshold002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsageThreshold/getthreshold003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsageThreshold/getthreshold004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsageThreshold/getthreshold005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsageThresholdCount/getcount001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsageThresholdCount/getcount001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsageThresholdCount/getcount002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsageThresholdCount/getcount003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsageThresholdCount/getcount004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsageThresholdCount/getcount005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdExceeded/isexceeded001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdExceeded/isexceeded001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdExceeded/isexceeded002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdExceeded/isexceeded003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdExceeded/isexceeded004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdExceeded/isexceeded005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdSupported/issupported001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdSupported/issupported001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdSupported/issupported002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdSupported/issupported003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdSupported/issupported004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdSupported/issupported005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdExceeded/isexceeded001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdExceeded/isexceeded001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdExceeded/isexceeded002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdExceeded/isexceeded003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdExceeded/isexceeded004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdExceeded/isexceeded005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdSupported/issupported001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdSupported/issupported001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdSupported/issupported002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdSupported/issupported003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdSupported/issupported004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdSupported/issupported005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/resetPeakUsage/reset001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/resetPeakUsage/reset001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/resetPeakUsage/reset002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/resetPeakUsage/reset003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/resetPeakUsage/reset004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/resetPeakUsage/reset005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/setCollectionUsageThreshold/setthreshold001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/setCollectionUsageThreshold/setthreshold001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/setCollectionUsageThreshold/setthreshold002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/setCollectionUsageThreshold/setthreshold003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/setCollectionUsageThreshold/setthreshold004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/setCollectionUsageThreshold/setthreshold005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/setUsageThreshold/setthreshold001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/setUsageThreshold/setthreshold001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/setUsageThreshold/setthreshold002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/setUsageThreshold/setthreshold003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/setUsageThreshold/setthreshold004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/setUsageThreshold/setthreshold005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryUsage/MemoryUsage/memoryusage001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryUsage/MemoryUsage/memoryusage001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryUsage/from/from001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryUsage/from/from001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/RuntimeMXBean/RuntimeMXBean001/RuntimeMXBean001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/RuntimeMXBean/RuntimeMXBean002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/RuntimeMXBean/RuntimeMXBean003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/RuntimeMXBean/RuntimeMXBean004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/RuntimeMXBean/RuntimeMXBean005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/RuntimeMXBean/RuntimeMXBean006/RuntimeMXBean006.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/RuntimeMXBean/RuntimeMXBean007/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/RuntimeMXBean/RuntimeMXBean008/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/RuntimeMXBean/RuntimeMXBean009/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/RuntimeMXBean/RuntimeMXBean010/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadInfo/from_c/from_c001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadInfo/from_c/from_c001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadInfo/getLockName/getlockname001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadInfo/getLockName/getlockname001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadInfo/getLockOwnerName/getlockownername001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadInfo/getLockOwnerName/getlockownername001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadInfo/isInNative/isinnative001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadInfo/isInNative/isinnative001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadInfo/isSuspended/issuspended001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadInfo/isSuspended/issuspended001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadInfo/isSuspended/issuspended002.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadInfo/isSuspended/issuspended002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMBean/findMonitorDeadlockedThreads/find001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMBean/isCurrentThreadCpuTimeSupported/curthcputime001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMBean/isThreadContentionMonitoringSupported/thcontmonitor001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMBean/isThreadCpuTimeSupported/thcputime001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMBean/resetPeakThreadCount/reset001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/BarrierHandler.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/AllocatedMemorySupportedTest.README
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/AllocatedMemorySupportedTest.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/BaseBehaviorTest.README
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/BaseBehaviorTest.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/DoubleAllocationTest.README
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/DoubleAllocationTest.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/EqualThreadsTest.README
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/EqualThreadsTest.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/IllegalArgumentsTest.README
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/IllegalArgumentsTest.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/NoAllocationTest.README
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/NoAllocationTest.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/StressTest.README
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/StressTest.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/allocatedMemorySupportedTest_directly/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/allocatedMemorySupportedTest_proxy_custom/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/allocatedMemorySupportedTest_proxy_default/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/allocatedMemorySupportedTest_server_custom/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/allocatedMemorySupportedTest_server_default/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/baseBehaviorTest_directly/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/baseBehaviorTest_proxy_custom/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/baseBehaviorTest_proxy_default/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/baseBehaviorTest_server_custom/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/baseBehaviorTest_server_default/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_directly_array/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_directly_string/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_proxy_custom_array/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_proxy_custom_string/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_proxy_default_array/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_proxy_default_string/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_server_custom_array/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_server_custom_string/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_server_default_array/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_server_default_string/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_directly_array/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_directly_string/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_proxy_custom_array/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_proxy_custom_string/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_proxy_default_array/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_proxy_default_string/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_server_custom_array/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_server_custom_string/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_server_default_array/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_server_default_string/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/illegalArgumentsTest_directly/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/illegalArgumentsTest_proxy_custom/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/illegalArgumentsTest_proxy_default/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/illegalArgumentsTest_server_custom/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/illegalArgumentsTest_server_default/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/noAllocationTest_directly/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/noAllocationTest_proxy_custom/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/noAllocationTest_proxy_default/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/noAllocationTest_server_custom/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/noAllocationTest_server_default/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/stressTest_directly/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/stressTest_directly/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/stressTest_proxy_custom/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/stressTest_proxy_custom/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/stressTest_proxy_default/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/stressTest_proxy_default/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/stressTest_server_custom/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/stressTest_server_custom/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/stressTest_server_default/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/stressTest_server_default/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/BaseBehaviorTest.README
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/BaseBehaviorTest.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/IllegalArgumentsTest.README
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/IllegalArgumentsTest.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/baseBehaviorTest_directly/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/baseBehaviorTest_proxy_custom/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/baseBehaviorTest_proxy_default/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/baseBehaviorTest_server_custom/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/baseBehaviorTest_server_default/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/illegalArgumentsTest_directly/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/illegalArgumentsTest_proxy_custom/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/illegalArgumentsTest_proxy_default/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/illegalArgumentsTest_server_custom/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/illegalArgumentsTest_server_default/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/MXBeanTestThread.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/BlockedThread/BlockedThread001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/BlockedThread/BlockedThread002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/BlockedThread/BlockedThread003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/BlockedThread/BlockedThread004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/BlockedThread/BlockedThread005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/JavaDeadlock001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/JavaDeadlock002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/JavaDeadlock003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/JavaDeadlock004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/JavaDeadlock005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/MixedDeadlock001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/NativeDeadlock001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/SynchronizedMethodDeadlock001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/SynchronizerDeadlock001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/FinishedThread/FinishedThread001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/FinishedThread/FinishedThread002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/FinishedThread/FinishedThread003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/FinishedThread/FinishedThread004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/FinishedThread/FinishedThread005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/LockingThreads/LockingThreads001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/LockingThreads/LockingThreads002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/LockingThreads/LockingThreads003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/LockingThreads/LockingThreads004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/LockingThreads/LockingThreads005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Multi/Multi001/Multi001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Multi/Multi001/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Multi/Multi002/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Multi/Multi002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Multi/Multi003/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Multi/Multi003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Multi/Multi004/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Multi/Multi004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Multi/Multi005/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Multi/Multi005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/NativeBlockedThread/NativeBlockedThread001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/NativeBlockedThread/NativeBlockedThread002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/NativeBlockedThread/NativeBlockedThread003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/NativeBlockedThread/NativeBlockedThread004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/NativeBlockedThread/NativeBlockedThread005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/NewThread/NewThread001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/NewThread/NewThread002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/NewThread/NewThread003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/NewThread/NewThread004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/NewThread/NewThread005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/RunningThread/RunningThread001/RunningThread001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/RunningThread/RunningThread002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/RunningThread/RunningThread003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/RunningThread/RunningThread004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/RunningThread/RunningThread005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/SleepingThread/SleepingThread001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/SleepingThread/SleepingThread002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/SleepingThread/SleepingThread003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/SleepingThread/SleepingThread004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/SleepingThread/SleepingThread005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/SynchronizerLockingThreads/SynchronizerLockingThreads001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/SynchronizerLockingThreads/SynchronizerLockingThreads002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/SynchronizerLockingThreads/SynchronizerLockingThreads003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/SynchronizerLockingThreads/SynchronizerLockingThreads004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/SynchronizerLockingThreads/SynchronizerLockingThreads005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/TimedWaitingThread/TimedWaitingThread001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/TimedWaitingThread/TimedWaitingThread002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/TimedWaitingThread/TimedWaitingThread003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/TimedWaitingThread/TimedWaitingThread004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/TimedWaitingThread/TimedWaitingThread005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/WaitingThread/WaitingThread001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/WaitingThread/WaitingThread002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/WaitingThread/WaitingThread003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/WaitingThread/WaitingThread004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/WaitingThread/WaitingThread005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadMXBeanTestBase.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/findMonitorDeadlockedThreads/find001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/findMonitorDeadlockedThreads/find002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/findMonitorDeadlockedThreads/find003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/findMonitorDeadlockedThreads/find004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/findMonitorDeadlockedThreads/find005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/findMonitorDeadlockedThreads/find006.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/findMonitorDeadlockedThreads/find006/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/isCurrentThreadCpuTimeSupported/curthcputime001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/isCurrentThreadCpuTimeSupported/curthcputime002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/isCurrentThreadCpuTimeSupported/curthcputime003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/isCurrentThreadCpuTimeSupported/curthcputime004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/isCurrentThreadCpuTimeSupported/curthcputime005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/isThreadContentionMonitoringSupported/thcontmonitor001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/isThreadContentionMonitoringSupported/thcontmonitor002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/isThreadContentionMonitoringSupported/thcontmonitor003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/isThreadContentionMonitoringSupported/thcontmonitor004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/isThreadContentionMonitoringSupported/thcontmonitor005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/isThreadCpuTimeSupported/thcputime001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/isThreadCpuTimeSupported/thcputime002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/isThreadCpuTimeSupported/thcputime003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/isThreadCpuTimeSupported/thcputime004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/isThreadCpuTimeSupported/thcputime005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/resetPeakThreadCount/reset001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/resetPeakThreadCount/reset002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/resetPeakThreadCount/reset003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/resetPeakThreadCount/reset004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/resetPeakThreadCount/reset005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/ArgumentHandler.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/ArgumentHandlerAware.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/ClassLoadingController.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/ClassLoadingMonitor.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/CompilationMonitor.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/CustomMBeanRegistration.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/CustomMBeanServer.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/CustomMBeanServerBuilder.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/GarbageCollectorMonitor.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/Generator.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/LoadableClass.pattern
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/LoggingMonitor.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/MemoryMonitor.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/Monitor.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/Monitoring.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/MonitoringFactory.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/MonitoringFactoryAware.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/MonitoringTestBase.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/RuntimeMonitor.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/ServerNotificationEmitter.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/StackTraceController.c
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/StateController.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/StateControllerBase.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/ThreadController.c
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/ThreadController.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/ThreadMonitor.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/direct/DirectMonitoringFactory.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/libStackTraceController.c
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/libThreadController.c
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/proxy/ProxyMonitoringFactory.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/server/ServerClassLoadingMXBean.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/server/ServerCompilationMXBean.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/server/ServerGarbageCollectorMXBean.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/server/ServerMXBean.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/server/ServerMemoryMXBean.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/server/ServerMemoryManagerMXBean.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/server/ServerMemoryPoolMXBean.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/server/ServerMonitoringFactory.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/server/ServerRuntimeMXBean.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/server/ServerThreadMXBean.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/server/ServerThreadMXBeanNew.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/BlockedThread.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/Deadlock.c
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/Deadlock.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/FinishedThread.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/LockerThread.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/LockingThreads.c
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/LockingThreads.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/MonitoringThread.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/MultiScenario.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/NativeBlockedThread.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/NewThread.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/RecursiveMonitoringThread.c
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/RecursiveMonitoringThread.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/RunType.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/RunningThread.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/ScenarioTypeAware.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/SleepingThread.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/StandardThreadMonitoringScenarioFactory.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/SynchronizerLockingThreads.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/ThreadMonitoringScenario.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/ThreadMonitoringScenarioBase.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/ThreadMonitoringScenarioFactory.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/ThreadUtils.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/TimedWaitingThread.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/WaitingThread.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/libDeadlock.c
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/libLockingThreads.c
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/libNativeBlockedThread.c
test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/libRecursiveMonitoringThread.c
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/GenClassesBuilder.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load001/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load002/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load003/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load004/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load005/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load006/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load006/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load007/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load007/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load008/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load008/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load009/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load009/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load010/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load010/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load011/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load011/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load012/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load012/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload001/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload002/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload003/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload004/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload005/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload006/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload006/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload007/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload007/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload008/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload008/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload009/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload009/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload010/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload010/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload011/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload011/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload012/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload012/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem001/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem002/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem003/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem004/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem005/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem006/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem006/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem007/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem007/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem008/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem008/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem009/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem009/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem010/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem010/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem011/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem011/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem012/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem012/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem013/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem013/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem014/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem014/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem015/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem015/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem016/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem016/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem017/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem017/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem018/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem018/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem019/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem019/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem020/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem020/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem021/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem021/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem022/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem022/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem023/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem023/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem024/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem024/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem025/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem025/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem026/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem026/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem027/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem027/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem028/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem028/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem029/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem029/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem030/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem030/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem031/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem031/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem032/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem032/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem033/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem033/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem034/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem034/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem035/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem035/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem036/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem036/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/cmon001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/cmon001/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/cmon001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/cmon002/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/cmon002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/cmon003/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/cmon003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace001.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace001/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace001/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace002/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace002/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace003/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace003/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace004/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace004/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace005/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace005/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace006/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace006/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace007/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace007/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace008/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace008/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace009/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace009/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace010.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace010/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace010/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace011/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace011/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace012/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace012/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace013/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace013/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace014/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace014/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace015/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace015/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace016/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace016/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace017/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace017/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace018/TEST.properties
test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace018/TestDescription.java
test/hotspot/jtreg/vmTestbase/nsk/share/ArgumentParser.java
test/hotspot/jtreg/vmTestbase/nsk/share/README
--- a/make/test/JtregNativeHotspot.gmk	Wed May 02 19:24:52 2018 -0400
+++ b/make/test/JtregNativeHotspot.gmk	Wed May 02 16:43:56 2018 -0700
@@ -59,8 +59,18 @@
     -I$(VM_TESTBASE_DIR)/nsk/share/native \
     -I$(VM_TESTBASE_DIR)/nsk/share/jni
 
+NSK_MONITORING_INCLUDES := \
+    -I$(VM_TESTBASE_DIR)/nsk/share/native \
+    -I$(VM_TESTBASE_DIR)/nsk/share/jni
+
 BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libProcessUtils := $(VM_SHARE_INCLUDES)
 
+BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libThreadController := $(NSK_MONITORING_INCLUDES)
+BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libDeadlock := $(NSK_MONITORING_INCLUDES)
+BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libRecursiveMonitoringThread := $(NSK_MONITORING_INCLUDES)
+BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libLockingThreads := $(NSK_MONITORING_INCLUDES)
+BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libStackTraceController := $(NSK_MONITORING_INCLUDES)
+
 ################################################################################
 
 # Platform specific setup
--- a/test/hotspot/jtreg/ProblemList.txt	Wed May 02 19:24:52 2018 -0400
+++ b/test/hotspot/jtreg/ProblemList.txt	Wed May 02 16:43:56 2018 -0700
@@ -94,3 +94,19 @@
 
 compiler/c2/Test8007294.java                                                   8194310    generic-all  Java EE Module Removal
 compiler/c2/Test6852078.java                                                   8194310    generic-all  Java EE Module Removal
+
+#############################################################################
+
+# :vmTestbase_*
+
+#############################################################################
+
+vmTestbase/nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdExceeded/isexceeded003/TestDescription.java 8153598 generic-all
+vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdExceeded/isexceeded001/TestDescription.java 8198668 generic-all
+vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdExceeded/isexceeded002/TestDescription.java 8153598 generic-all
+vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdExceeded/isexceeded003/TestDescription.java 8198668 generic-all
+vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdExceeded/isexceeded004/TestDescription.java 8153598 generic-all
+vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdExceeded/isexceeded005/TestDescription.java 8153598 generic-all
+vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/JavaDeadlock001/TestDescription.java 8060733 generic-all
+
+#############################################################################
--- a/test/hotspot/jtreg/TEST.groups	Wed May 02 19:24:52 2018 -0400
+++ b/test/hotspot/jtreg/TEST.groups	Wed May 02 16:43:56 2018 -0700
@@ -317,3 +317,274 @@
   -:tier1_runtime_appcds_exclude \
   -:hotspot_nmt \
   -:hotspot_tier2_runtime_platform_agnostic
+
+# Stress tests against information provided by VM via JMX
+vmTestbase_nsk_monitoring = \
+  vmTestbase/nsk/monitoring
+
+vmTestbase_nsk_monitoring_quick = \
+  vmTestbase/nsk/monitoring/MemoryNotificationInfo/MemoryNotificationInfo/info001/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryNotificationInfo/from/from001/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryNotificationInfo/getCount/getcount001/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryNotificationInfo/getPoolName/getpoolname001/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryNotificationInfo/getUsage/getusage001/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsage/getusage001/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsage/getusage002/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsage/getusage003/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsage/getusage004/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsage/getusage005/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsageThreshold/getthreshold001/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsageThreshold/getthreshold002/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsageThreshold/getthreshold003/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsageThreshold/getthreshold004/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsageThreshold/getthreshold005/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsageThresholdCount/getcount001/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsageThresholdCount/getcount002/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsageThresholdCount/getcount003/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsageThresholdCount/getcount004/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsageThresholdCount/getcount005/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/getPeakUsage/getpeak001/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/getPeakUsage/getpeak002/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/getPeakUsage/getpeak003/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/getPeakUsage/getpeak004/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/getPeakUsage/getpeak005/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsage/getusage001/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsage/getusage002/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsage/getusage003/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsage/getusage004/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsage/getusage005/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsageThreshold/getthreshold001/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsageThreshold/getthreshold002/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsageThreshold/getthreshold003/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsageThreshold/getthreshold004/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsageThreshold/getthreshold005/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsageThresholdCount/getcount001/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsageThresholdCount/getcount002/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsageThresholdCount/getcount003/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsageThresholdCount/getcount004/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsageThresholdCount/getcount005/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdExceeded/isexceeded001/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdExceeded/isexceeded002/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdExceeded/isexceeded003/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdExceeded/isexceeded004/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdExceeded/isexceeded005/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdSupported/issupported001/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdSupported/issupported002/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdSupported/issupported003/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdSupported/issupported004/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdSupported/issupported005/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdExceeded/isexceeded001/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdExceeded/isexceeded002/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdExceeded/isexceeded003/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdExceeded/isexceeded004/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdExceeded/isexceeded005/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdSupported/issupported001/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdSupported/issupported002/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdSupported/issupported003/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdSupported/issupported004/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdSupported/issupported005/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/resetPeakUsage/reset001/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/resetPeakUsage/reset002/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/resetPeakUsage/reset003/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/resetPeakUsage/reset004/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/resetPeakUsage/reset005/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/setCollectionUsageThreshold/setthreshold001/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/setCollectionUsageThreshold/setthreshold002/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/setCollectionUsageThreshold/setthreshold003/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/setCollectionUsageThreshold/setthreshold004/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/setCollectionUsageThreshold/setthreshold005/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/setUsageThreshold/setthreshold001/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/setUsageThreshold/setthreshold002/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/setUsageThreshold/setthreshold003/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/setUsageThreshold/setthreshold004/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryPoolMBean/setUsageThreshold/setthreshold005/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryUsage/MemoryUsage/memoryusage001/TestDescription.java \
+  vmTestbase/nsk/monitoring/MemoryUsage/from/from001/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadInfo/from_c/from_c001/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadInfo/getLockName/getlockname001/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadInfo/getLockOwnerName/getlockownername001/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadInfo/isInNative/isinnative001/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadInfo/isSuspended/issuspended001/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadInfo/isSuspended/issuspended002/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/findMonitorDeadlockedThreads/find001/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/findMonitorDeadlockedThreads/find002/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/findMonitorDeadlockedThreads/find003/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/findMonitorDeadlockedThreads/find004/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/findMonitorDeadlockedThreads/find005/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/findMonitorDeadlockedThreads/find006/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/isCurrentThreadCpuTimeSupported/curthcputime001/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/isCurrentThreadCpuTimeSupported/curthcputime002/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/isCurrentThreadCpuTimeSupported/curthcputime003/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/isCurrentThreadCpuTimeSupported/curthcputime004/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/isCurrentThreadCpuTimeSupported/curthcputime005/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/isThreadContentionMonitoringSupported/thcontmonitor001/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/isThreadContentionMonitoringSupported/thcontmonitor002/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/isThreadContentionMonitoringSupported/thcontmonitor003/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/isThreadContentionMonitoringSupported/thcontmonitor004/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/isThreadContentionMonitoringSupported/thcontmonitor005/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/isThreadCpuTimeSupported/thcputime001/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/isThreadCpuTimeSupported/thcputime002/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/isThreadCpuTimeSupported/thcputime003/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/isThreadCpuTimeSupported/thcputime004/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/isThreadCpuTimeSupported/thcputime005/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/resetPeakThreadCount/reset001/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/resetPeakThreadCount/reset002/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/resetPeakThreadCount/reset003/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/resetPeakThreadCount/reset004/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/resetPeakThreadCount/reset005/TestDescription.java \
+  vmTestbase/nsk/monitoring/LoggingMXBean/getLoggerLevel/getloggerlevel001/TestDescription.java \
+  vmTestbase/nsk/monitoring/LoggingMXBean/getLoggerLevel/getloggerlevel002/TestDescription.java \
+  vmTestbase/nsk/monitoring/LoggingMXBean/getLoggerLevel/getloggerlevel003/TestDescription.java \
+  vmTestbase/nsk/monitoring/LoggingMXBean/getLoggerLevel/getloggerlevel004/TestDescription.java \
+  vmTestbase/nsk/monitoring/LoggingMXBean/getLoggerLevel/getloggerlevel005/TestDescription.java \
+  vmTestbase/nsk/monitoring/LoggingMXBean/setLoggerLevel/setloggerlevel001/TestDescription.java \
+  vmTestbase/nsk/monitoring/LoggingMXBean/setLoggerLevel/setloggerlevel002/TestDescription.java \
+  vmTestbase/nsk/monitoring/LoggingMXBean/setLoggerLevel/setloggerlevel003/TestDescription.java \
+  vmTestbase/nsk/monitoring/LoggingMXBean/setLoggerLevel/setloggerlevel004/TestDescription.java \
+  vmTestbase/nsk/monitoring/LoggingMXBean/setLoggerLevel/setloggerlevel005/TestDescription.java \
+  vmTestbase/nsk/monitoring/LoggingMXBean/getParentLoggerName/getparentloggername001/TestDescription.java \
+  vmTestbase/nsk/monitoring/LoggingMXBean/getParentLoggerName/getparentloggername002/TestDescription.java \
+  vmTestbase/nsk/monitoring/LoggingMXBean/getParentLoggerName/getparentloggername003/TestDescription.java \
+  vmTestbase/nsk/monitoring/LoggingMXBean/getParentLoggerName/getparentloggername004/TestDescription.java \
+  vmTestbase/nsk/monitoring/LoggingMXBean/getParentLoggerName/getparentloggername005/TestDescription.java \
+  vmTestbase/nsk/monitoring/LoggingMXBean/getLoggerNames/getloggernames001/TestDescription.java \
+  vmTestbase/nsk/monitoring/LoggingMXBean/getLoggerNames/getloggernames002/TestDescription.java \
+  vmTestbase/nsk/monitoring/LoggingMXBean/getLoggerNames/getloggernames003/TestDescription.java \
+  vmTestbase/nsk/monitoring/LoggingMXBean/getLoggerNames/getloggernames004/TestDescription.java \
+  vmTestbase/nsk/monitoring/LoggingMXBean/getLoggerNames/getloggernames005/TestDescription.java \
+  vmTestbase/nsk/monitoring/GarbageCollectorMXBean/getCollectionCount/getcollectioncount001/TestDescription.java \
+  vmTestbase/nsk/monitoring/GarbageCollectorMXBean/getCollectionCount/getcollectioncount002/TestDescription.java \
+  vmTestbase/nsk/monitoring/GarbageCollectorMXBean/getCollectionCount/getcollectioncount003/TestDescription.java \
+  vmTestbase/nsk/monitoring/GarbageCollectorMXBean/getCollectionCount/getcollectioncount004/TestDescription.java \
+  vmTestbase/nsk/monitoring/GarbageCollectorMXBean/getCollectionCount/getcollectioncount005/TestDescription.java \
+  vmTestbase/nsk/monitoring/GarbageCollectorMXBean/getCollectionTime/getcollectiontime001/TestDescription.java \
+  vmTestbase/nsk/monitoring/GarbageCollectorMXBean/getCollectionTime/getcollectiontime002/TestDescription.java \
+  vmTestbase/nsk/monitoring/GarbageCollectorMXBean/getCollectionTime/getcollectiontime003/TestDescription.java \
+  vmTestbase/nsk/monitoring/GarbageCollectorMXBean/getCollectionTime/getcollectiontime004/TestDescription.java \
+  vmTestbase/nsk/monitoring/GarbageCollectorMXBean/getCollectionTime/getcollectiontime005/TestDescription.java \
+  vmTestbase/nsk/monitoring/RuntimeMXBean/RuntimeMXBean001/RuntimeMXBean001.java \
+  vmTestbase/nsk/monitoring/RuntimeMXBean/RuntimeMXBean002/TestDescription.java \
+  vmTestbase/nsk/monitoring/RuntimeMXBean/RuntimeMXBean003/TestDescription.java \
+  vmTestbase/nsk/monitoring/RuntimeMXBean/RuntimeMXBean004/TestDescription.java \
+  vmTestbase/nsk/monitoring/RuntimeMXBean/RuntimeMXBean005/TestDescription.java \
+  vmTestbase/nsk/monitoring/RuntimeMXBean/RuntimeMXBean006/RuntimeMXBean006.java \
+  vmTestbase/nsk/monitoring/RuntimeMXBean/RuntimeMXBean007/TestDescription.java \
+  vmTestbase/nsk/monitoring/RuntimeMXBean/RuntimeMXBean008/TestDescription.java \
+  vmTestbase/nsk/monitoring/RuntimeMXBean/RuntimeMXBean009/TestDescription.java \
+  vmTestbase/nsk/monitoring/RuntimeMXBean/RuntimeMXBean010/TestDescription.java \
+  vmTestbase/nsk/monitoring/CompilationMXBean/comptimemon001/comptimemon001.java \
+  vmTestbase/nsk/monitoring/CompilationMXBean/comptimemon002/TestDescription.java \
+  vmTestbase/nsk/monitoring/CompilationMXBean/comptimemon003/TestDescription.java \
+  vmTestbase/nsk/monitoring/CompilationMXBean/comptimemon004/TestDescription.java \
+  vmTestbase/nsk/monitoring/CompilationMXBean/comptimemon005/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/TimedWaitingThread/TimedWaitingThread001/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/TimedWaitingThread/TimedWaitingThread002/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/TimedWaitingThread/TimedWaitingThread003/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/TimedWaitingThread/TimedWaitingThread004/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/TimedWaitingThread/TimedWaitingThread005/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/RunningThread/RunningThread001/RunningThread001.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/RunningThread/RunningThread002/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/RunningThread/RunningThread003/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/RunningThread/RunningThread004/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/RunningThread/RunningThread005/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/SleepingThread/SleepingThread001/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/SleepingThread/SleepingThread002/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/SleepingThread/SleepingThread003/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/SleepingThread/SleepingThread004/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/SleepingThread/SleepingThread005/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/WaitingThread/WaitingThread001/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/WaitingThread/WaitingThread002/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/WaitingThread/WaitingThread003/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/WaitingThread/WaitingThread004/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/WaitingThread/WaitingThread005/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/BlockedThread/BlockedThread001/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/BlockedThread/BlockedThread002/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/BlockedThread/BlockedThread003/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/BlockedThread/BlockedThread004/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/BlockedThread/BlockedThread005/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/NativeBlockedThread/NativeBlockedThread001/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/NativeBlockedThread/NativeBlockedThread002/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/NativeBlockedThread/NativeBlockedThread003/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/NativeBlockedThread/NativeBlockedThread004/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/NativeBlockedThread/NativeBlockedThread005/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/NewThread/NewThread001/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/NewThread/NewThread002/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/NewThread/NewThread003/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/NewThread/NewThread004/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/NewThread/NewThread005/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/FinishedThread/FinishedThread001/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/FinishedThread/FinishedThread002/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/FinishedThread/FinishedThread003/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/FinishedThread/FinishedThread004/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/FinishedThread/FinishedThread005/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/LockingThreads/LockingThreads001/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/LockingThreads/LockingThreads002/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/LockingThreads/LockingThreads003/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/LockingThreads/LockingThreads004/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/LockingThreads/LockingThreads005/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/SynchronizerLockingThreads/SynchronizerLockingThreads001/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/SynchronizerLockingThreads/SynchronizerLockingThreads002/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/SynchronizerLockingThreads/SynchronizerLockingThreads003/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/SynchronizerLockingThreads/SynchronizerLockingThreads004/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/SynchronizerLockingThreads/SynchronizerLockingThreads005/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/JavaDeadlock001/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/JavaDeadlock002/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/JavaDeadlock003/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/JavaDeadlock004/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/JavaDeadlock005/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/NativeDeadlock001/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/SynchronizerDeadlock001/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/SynchronizedMethodDeadlock001/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/MixedDeadlock001/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/baseBehaviorTest_directly/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/baseBehaviorTest_server_default/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/baseBehaviorTest_server_custom/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/baseBehaviorTest_proxy_default/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/baseBehaviorTest_proxy_custom/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/illegalArgumentsTest_directly/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/illegalArgumentsTest_server_default/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/illegalArgumentsTest_server_custom/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/illegalArgumentsTest_proxy_default/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/illegalArgumentsTest_proxy_custom/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/allocatedMemorySupportedTest_directly/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/allocatedMemorySupportedTest_server_default/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/allocatedMemorySupportedTest_server_custom/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/allocatedMemorySupportedTest_proxy_default/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/allocatedMemorySupportedTest_proxy_custom/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/baseBehaviorTest_directly/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/baseBehaviorTest_server_default/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/baseBehaviorTest_server_custom/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/baseBehaviorTest_proxy_default/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/baseBehaviorTest_proxy_custom/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_directly_array/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_server_default_array/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_server_custom_array/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_proxy_default_array/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_proxy_custom_array/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_directly_string/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_server_default_string/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_server_custom_string/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_proxy_default_string/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_proxy_custom_string/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_directly_array/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_server_default_array/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_server_custom_array/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_proxy_default_array/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_proxy_custom_array/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_directly_string/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_server_default_string/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_server_custom_string/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_proxy_default_string/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_proxy_custom_string/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/illegalArgumentsTest_directly/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/illegalArgumentsTest_server_default/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/illegalArgumentsTest_server_custom/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/illegalArgumentsTest_proxy_default/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/illegalArgumentsTest_proxy_custom/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/noAllocationTest_directly/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/noAllocationTest_server_default/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/noAllocationTest_server_custom/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/noAllocationTest_proxy_default/TestDescription.java \
+  vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/noAllocationTest_proxy_custom/TestDescription.java
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/CompilationMXBean/comptimemon001/comptimemon001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/CompilationMXBean/comptimemon001.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         CompilationMBean.isCompilationTimeMonitoringSupported()
+ *     method returns true. The test performs directly access to management
+ *     metrics within the same JVM.
+ *     Note, that the test is correct ONLY against Sun's Hotspot VM. This
+ *     feature is optional and the method may return either true, or false.
+ *     However, Sun's implementation must always return true.
+ *     The test passes, if the JVM has no compilation system, for example the
+ *     test is invoked with -Xint option.
+ * COMMENT
+ *     Fixed the bug:
+ *     4953476 TEST_BUG: The spec is updated accoring to 4944573 and 4947536
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm/timeout=300 nsk.monitoring.CompilationMXBean.comptimemon001.comptimemon001
+ */
+
+package nsk.monitoring.CompilationMXBean.comptimemon001;
+
+import java.io.*;
+import nsk.share.test.*;
+import nsk.share.TestFailure;
+import nsk.monitoring.share.*;
+import java.lang.management.*;
+
+public class comptimemon001 extends MonitoringTestBase implements Initializable {
+        private CompilationMXBean compilation;
+        private int iterations = 30;
+
+        public void initialize() {
+                if (monitoringFactory.hasCompilationMXBean())
+                        compilation = monitoringFactory.getCompilationMXBean();
+        }
+
+        public boolean testCompilationTimeMonitoringSupported() {
+                if (compilation == null) {
+                        // The JVM has no compilation system, for example the test is
+                        // invoked with -Xint option
+                        log.info("The JVM has no compilation system.");
+                        return false;
+                } else if (!compilation.isCompilationTimeMonitoringSupported()) {
+                        // Check the method is... for the specified way of access to MBeans
+                        log.error("Monitoring of compilation time is not supported.\n");
+                        setFailed(true);
+                        return false;
+                }
+                return true;
+        }
+
+        private void testCompilationTimeOne() {
+                long sleepTime = LocalRandom.randomPauseTime();
+                long startTime = compilation.getTotalCompilationTime();
+                if (startTime < 0)
+                        throw new TestFailure("getTotalCompilationTime < 0: " + startTime);
+                try {
+                        Thread.sleep(sleepTime);
+                } catch (InterruptedException e) {
+                        throw new TestFailure("Sleep was interrupted.");
+                }
+                long finishTime = compilation.getTotalCompilationTime();
+                if (finishTime < 0)
+                        throw new TestFailure("getTotalCompilationTime < 0: " + finishTime);
+                if (finishTime < startTime)
+                        throw new TestFailure("getTotalCompilationTime before sleep: " + startTime
+                                + " > getTotalCompilationTime after sleep: " + finishTime);
+        }
+
+        public void testCompilationTime() {
+                for (int i = 0; i < iterations; ++i)
+                        testCompilationTimeOne();
+        }
+
+        public void run() {
+                if (!testCompilationTimeMonitoringSupported())
+                        return;
+                testCompilationTime();
+        }
+
+        public static void main(String[] args) {
+                Monitoring.runTest(new comptimemon001(), args);
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/CompilationMXBean/comptimemon002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/CompilationMXBean/comptimemon002.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         CompilationMBean.isCompilationTimeMonitoringSupported()
+ *     method returns true. The test performs access to management metrics
+ *     through default MBeanServer.
+ *     Note, that the test is correct ONLY against Sun's Hotspot VM. This
+ *     feature is optional and the method may return either true, or false.
+ *     However, Sun's implementation must always return true.
+ *     The test passes, if the JVM has no compilation system, for example the
+ *     test is invoked with -Xint option.
+ * COMMENTS
+ *     Fixed the bug:
+ *     4953476 TEST_BUG: The spec is updated accoring to 4944573 and 4947536
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm/timeout=300
+ *      nsk.monitoring.CompilationMXBean.comptimemon001.comptimemon001
+ *      -testMode=server
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/CompilationMXBean/comptimemon003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/CompilationMXBean/comptimemon003.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         CompilationMBean.isCompilationTimeMonitoringSupported()
+ *     method returns true. The test performs access to management metrics
+ *     through custom MBeanServer (developed and saved in
+ *     $TESTBASE/src/nsk/monitoring/share).
+ *     Note, that the test is correct ONLY against Sun's Hotspot VM. This
+ *     feature is optional and the method may return either true, or false.
+ *     However, Sun's implementation must always return true.
+ *     The test passes, if the JVM has no compilation system, for example the
+ *     test is invoked with -Xint option.
+ * COMMENTS
+ *     Fixed the bug:
+ *     4953476 TEST_BUG: The spec is updated accoring to 4944573 and 4947536
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm/timeout=300
+ *      nsk.monitoring.CompilationMXBean.comptimemon001.comptimemon001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/CompilationMXBean/comptimemon004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/CompilationMXBean/comptimemon004.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         CompilationMBean.isCompilationTimeMonitoringSupported()
+ *     method returns true. The test performs access to management metrics
+ *     through default MBeanServer proxy.
+ *     Note, that the test is correct ONLY against Sun's Hotspot VM. This
+ *     feature is optional and the method may return either true, or false.
+ *     However, Sun's implementation must always return true.
+ *     The test passes, if the JVM has no compilation system, for example the
+ *     test is invoked with -Xint option.
+ * COMMENTS
+ *     Fixed the bug:
+ *     4953476 TEST_BUG: The spec is updated accoring to 4944573 and 4947536
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm/timeout=300
+ *      nsk.monitoring.CompilationMXBean.comptimemon001.comptimemon001
+ *      -testMode=proxy
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/CompilationMXBean/comptimemon005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/CompilationMXBean/comptimemon005.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         CompilationMBean.isCompilationTimeMonitoringSupported()
+ *     method returns true. The test performs access to management metrics
+ *     through custom MBeanServer proxy (developed and saved in
+ *     $TESTBASE/src/nsk/monitoring/share).
+ *     Note, that the test is correct ONLY against Sun's Hotspot VM. This
+ *     feature is optional and the method may return either true, or false.
+ *     However, Sun's implementation must always return true.
+ *     The test passes, if the JVM has no compilation system, for example the
+ *     test is invoked with -Xint option.
+ * COMMENTS
+ *     Fixed the bug:
+ *     4953476 TEST_BUG: The spec is updated accoring to 4944573 and 4947536
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm/timeout=300
+ *      nsk.monitoring.CompilationMXBean.comptimemon001.comptimemon001
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/GarbageCollectorMXBean/CollectionCounters/CollectionCounters001/CollectionCounters001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/GarbageCollectorMXBean/CollectionCounters/CollectionCounters001.
+ * VM Testbase keywords: [monitoring]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.GarbageCollectorMXBean.CollectionCounters.CollectionCounters001.CollectionCounters001
+ *      -testMode=directly
+ */
+
+package nsk.monitoring.GarbageCollectorMXBean.CollectionCounters.CollectionCounters001;
+
+import java.util.List;
+import java.lang.management.*;
+import nsk.share.TestFailure;
+import nsk.share.test.*;
+import nsk.monitoring.share.*;
+import nsk.share.gc.Algorithms;
+import nsk.share.runner.RunParams;
+import nsk.share.runner.RunParamsAware;
+
+/**
+ * Test counters from GarbageCollectorMXBean.
+ *
+ * In this test, we do some operations on heap and check that total
+ * counters from all GarbageCollectorBeans do not decrease and actually
+ * increase in some situations.
+ *
+ * This also checks that counters increase after MemoryMXBean.gc().
+ *
+ * Note: we assume that System.gc() increases collection count and
+ * time. It may be false with -XX:+DisableExplicitGC.
+ */
+public class CollectionCounters001 extends MonitoringTestBase implements RunParamsAware, Initializable {
+        private List<GarbageCollectorMXBean> gcBeans;
+        private MemoryMXBean memory;
+        Stresser stresser;
+        RunParams runParams;
+        private long collectionCount;
+        private long collectionTime;
+        private long collectionCountOld;
+        private long collectionTimeOld;
+
+        public void initialize() {
+                gcBeans = monitoringFactory.getGarbageCollectorMXBeans();
+                memory = monitoringFactory.getMemoryMXBean();
+        }
+
+        private void runOne(ExecutionController stresser) {
+                updateCounters();
+                validate();
+                Algorithms.eatMemory(stresser);
+                        if(stresser.continueExecution()) {
+                    updateCounters();
+                    validateNonTrivial();
+                    System.gc();
+                    updateCounters();
+                    validateNonTrivial();
+                    memory.gc();
+                    updateCounters();
+                    validateNonTrivial();
+                        }
+        }
+
+        public void run() {
+                stresser = new Stresser(runParams.getStressOptions());
+                stresser.start(runParams.getIterations());
+                while (stresser.iteration()) {
+                    runOne(stresser);
+                }
+        }
+
+        private void validate() {
+                if (collectionCount < 0)
+                        throw new TestFailure("collectionCount negative: " + collectionCount);
+                if (collectionTime < 0)
+                        throw new TestFailure("collectionTime negative: " + collectionTime);
+                if (collectionCount < collectionCountOld)
+                        throw new TestFailure("collectionCount decreased: " + collectionCount + " -> " + collectionCountOld);
+                if (collectionTime < collectionTimeOld)
+                        throw new TestFailure("collectionTime decreased: " + collectionTime + " -> " + collectionTimeOld);
+        }
+
+        private void validateNonTrivial() {
+                if (collectionCount < 0)
+                        throw new TestFailure("collectionCount negative: " + collectionCount);
+                if (collectionTime < 0)
+                        throw new TestFailure("collectionTime negative: " + collectionTime);
+                if (collectionCount <= collectionCountOld)
+                        throw new TestFailure("collectionCount not increased: " + collectionCount + " -> " + collectionCountOld);
+                if (collectionTime < collectionTimeOld)
+                        throw new TestFailure("collection time became smaller: " + collectionTime + " -> " + collectionTimeOld);
+        }
+
+        private void updateCounters() {
+                collectionCountOld = collectionCount;
+                collectionTimeOld = collectionTime;
+                collectionCount = 0;
+                collectionTime = 0;
+                for (GarbageCollectorMXBean gcBean : gcBeans) {
+                        collectionCount += gcBean.getCollectionCount();
+                        collectionTime += gcBean.getCollectionTime();
+                }
+        }
+
+        public static void main(String[] args) {
+                Monitoring.runTest(new CollectionCounters001(), args);
+        }
+
+    @Override
+    public void setRunParams(RunParams runParams) {
+        this.runParams = runParams;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/GarbageCollectorMXBean/CollectionCounters/CollectionCounters002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/GarbageCollectorMXBean/CollectionCounters/CollectionCounters002.
+ * VM Testbase keywords: [monitoring]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.GarbageCollectorMXBean.CollectionCounters.CollectionCounters001.CollectionCounters001
+ *      -testMode=server
+ *      -MBeanServer=default
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/GarbageCollectorMXBean/CollectionCounters/CollectionCounters003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/GarbageCollectorMXBean/CollectionCounters/CollectionCounters003.
+ * VM Testbase keywords: [monitoring]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.GarbageCollectorMXBean.CollectionCounters.CollectionCounters001.CollectionCounters001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/GarbageCollectorMXBean/CollectionCounters/CollectionCounters004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/GarbageCollectorMXBean/CollectionCounters/CollectionCounters004.
+ * VM Testbase keywords: [monitoring]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.GarbageCollectorMXBean.CollectionCounters.CollectionCounters001.CollectionCounters001
+ *      -testMode=proxy
+ *      -MBeanServer=default
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/GarbageCollectorMXBean/CollectionCounters/CollectionCounters005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/GarbageCollectorMXBean/CollectionCounters/CollectionCounters005.
+ * VM Testbase keywords: [monitoring]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.GarbageCollectorMXBean.CollectionCounters.CollectionCounters001.CollectionCounters001
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/GarbageCollectorMXBean/getCollectionCount/getcollectioncount001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2004, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.GarbageCollectorMXBean.getCollectionCount;
+
+import java.lang.management.*;
+import java.io.*;
+import nsk.share.*;
+import nsk.monitoring.share.*;
+
+public class getcollectioncount001 {
+
+    private static boolean testFailed = false;
+
+    public static void main(String[] args) {
+
+        System.exit(Consts.JCK_STATUS_BASE + run(args, System.out));
+    }
+
+    private static Log log;
+
+    static int run(String[] args, PrintStream out) {
+
+        ArgumentHandler argumentHandler = new ArgumentHandler(args);
+        log = new Log(out, argumentHandler);
+
+        // Test case 1. check that
+        // getCollectionCount() does not throw unexpected exceptions
+
+        System.gc();
+        System.gc();
+        System.gc();
+
+        GarbageCollectorMonitor gcMonitor =
+        Monitor.getGarbageCollectorMonitor(log, argumentHandler);
+
+        Object[] pool = gcMonitor.getGarbageCollectorMXBeans();
+        for (int i=0; i<pool.length; i++) {
+
+            String beanName = "";
+            long collectionCount = gcMonitor.getCollectionCount(pool[i]);
+
+            if (pool[i] instanceof javax.management.ObjectName) {
+                beanName = ((javax.management.ObjectName)pool[i]).toString();
+            } else {
+                beanName = ((java.lang.management.GarbageCollectorMXBean)
+                    pool[i]).getName();
+            }
+            log.display(beanName+": getCollectionCount() = "+collectionCount);
+
+            if (collectionCount < -1) {
+                // value can be non-negative or -1 if if the collection count
+                // is undefined for this collector.
+                log.complain("FAILURE 1.");
+                log.complain("getCollectionCount() returns unexpected value: " +
+                    collectionCount);
+                testFailed = true;
+            }
+        }
+
+        if (testFailed)
+            log.complain("TEST FAILED");
+
+        return (testFailed) ? Consts.TEST_FAILED : Consts.TEST_PASSED;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/GarbageCollectorMXBean/getCollectionCount/getcollectioncount001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/GarbageCollectorMXBean/getCollectionCount/getcollectioncount001.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *         Interface: java.util.logging.GarbageCollectorMXBean
+ *         Method: getCollectionCount()
+ *         This method returns the total number of collections that have occurred
+ *         Access to metrics is provided in following way: directly.
+ *     The test checks that
+ *         1. Returns the total number of collections that have occurred.
+ *         2. This method returns -1 if the collection count is undefined for this
+ *             collector.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.GarbageCollectorMXBean.getCollectionCount.getcollectioncount001
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/GarbageCollectorMXBean/getCollectionCount/getcollectioncount002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/GarbageCollectorMXBean/getCollectionCount/getcollectioncount002.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *         Interface: java.util.logging.GarbageCollectorMXBean
+ *         Method: getCollectionCount()
+ *         This method returns the total number of collections that have occurred
+ *         Access to metrics is provided in following way: default MBeanServer.
+ *     The test checks that
+ *         1. Returns the total number of collections that have occurred.
+ *         2. This method returns -1 if the collection count is undefined for this
+ *             collector.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.GarbageCollectorMXBean.getCollectionCount.getcollectioncount001
+ *      -testMode=server
+ *      -MBeanServer=default
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/GarbageCollectorMXBean/getCollectionCount/getcollectioncount003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/GarbageCollectorMXBean/getCollectionCount/getcollectioncount003.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *         Interface: java.util.logging.GarbageCollectorMXBean
+ *         Method: getCollectionCount()
+ *         This method returns the total number of collections that have occurred
+ *         Access to metrics is provided in following way: custom MBeanServer.
+ *     The test checks that
+ *         1. Returns the total number of collections that have occurred.
+ *         2. This method returns -1 if the collection count is undefined for this
+ *             collector.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.GarbageCollectorMXBean.getCollectionCount.getcollectioncount001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/GarbageCollectorMXBean/getCollectionCount/getcollectioncount004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/GarbageCollectorMXBean/getCollectionCount/getcollectioncount004.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *         Interface: java.util.logging.GarbageCollectorMXBean
+ *         Method: getCollectionCount()
+ *         This method returns the total number of collections that have occurred
+ *         Access to metrics is provided in following way: default MBeanServer
+ *             through proxy.
+ *     The test checks that
+ *         1. Returns the total number of collections that have occurred.
+ *         2. This method returns -1 if the collection count is undefined for this
+ *             collector.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.GarbageCollectorMXBean.getCollectionCount.getcollectioncount001
+ *      -testMode=proxy
+ *      -MBeanServer=default
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/GarbageCollectorMXBean/getCollectionCount/getcollectioncount005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/GarbageCollectorMXBean/getCollectionCount/getcollectioncount005.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *         Interface: java.util.logging.GarbageCollectorMXBean
+ *         Method: getCollectionCount()
+ *         This method returns the total number of collections that have occurred
+ *         Access to metrics is provided in following way: custom MBeanServer
+ *             through proxy.
+ *     The test checks that
+ *         1. Returns the total number of collections that have occurred.
+ *         2. This method returns -1 if the collection count is undefined for this
+ *             collector.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.GarbageCollectorMXBean.getCollectionCount.getcollectioncount001
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/GarbageCollectorMXBean/getCollectionTime/getcollectiontime001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2004, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.GarbageCollectorMXBean.getCollectionTime;
+
+import java.lang.management.*;
+import java.io.*;
+import nsk.share.*;
+import nsk.monitoring.share.*;
+
+public class getcollectiontime001 {
+
+    private static boolean testFailed = false;
+
+    public static void main(String[] args) {
+
+        System.exit(Consts.JCK_STATUS_BASE + run(args, System.out));
+    }
+
+    private static Log log;
+
+    static int run(String[] args, PrintStream out) {
+
+        ArgumentHandler argumentHandler = new ArgumentHandler(args);
+        log = new Log(out, argumentHandler);
+
+        // Test case 1. check that
+        // getCollectionTime() does not throw unexpected exceptions
+
+        System.gc();
+        System.gc();
+        System.gc();
+
+        GarbageCollectorMonitor gcMonitor = Monitor.getGarbageCollectorMonitor(
+            log,
+            argumentHandler);
+
+        Object[] pool = gcMonitor.getGarbageCollectorMXBeans();
+        for (int i=0; i<pool.length; i++) {
+
+            String beanName = "";
+            long collectionTime = gcMonitor.getCollectionTime(pool[i]);
+
+            if (pool[i] instanceof javax.management.ObjectName) {
+                beanName = ((javax.management.ObjectName)pool[i]).toString();
+            } else {
+                beanName = ((java.lang.management.GarbageCollectorMXBean)
+                    pool[i]).getName();
+            }
+            log.display(beanName+": getCollectionTime() = "+collectionTime);
+
+            if (collectionTime < -1) {
+                // value can be non-negative or -1 if if the collection elapsed
+                // time is undefined for this collector.
+                log.complain("FAILURE 1.");
+                log.complain("getCollectionTime() returns unexpected value: " +
+                collectionTime);
+                testFailed = true;
+            }
+        }
+
+        if (testFailed)
+            log.complain("TEST FAILED");
+
+        return (testFailed) ? Consts.TEST_FAILED : Consts.TEST_PASSED;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/GarbageCollectorMXBean/getCollectionTime/getcollectiontime001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/GarbageCollectorMXBean/getCollectionTime/getcollectiontime001.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *         Interface: java.util.logging.GarbageCollectorMXBean
+ *         Method: getCollectionTime()
+ *         This method returns the approximate accumulated collection elapsed time
+ *             in milliseconds
+ *         Access to metrics is provided in following way: directly.
+ *     The test checks that
+ *         1. Returns the total number of collections that have occurred.
+ *         2. This method returns -1 if the collection count is undefined for this
+ *             collector.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.GarbageCollectorMXBean.getCollectionTime.getcollectiontime001
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/GarbageCollectorMXBean/getCollectionTime/getcollectiontime002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/GarbageCollectorMXBean/getCollectionTime/getcollectiontime002.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *         Interface: java.util.logging.GarbageCollectorMXBean
+ *         Method: getCollectionTime()
+ *         This method returns the approximate accumulated collection elapsed time
+ *             in milliseconds
+ *         Access to metrics is provided in following way: default MBeanServer.
+ *     The test checks that
+ *         1. Returns the total number of collections that have occurred.
+ *         2. This method returns -1 if the collection count is undefined for this
+ *             collector.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.GarbageCollectorMXBean.getCollectionTime.getcollectiontime001
+ *      -testMode=server
+ *      -MBeanServer=default
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/GarbageCollectorMXBean/getCollectionTime/getcollectiontime003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/GarbageCollectorMXBean/getCollectionTime/getcollectiontime003.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *         Interface: java.util.logging.GarbageCollectorMXBean
+ *         Method: getCollectionTime()
+ *         This method returns the approximate accumulated collection elapsed time
+ *             in milliseconds
+ *         Access to metrics is provided in following way: custom MBeanServer.
+ *     The test checks that
+ *         1. Returns the total number of collections that have occurred.
+ *         2. This method returns -1 if the collection count is undefined for this
+ *             collector.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.GarbageCollectorMXBean.getCollectionTime.getcollectiontime001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/GarbageCollectorMXBean/getCollectionTime/getcollectiontime004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/GarbageCollectorMXBean/getCollectionTime/getcollectiontime004.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *         Interface: java.util.logging.GarbageCollectorMXBean
+ *         Method: getCollectionTime()
+ *         This method returns the approximate accumulated collection elapsed time
+ *             in milliseconds
+ *         Access to metrics is provided in following way: default MBeanServer
+ *             through proxy.
+ *     The test checks that
+ *         1. Returns the total number of collections that have occurred.
+ *         2. This method returns -1 if the collection count is undefined for this
+ *             collector.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.GarbageCollectorMXBean.getCollectionTime.getcollectiontime001
+ *      -testMode=proxy
+ *      -MBeanServer=default
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/GarbageCollectorMXBean/getCollectionTime/getcollectiontime005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/GarbageCollectorMXBean/getCollectionTime/getcollectiontime005.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *         Interface: java.util.logging.GarbageCollectorMXBean
+ *         Method: getCollectionTime()
+ *         This method returns the approximate accumulated collection elapsed time
+ *             in milliseconds
+ *         Access to metrics is provided in following way: custom MBeanServer
+ *             through proxy.
+ *     The test checks that
+ *         1. Returns the total number of collections that have occurred.
+ *         2. This method returns -1 if the collection count is undefined for this
+ *             collector.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.GarbageCollectorMXBean.getCollectionTime.getcollectiontime001
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/LockTest/LockTest001/LockTest001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,193 @@
+/*
+ * Copyright (c) 2010, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/LockTest/LockTest001.
+ * VM Testbase keywords: [monitoring, vm6]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.LockTest.LockTest001.LockTest001
+ */
+
+package nsk.monitoring.LockTest.LockTest001;
+
+import java.lang.management.ThreadInfo;
+import java.lang.management.ManagementFactory;
+
+import nsk.share.TestFailure;
+
+public class LockTest001
+{
+  private Object syncObj = new Object();
+
+  public LockTest001()
+  {  }
+
+  public void test()
+  {
+
+    int localVar0, localVar1, localVar2, localVar3, localVar4, localVar5, localVar6, localVar7, localVar8, localVar9;
+    int localVar10, localVar11, localVar12, localVar13, localVar14, localVar15, localVar16, localVar17, localVar18, localVar19;
+    int localVar20, localVar21, localVar22, localVar23, localVar24, localVar25, localVar26, localVar27, localVar28, localVar29;
+    int localVar30, localVar31, localVar32, localVar33, localVar34, localVar35, localVar36, localVar37, localVar38, localVar39;
+    int localVar40, localVar41, localVar42, localVar43, localVar44, localVar45, localVar46, localVar47, localVar48, localVar49;
+
+    String threadName = Thread.currentThread().getName();
+    System.out.println(threadName + ": Entering test()");
+
+    synchronized (syncObj)
+    {
+      int n = 0;
+      for (int i = 0; i < 10000000; i++)
+        n += i;
+      logMonitors((n & 1) >>> (n & 1));
+    } // end sync
+
+    logMonitors(1);
+
+    synchronized (syncObj)
+    {
+      logMonitors(2);
+    }
+    logMonitors(3);
+
+    System.out.println(threadName + ": Leaving test()");
+    return;
+  }
+
+  public static void logMonitors(int n)
+  {
+    String threadName = Thread.currentThread().getName();
+    java.lang.management.MonitorInfo[] monitors = java.lang.management.ManagementFactory.getThreadMXBean()
+                                                  .getThreadInfo(new long[] { Thread.currentThread().getId() }, true, true)[0].getLockedMonitors();
+    System.out.println(threadName + ": Checkpoint #" + n + ", number of monitors: " + monitors.length);
+    if ((n == 3) && (monitors.length > 0))
+      System.out.println(threadName + ": MONITOR HELD AFTER EXITING SYNCHRONIZED BLOCK!");
+    for (int i = 0; i < monitors.length; i++)
+    {
+      java.lang.management.MonitorInfo monitor = monitors[i];
+      System.out.println(threadName + ": MonitorInfo[" + i + "]=" + monitor.toString() + ", StackDepth=" + monitor.getLockedStackDepth()
+                         + ", frame=" + ((monitor.getLockedStackFrame() == null) ? "No Frame" : monitor.getLockedStackFrame().toString()));
+    }
+    return;
+  }
+
+  public static void main(String[] argv)
+  {
+    LockTest001 lt = new LockTest001();
+    RunLockTest rlt = new RunLockTest(lt, 10000);
+    Thread t = new Thread(rlt);
+    System.out.println("main: About to start first thread: " + t.getName());
+    t.start();
+
+    synchronized (rlt)
+    {
+      while (!rlt.finishedTest)
+      {
+        try
+        {  rlt.wait();  }
+        catch (Exception e)
+        {  }
+      }
+    }
+
+    rlt = new RunLockTest(lt, 0);
+    t = new Thread(rlt);
+    System.out.println("main: About to start second thread: " + t.getName());
+    t.start();
+
+    // amount of time to wait for the thread. In case of buggy behavior, the thread will hang forever.
+    // but long enough to complete test on busy boxes
+    long endTime = System.currentTimeMillis() + 5 * 60 * 1000;
+
+    boolean isError = true;
+
+    while (System.currentTimeMillis() < endTime)
+    {
+      if (t.getState() == Thread.State.TERMINATED)
+      {
+          isError = false;
+          break;
+      }
+      try
+      {  Thread.currentThread().sleep(1000);  }
+      catch (Exception e)
+      {  }
+      ThreadInfo[] tis = ManagementFactory.getThreadMXBean().getThreadInfo(new long[] { t.getId() }, true, true);
+      if (tis.length == 0)
+        System.out.println("Unable to find the thread " + t.getName());
+      else
+      {
+        ThreadInfo ti = tis[0];
+        if (ti == null)
+          System.out.println("Unable to get info for thread: " + t.getName());
+        else
+          System.out.println(t.getName() + " state: " + ti.getThreadState().toString() +
+                             ", LockName: " + ti.getLockName() + ", LockOwnerName: " + ti.getLockOwnerName());
+      }
+    }
+
+    if (!isError)
+        System.out.println("TEST PASSED");
+    else
+        throw new TestFailure("TEST FAILED");
+    return;
+  }
+
+  public static class RunLockTest implements Runnable
+  {
+    public LockTest001 lt;
+    public boolean finishedTest = false;
+    public long sleepLength;
+
+    public RunLockTest(LockTest001 _lt, long _sleepLength)
+    {
+      lt = _lt;
+      sleepLength = _sleepLength;
+    }
+
+    public void run()
+    {
+      lt.test();
+      synchronized (this)
+      {
+        finishedTest = true;
+        this.notify();
+      }
+      if (sleepLength > 0)
+      {
+        try
+        {  Thread.currentThread().sleep(sleepLength);  }
+        catch (Exception e)
+        {  }
+      }
+      System.out.println(Thread.currentThread().getName() + ": exiting");
+      return;
+    }
+  }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/LockTest/LockTest002/LockTest002.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 2010, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/LockTest/LockTest002.
+ * VM Testbase keywords: [monitoring, vm6]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.LockTest.LockTest002.LockTest002
+ */
+
+package nsk.monitoring.LockTest.LockTest002;
+
+import java.lang.management.ThreadInfo;
+import java.lang.management.ManagementFactory;
+
+import nsk.share.TestFailure;
+
+public class LockTest002
+{
+  private Object syncObj = new Object();
+
+  public LockTest002()
+  {  }
+
+  public synchronized void test()
+  {
+
+    int localVar0, localVar1, localVar2, localVar3, localVar4, localVar5, localVar6, localVar7, localVar8, localVar9;
+    int localVar10, localVar11, localVar12, localVar13, localVar14, localVar15, localVar16, localVar17, localVar18, localVar19;
+    int localVar20, localVar21, localVar22, localVar23, localVar24, localVar25, localVar26, localVar27, localVar28, localVar29;
+    int localVar30, localVar31, localVar32, localVar33, localVar34, localVar35, localVar36, localVar37, localVar38, localVar39;
+    int localVar40, localVar41, localVar42, localVar43, localVar44, localVar45, localVar46, localVar47, localVar48, localVar49;
+
+    String threadName = Thread.currentThread().getName();
+    System.out.println(threadName + ": Entering test()");
+
+    int n = 0;
+    for (int i = 0; i < 10000000; i++)
+      n += i;
+    System.out.println(threadName + ": Leaving test(), n=" + n);
+    return;
+  }
+
+  public static void logMonitors()
+  {
+    String threadName = Thread.currentThread().getName();
+    java.lang.management.MonitorInfo[] monitors = java.lang.management.ManagementFactory.getThreadMXBean()
+                                                  .getThreadInfo(new long[] { Thread.currentThread().getId() }, true, true)[0].getLockedMonitors();
+    System.out.println(threadName + ": Number of monitors: " + monitors.length);
+    for (int i = 0; i < monitors.length; i++)
+    {
+      java.lang.management.MonitorInfo monitor = monitors[i];
+      System.out.println(threadName + ": MonitorInfo[" + i + "]=" + monitor.toString() + ", StackDepth=" + monitor.getLockedStackDepth()
+                         + ", frame=" + ((monitor.getLockedStackFrame() == null) ? "No Frame" : monitor.getLockedStackFrame().toString()));
+    }
+    return;
+  }
+
+  public static void main(String[] argv)
+  {
+    LockTest002 lt = new LockTest002();
+    RunLockTest rlt = new RunLockTest(lt, 10000);
+    Thread t = new Thread(rlt);
+    System.out.println("main: About to start first thread: " + t.getName());
+    t.start();
+
+    synchronized (rlt)
+    {
+      while (!rlt.finishedTest)
+      {
+        try
+        {  rlt.wait();  }
+        catch (Exception e)
+        {  }
+      }
+    }
+
+    rlt = new RunLockTest(lt, 0);
+    t = new Thread(rlt);
+    System.out.println("main: About to start second thread: " + t.getName());
+    t.start();
+
+    // amount of time to wait for the thread. In case of buggy behavior, the thread will hang forever.
+    // but long enough to complete test on busy boxes
+    long endTime = System.currentTimeMillis() + 5 * 60 * 1000;
+
+    boolean isError = true;
+
+    while (System.currentTimeMillis() < endTime)
+    {
+      if (t.getState() == Thread.State.TERMINATED)
+      {
+          isError = false;
+          break;
+      }
+      try
+      {  Thread.currentThread().sleep(1000);  }
+      catch (Exception e)
+      {  }
+      ThreadInfo[] tis = ManagementFactory.getThreadMXBean().getThreadInfo(new long[] { t.getId() }, true, true);
+      if (tis.length == 0)
+        System.out.println("Unable to find the thread " + t.getName());
+      else
+      {
+        ThreadInfo ti = tis[0];
+        if (ti == null)
+          System.out.println("Unable to get info for thread: " + t.getName());
+        else
+          System.out.println(t.getName() + " state: " + ti.getThreadState().toString() +
+                             ", LockName: " + ti.getLockName() + ", LockOwnerName: " + ti.getLockOwnerName());
+      }
+    }
+
+    if (!isError)
+        System.out.println("TEST PASSED");
+    else
+        throw new TestFailure("TEST FAILED");
+    return;
+  }
+
+  public static class RunLockTest implements Runnable
+  {
+    public LockTest002 lt;
+    public boolean finishedTest = false;
+    public long sleepLength;
+
+    public RunLockTest(LockTest002 _lt, long _sleepLength)
+    {
+      lt = _lt;
+      sleepLength = _sleepLength;
+    }
+
+    public void run()
+    {
+      logMonitors();
+      lt.test();
+      logMonitors();
+      synchronized (this)
+      {
+        finishedTest = true;
+        this.notify();
+      }
+      if (sleepLength > 0)
+      {
+        try
+        {  Thread.currentThread().sleep(sleepLength);  }
+        catch (Exception e)
+        {  }
+      }
+      System.out.println(Thread.currentThread().getName() + ": exiting");
+      return;
+    }
+  }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/getLoggerLevel/getloggerlevel001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2004, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.LoggingMXBean.getLoggerLevel;
+
+import java.lang.management.*;
+import java.io.*;
+import nsk.share.*;
+import nsk.monitoring.share.*;
+import java.util.logging.*;
+
+public class getloggerlevel001 {
+
+    private static boolean testFailed = false;
+
+    public static void main(String[] args) {
+
+        System.exit(Consts.JCK_STATUS_BASE + run(args, System.out));
+    }
+
+    private static Log log;
+
+    private static final Level[] LogLevels = new Level[] {
+
+        Level.ALL, Level.CONFIG, Level.FINE, Level.FINER, Level.FINEST,
+        Level.INFO, Level.OFF, Level.SEVERE, Level.WARNING
+    };
+
+    static int run(String[] args, PrintStream out) {
+
+        ArgumentHandler argumentHandler = new ArgumentHandler(args);
+        log = new Log(out, argumentHandler);
+
+        LoggingMonitor loggingMonitor = Monitor.getLoggingMonitor(log,
+            argumentHandler);
+
+        // Test case 1. check that
+        // it returns the name of the log level associated with the specified
+        // logger
+        String testLog1Name = getloggerlevel001.class.getName();
+        Logger testLog1 = Logger.getLogger(testLog1Name);
+
+        for (int i=0; i<LogLevels.length; i++) {
+
+            testLog1.setLevel(LogLevels[i]);
+            String mxbeanLevel = loggingMonitor.getLoggerLevel(testLog1Name);
+            if (! LogLevels[i].toString().equals(mxbeanLevel)) {
+
+                testFailed = true;
+                log.complain("Failure 1.");
+                log.complain("LogLevels[i] = "+LogLevels[i].toString());
+                log.complain("loggingMXBean.getLoggerLevel() method returns "
+                    + "unexpected value");
+            }
+        }
+
+
+        // Test case 2. check
+        // if the specified logger does not exist, null is returned
+        if (loggingMonitor.getLoggerLevel("no such logger") != null) {
+
+            testFailed = true;
+            log.complain("Failure 2.");
+            log.complain("loggingMXBean.getLoggerLevel(\"no such logger\") does "
+                + "not return null");
+        }
+
+
+        // A Logger object created with the call Logger.getLogger(testLogName),
+        // stores it in a method local and expects it to be alive in the method scope
+        // after it is not used anymore.
+        // The java.util.logging.LogManager which is used by loggingMonitor stores a WeakReference to
+        // the Logger object being created into a Hashtable.
+        // The WeakReference becomes stale after a GC event, so the tests
+        // are not able to retrieve the expected info about the parent logger
+        // using the child logger name.
+        //
+        // So this synchronized block is needed to guarantee that testLog1 will still be alive
+        // when loggingMonitor.getLoggerLevel is invoked
+        synchronized (testLog1) {
+            // Test case 3. check
+            // if the Level of the specified logger is null, an empty string will
+            // be returned.
+            testLog1.setLevel(null);
+            String returnedLevel = loggingMonitor.getLoggerLevel(testLog1Name);
+            if (returnedLevel == null || !returnedLevel.equals("")) {
+
+                testFailed = true;
+                log.complain("Failure 3.");
+                log.complain("Level of the specified logger is null, but returned "
+                    + "string was not empty: "+returnedLevel);
+            }
+        }
+
+        if (testFailed)
+            log.complain("TEST FAILED");
+
+        return (testFailed) ? Consts.TEST_FAILED : Consts.TEST_PASSED;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/getLoggerLevel/getloggerlevel001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/LoggingMXBean/getLoggerLevel/getloggerlevel001.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *         Interface: java.util.logging.LoggingMXBean
+ *         Method: getLoggerLevel(String loggerName)
+ *         This method first finds the logger of the given name and then returns
+ *             the name of the log level
+ *             by calling: Logger.getLevel().getName()
+ *         Access to metrics is provided in following way: directly.
+ *     The test checks that
+ *         1. it returns the name of the log level associated with the specified
+ *             logger
+ *         2. if the specified logger does not exist, null is returned
+ *         3. if the Level of the specified logger is null, which means that this
+ *             logger's effective level
+ *             is inherited from its parent, an empty string will be returned
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.LoggingMXBean.getLoggerLevel.getloggerlevel001
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/getLoggerLevel/getloggerlevel002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/LoggingMXBean/getLoggerLevel/getloggerlevel002.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *         Interface: java.util.logging.LoggingMXBean
+ *         Method: getLoggerLevel(String loggerName)
+ *         This method first finds the logger of the given name and then returns
+ *             the name of the log level
+ *         by calling: Logger.getLevel().getName()
+ *         Access to metrics is provided in following way: default MBeanServer.
+ *     The test checks that
+ *         1. it returns the name of the log level associated with the specified
+ *             logger
+ *         2. if the specified logger does not exist, null is returned
+ *         3. if the Level of the specified logger is null, which means that this
+ *             logger's effective level
+ *             is inherited from its parent, an empty string will be returned
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.LoggingMXBean.getLoggerLevel.getloggerlevel001
+ *      -testMode=server
+ *      -MBeanServer=default
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/getLoggerLevel/getloggerlevel003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/LoggingMXBean/getLoggerLevel/getloggerlevel003.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *         Interface: java.util.logging.LoggingMXBean
+ *         Method: getLoggerLevel(String loggerName)
+ *         This method first finds the logger of the given name and then returns
+ *             the name of the log level
+ *         by calling: Logger.getLevel().getName()
+ *         Access to metrics is provided in following way: custom MBeanServer.
+ *     The test checks that
+ *         1. it returns the name of the log level associated with the specified
+ *             logger
+ *         2. if the specified logger does not exist, null is returned
+ *         3. if the Level of the specified logger is null, which means that this
+ *             logger's effective level
+ *             is inherited from its parent, an empty string will be returned
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.LoggingMXBean.getLoggerLevel.getloggerlevel001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/getLoggerLevel/getloggerlevel004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/LoggingMXBean/getLoggerLevel/getloggerlevel004.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *         Interface: java.util.logging.LoggingMXBean
+ *         Method: getLoggerLevel(String loggerName)
+ *         This method first finds the logger of the given name and then returns
+ *             the name of the log level
+ *         by calling: Logger.getLevel().getName()
+ *         Access to metrics is provided in following way: default MBeanServer
+ *             through proxy.
+ *     The test checks that
+ *         1. it returns the name of the log level associated with the specified
+ *             logger
+ *         2. if the specified logger does not exist, null is returned
+ *         3. if the Level of the specified logger is null, which means that this
+ *             logger's effective level
+ *             is inherited from its parent, an empty string will be returned
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.LoggingMXBean.getLoggerLevel.getloggerlevel001
+ *      -testMode=proxy
+ *      -MBeanServer=default
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/getLoggerLevel/getloggerlevel005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/LoggingMXBean/getLoggerLevel/getloggerlevel005.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *         Interface: java.util.logging.LoggingMXBean
+ *         Method: getLoggerLevel(String loggerName)
+ *         This method first finds the logger of the given name and then returns
+ *             the name of the log level
+ *         by calling: Logger.getLevel().getName()
+ *         Access to metrics is provided in following way: custom MBeanServer
+ *             through proxy.
+ *     The test checks that
+ *         1. it returns the name of the log level associated with the specified
+ *             logger
+ *         2. if the specified logger does not exist, null is returned
+ *         3. if the Level of the specified logger is null, which means that this
+ *             logger's effective level
+ *             is inherited from its parent, an empty string will be returned
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.LoggingMXBean.getLoggerLevel.getloggerlevel001
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/getLoggerNames/getloggernames001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2004, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.LoggingMXBean.getLoggerNames;
+
+import java.lang.management.*;
+import java.io.*;
+import nsk.share.*;
+import nsk.monitoring.share.*;
+import java.util.*;
+import java.util.logging.*;
+
+import javax.management.*;
+
+public class getloggernames001 {
+
+    private static boolean testFailed = false;
+
+    public static void main(String[] args) {
+
+        System.exit(Consts.JCK_STATUS_BASE + run(args, System.out));
+    }
+
+    private static Log log;
+
+    private static final Level[] LogLevels = new Level[] {
+
+        Level.ALL, Level.CONFIG, Level.FINE, Level.FINER, Level.FINEST,
+        Level.INFO, Level.OFF, Level.SEVERE, Level.WARNING
+    };
+
+    static int run(String[] args, PrintStream out) {
+
+        ArgumentHandler argumentHandler = new ArgumentHandler(args);
+        log = new Log(out, argumentHandler);
+
+        LoggingMonitor loggingMonitor = Monitor.getLoggingMonitor(log,
+            argumentHandler);
+
+        // Test case 1. check that
+        // This method calls LogManager.getLoggerNames() and returns a
+        // list of the logger names
+
+        // create logger
+        String testLog1Name = getloggernames001.class.getName();
+        Logger testLog1 = Logger.getLogger(testLog1Name);
+
+        Enumeration loggerNamesEn = LogManager.getLogManager().getLoggerNames();
+        List loggerMXBeanNamesList = loggingMonitor.getLoggerNames();
+
+        // check that all elements from loggerNamesEn contain in
+        // loggerMXBeanNamesList
+        while (loggerNamesEn.hasMoreElements()) {
+
+            Object loggerName = loggerNamesEn.nextElement();
+            //log.display("loggerName="+loggerName);
+
+            boolean isInvolved = false;
+            for (int i=0; i<loggerMXBeanNamesList.size(); i++) {
+
+                Object loggerMXBeanName = loggerMXBeanNamesList.get(i);
+                if ( loggerName.equals(loggerMXBeanName) ) {
+
+                    isInvolved = true;
+                    break;
+                }
+            }
+
+            if (! isInvolved) {
+
+                log.complain("FAILURE 1.");
+                log.complain("LoggingMonitor.getLoggerNames() does not return "
+                    + "the next logger name: "+loggerName);
+                testFailed = true;
+            }
+        }
+
+        // check that all elements from loggerMXBeanNamesList contain in
+        // loggerNamesEn
+        loggerNamesEn = LogManager.getLogManager().getLoggerNames();
+        for (int i=0; i<loggerMXBeanNamesList.size(); i++) {
+
+            Object loggerMXBeanName = loggerMXBeanNamesList.get(i);
+            //log.display("loggerMXBeanName="+loggerMXBeanName);
+
+            boolean isInvolved = false;
+
+            while (loggerNamesEn.hasMoreElements()) {
+
+                Object loggerName = loggerNamesEn.nextElement();
+                if ( loggerName.equals(loggerMXBeanName) ) {
+
+                    isInvolved = true;
+                    break;
+                }
+            }
+
+            if (! isInvolved) {
+
+                log.complain("FAILURE 2.");
+                log.complain("LoggingMonitor.getLoggerNames() does not return "
+                    + "unknown logger name: "+loggerMXBeanName);
+                testFailed = true;
+            }
+        }
+
+
+        if (testFailed)
+            log.complain("TEST FAILED");
+
+        return (testFailed) ? Consts.TEST_FAILED : Consts.TEST_PASSED;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/getLoggerNames/getloggernames001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/LoggingMXBean/getLoggerNames/getloggernames001.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *         Interface: java.util.logging.LoggingMXBean
+ *         Method: getLoggerNames()
+ *         Returns the list of currently registered loggers
+ *         Access to metrics is provided in following way: directly.
+ *     The test checks that
+ *         1. This method calls LogManager.getLoggerNames() and returns a
+ *             list of the logger names.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.LoggingMXBean.getLoggerNames.getloggernames001
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/getLoggerNames/getloggernames002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/LoggingMXBean/getLoggerNames/getloggernames002.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *         Interface: java.util.logging.LoggingMXBean
+ *         Method: getLoggerNames()
+ *         Returns the list of currently registered loggers
+ *         Access to metrics is provided in following way: default MBeanServer.
+ *     The test checks that
+ *         1. This method calls LogManager.getLoggerNames() and returns a
+ *             list of the logger names.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.LoggingMXBean.getLoggerNames.getloggernames001
+ *      -testMode=server
+ *      -MBeanServer=default
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/getLoggerNames/getloggernames003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/LoggingMXBean/getLoggerNames/getloggernames003.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *         Interface: java.util.logging.LoggingMXBean
+ *         Method: getLoggerNames()
+ *         Returns the list of currently registered loggers
+ *         Access to metrics is provided in following way: custom MBeanServer.
+ *     The test checks that
+ *         1. This method calls LogManager.getLoggerNames() and returns a
+ *             list of the logger names.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.LoggingMXBean.getLoggerNames.getloggernames001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/getLoggerNames/getloggernames004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/LoggingMXBean/getLoggerNames/getloggernames004.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *         Interface: java.util.logging.LoggingMXBean
+ *         Method: getLoggerNames()
+ *         Returns the list of currently registered loggers
+ *         Access to metrics is provided in following way: default MBeanServer
+ *             through proxy.
+ *     The test checks that
+ *         1. This method calls LogManager.getLoggerNames() and returns a
+ *             list of the logger names.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.LoggingMXBean.getLoggerNames.getloggernames001
+ *      -testMode=proxy
+ *      -MBeanServer=default
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/getLoggerNames/getloggernames005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/LoggingMXBean/getLoggerNames/getloggernames005.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *         Interface: java.util.logging.LoggingMXBean
+ *         Method: getLoggerNames()
+ *         Returns the list of currently registered loggers
+ *         Access to metrics is provided in following way: custom MBeanServer
+ *             through proxy.
+ *     The test checks that
+ *         1. This method calls LogManager.getLoggerNames() and returns a
+ *             list of the logger names.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.LoggingMXBean.getLoggerNames.getloggernames001
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/getParentLoggerName/getparentloggername001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2004, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.LoggingMXBean.getParentLoggerName;
+
+import java.lang.management.*;
+import java.io.*;
+import nsk.share.*;
+import nsk.monitoring.share.*;
+import java.util.logging.*;
+
+public class getparentloggername001 {
+
+    private static boolean testFailed = false;
+
+    public static void main(String[] args) {
+
+        System.exit(Consts.JCK_STATUS_BASE + run(args, System.out));
+    }
+
+    private static Log log;
+
+    static int run(String[] args, PrintStream out) {
+
+        ArgumentHandler argumentHandler = new ArgumentHandler(args);
+        log = new Log(out, argumentHandler);
+
+        LoggingMonitor loggingMonitor = Monitor.getLoggingMonitor(log,
+            argumentHandler);
+
+        // Test case 1. check that
+        // it returns the name of the parent for the specified logger
+        String testLogName = getparentloggername001.class.getName()+".child";
+        String testLogParentName = getparentloggername001.class.getName();
+        Logger testLog = Logger.getLogger(testLogName);
+        Logger testLogParent = Logger.getLogger(testLogParentName);
+
+        // This synchronized block guarantees that testLog will still be alive
+        // when loggingMonitor is getting an information about logger
+        synchronized (testLog) {
+        synchronized (testLogParent) {
+
+            String mxbeanParentName = loggingMonitor.getParentLoggerName(
+                testLogName);
+            if (! testLogParentName.equals(mxbeanParentName)) {
+
+                testFailed = true;
+                log.complain("Failure 1.");
+                log.complain("loggingMXBean.getParentLoggerName() returns "
+                    + "unexpected name of parent logger");
+                log.complain("Parent name is "+testLogParentName+", obtained name "
+                    +"is "+mxbeanParentName);
+            }
+
+
+            // Test case 2. check
+            // if the specified logger does not exist, null is returned
+            if (loggingMonitor.getParentLoggerName("no such logger") != null) {
+
+                testFailed = true;
+                log.complain("Failure 2.");
+                log.complain("loggingMXBean.getParentLoggerName(\"no such logger\") "
+                    + "does not return null");
+            }
+
+
+            // Test case 3. check
+            // if the specified logger is the root Logger in the namespace, the
+            // result will be an empty string.
+            String parentName = loggingMonitor.getParentLoggerName(
+                testLogParentName);
+            if (parentName == null || !parentName.equals("")) {
+
+                testFailed = true;
+                log.complain("Failure 3.");
+                log.complain("The specified logger was the root Logger in the "
+                    + "namespace, but returned string is not empty: "+parentName);
+            }
+        }}
+
+        if (testFailed)
+            log.complain("TEST FAILED");
+
+        return (testFailed) ? Consts.TEST_FAILED : Consts.TEST_PASSED;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/getParentLoggerName/getparentloggername001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/LoggingMXBean/getParentLoggerName/getparentloggername001.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *         Interface: java.util.logging.LoggingMXBean
+ *         Method: getParentLoggerName(String loggerName)
+ *         Returns the name of the parent for the specified logger.
+ *         Access to metrics is provided in following way: directly.
+ *     The test checks that
+ *         1. it returns the name of the parent for the specified logger
+ *         2. if the specified logger does not exist, null is returned
+ *         3. if the specified logger is the root Logger in the namespace, the
+ *             result will be an empty string
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.LoggingMXBean.getParentLoggerName.getparentloggername001
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/getParentLoggerName/getparentloggername002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/LoggingMXBean/getParentLoggerName/getparentloggername002.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *         Interface: java.util.logging.LoggingMXBean
+ *         Method: getParentLoggerName(String loggerName)
+ *         Returns the name of the parent for the specified logger.
+ *         Access to metrics is provided in following way: default MBeanServer.
+ *     The test checks that
+ *         1. it returns the name of the parent for the specified logger
+ *         2. if the specified logger does not exist, null is returned
+ *         3. if the specified logger is the root Logger in the namespace, the
+ *             result will be an empty string
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.LoggingMXBean.getParentLoggerName.getparentloggername001
+ *      -testMode=server
+ *      -MBeanServer=default
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/getParentLoggerName/getparentloggername003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/LoggingMXBean/getParentLoggerName/getparentloggername003.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *         Interface: java.util.logging.LoggingMXBean
+ *         Method: getParentLoggerName(String loggerName)
+ *         Returns the name of the parent for the specified logger.
+ *         Access to metrics is provided in following way: custom MBeanServer.
+ *     The test checks that
+ *         1. it returns the name of the parent for the specified logger
+ *         2. if the specified logger does not exist, null is returned
+ *         3. if the specified logger is the root Logger in the namespace, the
+ *             result will be an empty string
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.LoggingMXBean.getParentLoggerName.getparentloggername001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/getParentLoggerName/getparentloggername004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/LoggingMXBean/getParentLoggerName/getparentloggername004.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *         Interface: java.util.logging.LoggingMXBean
+ *         Method: getParentLoggerName(String loggerName)
+ *         Returns the name of the parent for the specified logger.
+ *         Access to metrics is provided in following way: default MBeanServer
+ *             through proxy.
+ *     The test checks that
+ *         1. it returns the name of the parent for the specified logger
+ *         2. if the specified logger does not exist, null is returned
+ *         3. if the specified logger is the root Logger in the namespace, the
+ *             result will be an empty string
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.LoggingMXBean.getParentLoggerName.getparentloggername001
+ *      -testMode=proxy
+ *      -MBeanServer=default
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/getParentLoggerName/getparentloggername005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/LoggingMXBean/getParentLoggerName/getparentloggername005.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *         Interface: java.util.logging.LoggingMXBean
+ *         Method: getParentLoggerName(String loggerName)
+ *         Returns the name of the parent for the specified logger.
+ *         Access to metrics is provided in following way: custom MBeanServer
+ *             through proxy.
+ *     The test checks that
+ *         1. it returns the name of the parent for the specified logger
+ *         2. if the specified logger does not exist, null is returned
+ *         3. if the specified logger is the root Logger in the namespace, the
+ *             result will be an empty string
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.LoggingMXBean.getParentLoggerName.getparentloggername001
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/setLoggerLevel/setloggerlevel001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2004, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.LoggingMXBean.setLoggerLevel;
+
+import java.lang.management.*;
+import java.io.*;
+import nsk.share.*;
+import nsk.monitoring.share.*;
+import java.util.logging.*;
+
+public class setloggerlevel001 {
+
+    private static boolean testFailed = false;
+
+    public static void main(String[] args) {
+
+        System.exit(Consts.JCK_STATUS_BASE + run(args, System.out));
+    }
+
+    private static Log log;
+
+    private static final Level[] LogLevels = new Level[] {
+
+        Level.ALL, Level.CONFIG, Level.FINE, Level.FINER, Level.FINEST,
+        Level.INFO, Level.OFF, Level.SEVERE, Level.WARNING
+    };
+
+    static int run(String[] args, PrintStream out) {
+
+        ArgumentHandler argumentHandler = new ArgumentHandler(args);
+        log = new Log(out, argumentHandler);
+        LoggingMXBean loggingMXBean = LogManager.getLoggingMXBean();
+
+
+
+        // Test case 1. check that
+        // if the levelName is not null, the level of the specified
+        // logger is set to the parsed Level matching the levelName
+        String testLog1Name = setloggerlevel001.class.getName();
+        Logger testLog1 = Logger.getLogger(testLog1Name);
+
+        for (int i=0; i<LogLevels.length; i++) {
+
+            loggingMXBean.setLoggerLevel(testLog1Name, LogLevels[i].toString());
+            if (! LogLevels[i].equals(testLog1.getLevel())) {
+
+                testFailed = true;
+                log.complain("Failure 1.");
+                log.complain("LogLevels[i] = "+LogLevels[i].toString());
+                log.complain("testLog1.getLevel() = "+testLog1.getLevel());
+                log.complain("loggingMXBean.setLoggerLevel() failed");
+            }
+        }
+
+        // Test case 2. check
+        // if the levelName is null, the level of the specified logger is set
+        // to null
+        loggingMXBean.setLoggerLevel(testLog1Name, null);
+        if (testLog1.getLevel() != null) {
+
+            testFailed = true;
+            log.complain("Failure 2.");
+            log.complain("Level of the specified logger was not set to null: "+
+            testLog1.getLevel());
+        }
+
+        if (testFailed)
+            log.complain("TEST FAILED");
+
+        return (testFailed) ? Consts.TEST_FAILED : Consts.TEST_PASSED;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/setLoggerLevel/setloggerlevel001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/LoggingMXBean/setLoggerLevel/setloggerlevel001.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *         Interface: java.util.logging.LoggingMXBean
+ *         Method: setLoggerLevel(java.lang.String loggerName,
+ *                                java.lang.String levelName)
+ *         sets the specified logger to the specified new level
+ *         Access to metrics is provided in following way: directly.
+ *     The test checks that
+ *         1. if the levelName is not null, the level of the specified
+ *             logger is set to the parsed Level matching the levelName
+ *         2. if the levelName is null, the level of the specified logger
+ *             is set to null
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.LoggingMXBean.setLoggerLevel.setloggerlevel001
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/setLoggerLevel/setloggerlevel002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/LoggingMXBean/setLoggerLevel/setloggerlevel002.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *         Interface: java.util.logging.LoggingMXBean
+ *         Method: setLoggerLevel(java.lang.String loggerName,
+ *                                java.lang.String levelName)
+ *         sets the specified logger to the specified new level
+ *         Access to metrics is provided in following way: default MBeanServer.
+ *     The test checks that
+ *         1. if the levelName is not null, the level of the specified
+ *             logger is set to the parsed Level matching the levelName
+ *         2. if the levelName is null, the level of the specified logger
+ *             is set to null
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.LoggingMXBean.setLoggerLevel.setloggerlevel001
+ *      -testMode=server
+ *      -MBeanServer=default
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/setLoggerLevel/setloggerlevel003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/LoggingMXBean/setLoggerLevel/setloggerlevel003.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *         Interface: java.util.logging.LoggingMXBean
+ *         Method: setLoggerLevel(java.lang.String loggerName,
+ *                                java.lang.String levelName)
+ *         sets the specified logger to the specified new level
+ *         Access to metrics is provided in following way: custom MBean.
+ *     The test checks that
+ *         1. if the levelName is not null, the level of the specified
+ *             logger is set to the parsed Level matching the levelName
+ *         2. if the levelName is null, the level of the specified logger
+ *             is set to null
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.LoggingMXBean.setLoggerLevel.setloggerlevel001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/setLoggerLevel/setloggerlevel004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/LoggingMXBean/setLoggerLevel/setloggerlevel004.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *         Interface: java.util.logging.LoggingMXBean
+ *         Method: setLoggerLevel(java.lang.String loggerName,
+ *                                java.lang.String levelName)
+ *         sets the specified logger to the specified new level
+ *         Access to metrics is provided in following way: default MBeanServer
+ *             through proxy.
+ *     The test checks that
+ *         1. if the levelName is not null, the level of the specified
+ *             logger is set to the parsed Level matching the levelName
+ *         2. if the levelName is null, the level of the specified logger
+ *             is set to null
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.LoggingMXBean.setLoggerLevel.setloggerlevel001
+ *      -testMode=proxy
+ *      -MBeanServer=default
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/LoggingMXBean/setLoggerLevel/setloggerlevel005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/LoggingMXBean/setLoggerLevel/setloggerlevel005.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *         Interface: java.util.logging.LoggingMXBean
+ *         Method: setLoggerLevel(java.lang.String loggerName,
+ *                                java.lang.String levelName)
+ *         sets the specified logger to the specified new level
+ *         Access to metrics is provided in following way: custom MBeanServer
+ *             through proxy.
+ *     The test checks that
+ *         1. if the levelName is not null, the level of the specified
+ *             logger is set to the parsed Level matching the levelName
+ *         2. if the levelName is null, the level of the specified logger
+ *             is set to null
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.LoggingMXBean.setLoggerLevel.setloggerlevel001
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryNotificationInfo/MemoryNotificationInfo/info001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2004, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.MemoryNotificationInfo.MemoryNotificationInfo;
+
+import java.lang.management.*;
+import java.io.*;
+import nsk.share.*;
+
+public class info001 {
+    private static boolean testFailed = false;
+
+    public static void main(String[] argv) {
+        System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
+    }
+
+    public static int run(String[] argv, PrintStream out) {
+        MemoryUsage mu = new MemoryUsage(1, 2, 3, 4);
+
+        test("name", mu, 1, out, "if correct parameters are passed.");
+        test("", mu, 1, out, "if empty pool name is passed.");
+        test(null, mu, 1, out, "if null pool name is passed.");
+        test("name", null, 1, out, "if null MemoryUsage is passed.");
+        test("name", mu, -2, out, "if negative count is passed.");
+        test("name", mu, 0, out, "if zero count is passed.");
+        test("name", mu, Long.MAX_VALUE, out, "if Long.MAX_VALUE, count is "
+                                            + "passed.");
+        test("name", mu, Long.MIN_VALUE, out, "if Long.MIN_VALUE, count is "
+                                            + "passed.");
+
+        if (testFailed)
+            out.println("TEST FAILED");
+        return (testFailed) ? Consts.TEST_FAILED : Consts.TEST_PASSED;
+    }
+
+    private static void test(String name, MemoryUsage usage, long count,
+                                              PrintStream out, String message) {
+        MemoryNotificationInfo info;
+
+        try {
+            info = new MemoryNotificationInfo(name, usage, count);
+            if ((name == null) || (usage == null)) {
+                out.println("NullPointerException was not thrown, " + message);
+                testFailed = true;
+            }
+        } catch (NullPointerException e) {
+            if ((name != null) && (usage != null)) {
+                out.println("Unexpected NullPointerException, " + message);
+                e.printStackTrace(out);
+                testFailed = true;
+            }
+        } catch (Exception e) {
+            out.println("Exception, " + message);
+            e.printStackTrace(out);
+            testFailed = true;
+        }
+    } // test()
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryNotificationInfo/MemoryNotificationInfo/info001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryNotificationInfo/MemoryNotificationInfo/info001.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that constructor
+ *         MemoryNotificationInfo()
+ *     does not throw any exception for various sets of arguments:
+ *     1. correct set of arguments;
+ *     2. empty pool name;
+ *     3. negative count;
+ *     4. zero count;
+ *     5. Long.MAX_VALUE as count;
+ *     6. Long.MIN_VALUE as count.
+ *     NullpointerException is expected for the following sets of arguments:
+ *     1. null pool name;
+ *     2. null MemoryUsage;
+ * COMMENT
+ *     Fixed the bug:
+ *     5013995 null pointer exception in MM nsk test todata001.
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.MemoryNotificationInfo.MemoryNotificationInfo.info001
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryNotificationInfo/from/from001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,201 @@
+/*
+ * Copyright (c) 2004, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.MemoryNotificationInfo.from;
+
+import java.lang.management.*;
+import javax.management.*;
+import javax.management.openmbean.*;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.concurrent.SynchronousQueue;
+import nsk.share.*;
+import nsk.share.gc.Algorithms;
+import nsk.share.gc.Memory;
+import nsk.share.gc.gp.GarbageUtils;
+import nsk.monitoring.share.*;
+import nsk.share.test.Stresser;
+
+public class from001 {
+
+    private static boolean testFailed = false;
+
+    public static void main(String[] args) {
+
+        ArgumentHandler argHandler = new ArgumentHandler(args);
+        Log log = new Log(System.out, argHandler);
+
+        log.display("MemoryNotificationInfo/from/from001/from001.java test started.");
+
+        MemoryMonitor monitor = Monitor.getMemoryMonitor(log, argHandler);
+        MBeanServer mbs = Monitor.getMBeanServer();
+
+        // 1. Check null CompositeData - null must be returned
+        MemoryNotificationInfo result = MemoryNotificationInfo.from(null);
+
+        if (result != null) {
+            log.complain("FAILURE 1.");
+            log.complain("MemoryNotificationInfo.from(null) returned " + result
+                      + ", expected: null.");
+            testFailed = true;
+        }
+
+        log.display("null CompositeData check passed.");
+
+        // 2. Check CompositeData that doest not represnt
+        // MemoryNotificationInfo - IllegalArgumentException must be thrown
+
+        ObjectName mbeanObjectName = null;
+        CompositeData cdata = null;
+        try {
+            mbeanObjectName = new ObjectName(ManagementFactory.MEMORY_MXBEAN_NAME);
+            cdata = (CompositeData )mbs.getAttribute(mbeanObjectName,
+                                                                "HeapMemoryUsage");
+        } catch (Exception e) {
+            log.complain("Unexpected exception " + e);
+            e.printStackTrace(log.getOutStream());
+            testFailed = true;
+        }
+
+        try {
+            result = MemoryNotificationInfo.from(cdata);
+            log.complain("FAILURE 2.");
+            log.complain("MemoryNotificationInfo.from(CompositeData) returned "
+                      + result + ", expected: IllegalArgumentException.");
+            testFailed = true;
+        } catch (IllegalArgumentException e) {
+
+            // Expected: CompositeData doest not represnt MemoryNotificationInfo
+        }
+
+        log.display("check for CompositeData doest not represnt MemoryNotificationInfo passed.");
+
+        // 3. Check correct CompositeData
+        Object poolObject = null;
+        try {
+            mbeanObjectName = new ObjectName(ManagementFactory.MEMORY_MXBEAN_NAME);
+            mbs.addNotificationListener(mbeanObjectName, new from001Listener(),
+                                                              null, null);
+            List<?> pools = monitor.getMemoryPoolMBeans();
+            if (pools.isEmpty()) {
+               log.complain("No Memory Pool Beans found. Test case will hang/fail.");
+               testFailed = true;
+            }
+
+            for (int i = 0; i < pools.size(); i++) {
+                Object pool = pools.get(i);
+                if (monitor.isUsageThresholdSupported(pool)) {
+                    if (monitor.getType(pool).equals(MemoryType.HEAP)) {
+                        poolObject = pool;
+                        monitor.setUsageThreshold(pool, 1);
+                        log.display("Usage threshold set for pool :" + poolObject);
+                        break;
+                    }
+                }
+            }
+        } catch (Exception e) {
+            log.complain("Unexpected exception " + e);
+            e.printStackTrace(log.getOutStream());
+            testFailed = true;
+        }
+
+        if (testFailed) {
+            throw new TestFailure("TEST FAILED. See log.");
+        }
+
+        // eat memory just to emmit notification
+        Stresser stresser = new Stresser(args) {
+
+            @Override
+            public boolean continueExecution() {
+                return from001Listener.data.get() == null
+                        && super.continueExecution();
+            }
+        };
+        stresser.start(0);// we use timeout, not iterations
+        GarbageUtils.eatMemory(stresser);
+
+        boolean messageNotRecieved = true;
+        while(messageNotRecieved) {
+            try {
+                from001Listener.queue.take();
+                messageNotRecieved = false;
+            } catch (InterruptedException e) {
+                messageNotRecieved = true;
+            }
+        }
+
+        result = MemoryNotificationInfo.from(from001Listener.data.get());
+        try {
+           ObjectName poolObjectName = new ObjectName(monitor.getName(poolObject));
+           ObjectName resultObjectName = new ObjectName(
+                     ManagementFactory.MEMORY_POOL_MXBEAN_DOMAIN_TYPE +
+                     ",name=" + result.getPoolName());
+
+           log.display("poolObjectName : " + poolObjectName +
+                              " resultObjectName : " + resultObjectName);
+
+           if (!poolObjectName.equals(resultObjectName)) {
+              log.complain("FAILURE 3.");
+              log.complain("Wrong pool name : " + resultObjectName +
+                           ", expected : " + poolObjectName);
+              testFailed = true;
+           }
+
+        } catch (Exception e) {
+            log.complain("Unexpected exception " + e);
+            e.printStackTrace(log.getOutStream());
+            testFailed = true;
+        }
+
+        if (testFailed) {
+            throw new TestFailure("TEST FAILED. See log.");
+        }
+
+        log.display("Test passed.");
+    }
+}
+
+
+class from001Listener implements NotificationListener {
+
+    static AtomicReference<CompositeData> data = new AtomicReference<CompositeData>();
+    static SynchronousQueue<Object> queue = new SynchronousQueue<Object>();
+
+    public void handleNotification(Notification notification, Object handback) {
+        if (data.get() != null)
+            return;
+        data.set((CompositeData) notification.getUserData());
+
+        boolean messageNotSent = true;
+        while(messageNotSent){
+            try {
+                queue.put(new Object());
+                messageNotSent = false;
+            } catch(InterruptedException e) {
+                messageNotSent = true;
+            }
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryNotificationInfo/from/from001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryNotificationInfo/from/from001.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryNotificationInfo.from(CompositeData)
+ *     returns correct results:
+ *     1. null, if CompositeData is null;
+ *     2. trows IllegalArgumentException, if CompositeData doest not represnt
+ *        MemoryNotificationInfo;
+ *     3. correct MemoryNotificationInfo object, if CompositeData is correst (i.e
+ *        all attributes of the CompositeData must have correct values: pool name,
+ *        count; init, used, committed, max (from MemoryUsage).
+ * COMMENT
+ *     Updated according to:
+ *     5024531 Fix MBeans design flaw that restricts to use JMX CompositeData
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.MemoryNotificationInfo.from.from001
+ *      -testMode=server
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryNotificationInfo/getCount/getcount001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2004, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.MemoryNotificationInfo.getCount;
+
+import java.lang.management.*;
+import java.io.*;
+import nsk.share.*;
+
+public class getcount001 {
+    private static boolean testFailed = false;
+
+    public static void main(String[] argv) {
+        System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
+    }
+
+    public static int run(String[] argv, PrintStream out) {
+        MemoryUsage mu = new MemoryUsage(1, 2, 3, 4);
+
+        // Check positive count
+        MemoryNotificationInfo mn
+            = new MemoryNotificationInfo("poolName", mu, 1);
+        long count = mn.getCount();
+        if (count != 1) {
+            out.println("FAILURE 1.");
+            out.println("Wrong count: " + count + ", expected: 1");
+            testFailed = true;
+        }
+
+        // Check negative count
+        mn = new MemoryNotificationInfo("poolName", mu, -1);
+        count = mn.getCount();
+        if (count != -1) {
+            out.println("FAILURE 2.");
+            out.println("Wrong count: " + count + ", expected: -1");
+            testFailed = true;
+        }
+
+        // Check zero count
+        mn = new MemoryNotificationInfo("poolName", mu, -2);
+        mn = new MemoryNotificationInfo("poolName", mu, 0);
+        count = mn.getCount();
+        if (count != 0) {
+            out.println("FAILURE 3.");
+            out.println("Wrong count: " + count + ", expected: 0");
+            testFailed = true;
+        }
+
+        if (testFailed)
+            out.println("TEST FAILED");
+        return (testFailed) ? Consts.TEST_FAILED : Consts.TEST_PASSED;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryNotificationInfo/getCount/getcount001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryNotificationInfo/getCount/getcount001.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryNotificationInfo.getCount()
+ *     returns correct values, if
+ *     1. count is positive;
+ *     2. count is negative;
+ *     3. count is zero.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.MemoryNotificationInfo.getCount.getcount001
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryNotificationInfo/getPoolName/getpoolname001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2004, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.MemoryNotificationInfo.getPoolName;
+
+import java.lang.management.*;
+import java.io.*;
+import nsk.share.*;
+
+public class getpoolname001 {
+    private static boolean testFailed = false;
+
+    public static void main(String[] argv) {
+        System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
+    }
+
+    public static int run(String[] argv, PrintStream out) {
+        MemoryUsage mu = new MemoryUsage(1, 2, 3, 4);
+
+        // Check not-empty string
+        MemoryNotificationInfo mn
+            = new MemoryNotificationInfo("poolName", mu, 1);
+        String name = mn.getPoolName();
+        if (!"poolName".equals(name)) {
+            out.println("FAILURE 1.");
+            out.println("Wrong pool name: \"" + name + "\", expected: "
+                      + "\"poolName\"");
+            testFailed = true;
+        }
+
+        // Check empty string
+        mn  = new MemoryNotificationInfo("", mu, 1);
+        name = mn.getPoolName();
+        if (!"".equals(name)) {
+            out.println("FAILURE 2.");
+            out.println("Wrong pool name: \"" + name + "\", expected: \"\"");
+            testFailed = true;
+        }
+
+        if (testFailed)
+            out.println("TEST FAILED");
+        return (testFailed) ? Consts.TEST_FAILED : Consts.TEST_PASSED;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryNotificationInfo/getPoolName/getpoolname001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryNotificationInfo/getPoolName/getpoolname001.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryNotificationInfo.getPoolName()
+ *     returns correct values, if
+ *     1. pool name is not-empty string;
+ *     2. pool name is empty string;
+ * COMMENT
+ *     Fixed the bug:
+ *     5013995 null pointer exception in MM nsk test todata001.
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.MemoryNotificationInfo.getPoolName.getpoolname001
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryNotificationInfo/getUsage/getusage001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2004, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.MemoryNotificationInfo.getUsage;
+
+import java.lang.management.*;
+import java.io.*;
+import nsk.share.*;
+
+public class getusage001 {
+    private static boolean testFailed = false;
+
+    public static void main(String[] argv) {
+        System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
+    }
+
+    public static int run(String[] argv, PrintStream out) {
+
+        // Check not-null object
+        MemoryUsage expectedUsage = new MemoryUsage(1, 2, 3, 4);
+
+        MemoryNotificationInfo mn
+            = new MemoryNotificationInfo("poolName", expectedUsage, 1);
+        MemoryUsage realUsage = mn.getUsage();
+        long committed = realUsage.getCommitted();
+        long init = realUsage.getInit();
+        long max = realUsage.getMax();
+        long used = realUsage.getUsed();
+        String s = realUsage.toString();
+
+        if (committed != 3) {
+            out.println("FAILURE 1.");
+            out.println("Wrong committed value: " + committed + ", expected: "
+                      + "3");
+            testFailed = true;
+        }
+
+        if (init != 1) {
+            out.println("FAILURE 2.");
+            out.println("Wrong init value: " + init + ", expected: 1");
+            testFailed = true;
+        }
+
+        if (max != 4) {
+            out.println("FAILURE 3.");
+            out.println("Wrong max value: " + max + ", expected: 4");
+            testFailed = true;
+        }
+
+        if (used != 2) {
+            out.println("FAILURE 4.");
+            out.println("Wrong used value: " + used + ", expected: 2");
+            testFailed = true;
+        }
+
+        if (!expectedUsage.toString().equals(s)) {
+            out.println("FAILURE 5.");
+            out.println("Wrong toString() value: \"" + s + "\", expected: \""
+                      + expectedUsage.toString() + "\"");
+            testFailed = true;
+        }
+
+        if (testFailed)
+            out.println("TEST FAILED");
+        return (testFailed) ? Consts.TEST_FAILED : Consts.TEST_PASSED;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryNotificationInfo/getUsage/getusage001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryNotificationInfo/getUsage/getusage001.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryNotificationInfo.getUsage()
+ *     returns correct MemoryUsage object - the same that was passed to the
+ *     MemoryNotificationInfo() constructor. The test checks
+ *     1. not-null MemoryUsage;
+ * COMMENT
+ *     Fixed the bug:
+ *     5013995 null pointer exception in MM nsk test todata001.
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.MemoryNotificationInfo.getUsage.getusage001
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsage/getusage001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2004, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.MemoryPoolMBean.getCollectionUsage;
+
+import java.io.*;
+import java.util.*;
+import nsk.share.*;
+import nsk.monitoring.share.*;
+
+public class getusage001 {
+    private static boolean testFailed = false;
+
+    public static void main(String[] argv) {
+        System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
+    }
+
+    public static int run(String[] argv, PrintStream out) {
+        ArgumentHandler argHandler = new ArgumentHandler(argv);
+        Log log = new Log(out, argHandler);
+        MemoryMonitor monitor = Monitor.getMemoryMonitor(log, argHandler);
+        List pools = monitor.getMemoryPoolMBeans();
+
+        for (int i = 0; i < pools.size(); i++) {
+            Object pool = pools.get(i);
+
+            try {
+                monitor.getCollectionUsage(pool);
+            } catch (Exception e) {
+                log.complain("Unexpected exception " + e);
+                e.printStackTrace(log.getOutStream());
+                testFailed = true;
+            }
+        } // for i
+
+        if (testFailed)
+            out.println("TEST FAILED");
+        return (testFailed) ? Consts.TEST_FAILED : Consts.TEST_PASSED;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsage/getusage001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/getCollectionUsage/getusage001.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.getCollectionUsage()
+ *     does not throw any exception.
+ *     The test implements direct access to the metrics.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.MemoryPoolMBean.getCollectionUsage.getusage001
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsage/getusage002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/getCollectionUsage/getusage002.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.getCollectionUsage()
+ *     does not throw any exception.
+ *     The test implements access to the metrics via default MBean server.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.MemoryPoolMBean.getCollectionUsage.getusage001 -testMode=server
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsage/getusage003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/getCollectionUsage/getusage003.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.getCollectionUsage()
+ *     does not throw any exception.
+ *     The test implements access to the metrics via custom MBean server.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.getCollectionUsage.getusage001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsage/getusage004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/getCollectionUsage/getusage004.
+ * VM Testbase keywords: [quick, monitoring, quarantine]
+ * VM Testbase comments: JDK-8016181
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.getCollectionUsage()
+ *     does not throw any exception.
+ *     The test implements access to the metrics via default for MBean server
+ *     proxy.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.MemoryPoolMBean.getCollectionUsage.getusage001 -testMode=proxy
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsage/getusage005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/getCollectionUsage/getusage005.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.getCollectionUsage()
+ *     does not throw any exception.
+ *     The test implements access to the metrics via custom MBean server
+ *     proxy.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.getCollectionUsage.getusage001
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsageThreshold/getthreshold001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2004, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.MemoryPoolMBean.getCollectionUsageThreshold;
+
+import java.io.*;
+import java.util.*;
+import nsk.share.*;
+import nsk.monitoring.share.*;
+
+public class getthreshold001 {
+    private static boolean testFailed = false;
+    private static MemoryMonitor monitor;
+
+    public static void main(String[] argv) {
+        System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
+    }
+
+    public static int run(String[] argv, PrintStream out) {
+        ArgumentHandler argHandler = new ArgumentHandler(argv);
+        Log log = new Log(out, argHandler);
+        monitor = Monitor.getMemoryMonitor(log, argHandler);
+        List pools = monitor.getMemoryPoolMBeans();
+
+        for (int i = 0; i < pools.size(); i++) {
+            Object pool = pools.get(i);
+            log.display(i + " pool " + monitor.getName(pool));
+
+            boolean isSupported = monitor.isCollectionThresholdSupported(pool);
+            if (isSupported) {
+                log.display("  supports collection usage thresholds");
+
+                // Test three values for the threshold
+                long max = monitor.getUsage(pool).getMax();
+                long used = monitor.getUsage(pool).getUsed();
+
+                // max value can be -1, so take an absolute value
+                test(monitor, pool, Math.abs(max), log);
+                test(monitor, pool, 0, log);
+                test(monitor, pool, used, log);
+            } else {
+                log.display("  does not support collection usage thresholds");
+
+                // UnsupportedOperationException is expected
+                try {
+                    long threshold = monitor.getCollectionThreshold(pool);
+                    log.complain("Threshold " + threshold + " is returned "
+                               + "instead of UnsupportedOperationException "
+                               + "in pool " + monitor.getName(pool));
+                    testFailed = true;
+                } catch (Exception e) {
+                    Throwable unwrapped = unwrap(e);
+
+                    if (unwrapped instanceof UnsupportedOperationException) {
+                        log.display("  UnsupportedOperationException is "
+                                  + "thrown");
+                    } else {
+                        log.complain("Incorrect execption " + unwrapped
+                                   + " is thrown, "
+                                   + "UnsupportedOperationException is "
+                                   + "expected in pool "
+                                   + monitor.getName(pool));
+                        unwrapped.printStackTrace(log.getOutStream());
+                        testFailed = true;
+                    }
+                } // try
+            }
+        } // for i
+
+        if (testFailed)
+            out.println("TEST FAILED");
+        return (testFailed) ? Consts.TEST_FAILED : Consts.TEST_PASSED;
+    }
+
+    private static void test(MemoryMonitor monitor, Object pool,
+                                                      long threshold, Log log) {
+        log.display("  setting threshold " + threshold);
+        try {
+            monitor.setCollectionThreshold(pool, threshold);
+        } catch (Exception e) {
+            log.complain("Unexpected exception " + e + " in pool "
+                       + monitor.getName(pool));
+            e.printStackTrace(log.getOutStream());
+            testFailed = true;
+            return;
+        }
+        log.display("  threshold " + threshold + " is set");
+
+        long result = monitor.getCollectionThreshold(pool);
+        if (threshold != result) {
+            log.complain("Threshold value is " + result + " in pool "
+                       + monitor.getName(pool) + ", " + threshold
+                       + " expected");
+            testFailed = true;
+        }
+        log.display("  threshold " + threshold + " is read");
+    } // test()
+
+
+    static Throwable unwrap(Throwable throwable) {
+
+        Throwable unwrapped, t = throwable;
+
+        do {
+            unwrapped = t;
+
+            if (unwrapped instanceof UnsupportedOperationException) {
+                break;
+            }
+
+            t = unwrapped.getCause();
+
+        } while (t != null);
+
+        return unwrapped;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsageThreshold/getthreshold001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/getCollectionUsageThreshold/getthreshold001.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.getCollectionUsageThreshold()
+ *     1. returns the correct threshold value that was just set to the pool,
+ *        if the pool supports collection usage thresholds. Three values are
+ *        tested:
+ *            - 0;
+ *            - used value for the pool;
+ *            - max value for the pool.
+ *     2. throws UnsupportedOperationException, if the pool does not support
+ *        collection usage thresholds.
+ *     The test implements direct access to the metrics.
+ * COMMENT
+ *     Fixed the bug:
+ *     5035038 Chain of JMX exceptions impact on monitoring tests
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.MemoryPoolMBean.getCollectionUsageThreshold.getthreshold001
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsageThreshold/getthreshold002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/getCollectionUsageThreshold/getthreshold002.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.getCollectionUsageThreshold()
+ *     1. returns the correct threshold value that was just set to the pool,
+ *        if the pool supports collection usage thresholds. Three values are
+ *        tested:
+ *            - 0;
+ *            - used value for the pool;
+ *            - max value for the pool.
+ *     2. throws UnsupportedOperationException, if the pool does not support
+ *        collection usage thresholds.
+ *     The test implements access to the metrics via default MBean server.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.getCollectionUsageThreshold.getthreshold001
+ *      -testMode=server
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsageThreshold/getthreshold003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/getCollectionUsageThreshold/getthreshold003.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.getCollectionUsageThreshold()
+ *     1. returns the correct threshold value that was just set to the pool,
+ *        if the pool supports collection usage thresholds. Three values are
+ *        tested:
+ *            - 0;
+ *            - used value for the pool;
+ *            - max value for the pool.
+ *     2. throws UnsupportedOperationException, if the pool does not support
+ *        collection usage thresholds.
+ *     The test implements access to the metrics via custom MBean server.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.getCollectionUsageThreshold.getthreshold001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsageThreshold/getthreshold004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/getCollectionUsageThreshold/getthreshold004.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.getCollectionUsageThreshold()
+ *     1. returns the correct threshold value that was just set to the pool,
+ *        if the pool supports collection usage thresholds. Three values are
+ *        tested:
+ *            - 0;
+ *            - used value for the pool;
+ *            - max value for the pool.
+ *     2. throws UnsupportedOperationException, if the pool does not support
+ *        collection usage thresholds.
+ *     The test implements access to the metrics via default MBean server proxy.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.getCollectionUsageThreshold.getthreshold001
+ *      -testMode=proxy
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsageThreshold/getthreshold005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/getCollectionUsageThreshold/getthreshold005.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.getCollectionUsageThreshold()
+ *     1. returns the correct threshold value that was just set to the pool,
+ *        if the pool supports collection usage thresholds. Three values are
+ *        tested:
+ *            - 0;
+ *            - used value for the pool;
+ *            - max value for the pool.
+ *     2. throws UnsupportedOperationException, if the pool does not support
+ *        collection usage thresholds.
+ *     The test implements access to the metrics via custom MBean server proxy.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.getCollectionUsageThreshold.getthreshold001
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsageThresholdCount/getcount001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2004, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.MemoryPoolMBean.getCollectionUsageThresholdCount;
+
+import java.io.*;
+import java.util.*;
+import nsk.share.*;
+import nsk.monitoring.share.*;
+
+public class getcount001 {
+    private static boolean testFailed = false;
+    static MemoryMonitor monitor;
+
+    public static void main(String[] argv) {
+        System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
+    }
+
+    public static int run(String[] argv, PrintStream out) {
+        ArgumentHandler argHandler = new ArgumentHandler(argv);
+        Log log = new Log(out, argHandler);
+        monitor = Monitor.getMemoryMonitor(log, argHandler);
+        List pools = monitor.getMemoryPoolMBeans();
+
+        for (int i = 0; i < pools.size(); i++) {
+            Object pool = pools.get(i);
+            log.display(i + " pool " + monitor.getName(pool));
+
+            boolean isSupported = monitor.isCollectionThresholdSupported(pool);
+
+            if (isSupported) {
+
+                // Check that the method returns non-negative count
+                log.display("  supports collection usage thresholds");
+                long count = monitor.getCollectionThresholdCount(pool);
+                if (count < 0) {
+                    log.complain("Threshold count is less than zero: " + count
+                               + " in pool " + monitor.getName(pool));
+                    testFailed = true;
+                } else
+                    log.display("  getUsageThresholdCount() returned " + count);
+            } else {
+
+                // UnsupportedOperationException is expected
+                log.display("  does not support collection usage thresholds");
+                try {
+                    long count = monitor.getCollectionThresholdCount(pool);
+                    log.complain("Threshold ount " + count + " is returned "
+                               + "instead of UnsupportedOperationException in "
+                               + "pool " + monitor.getName(pool));
+                    testFailed = true;
+                } catch (Exception e) {
+
+                    Throwable unwrapped = unwrap(e);
+
+                    if (unwrapped instanceof UnsupportedOperationException)
+                        log.display("  UnsupportedOperationException is "
+                                  + "thrown");
+                     else {
+                         log.complain("Incorrect execption " + unwrapped
+                                    + " is thrown, "
+                                    + "UnsupportedOperationException is "
+                                    + "expected");
+                         unwrapped.printStackTrace(log.getOutStream());
+                         testFailed = true;
+                     }
+                } // try
+            }
+        } // for i
+
+        if (testFailed)
+            out.println("TEST FAILED");
+        return (testFailed) ? Consts.TEST_FAILED : Consts.TEST_PASSED;
+    }
+
+
+    static Throwable unwrap(Throwable throwable) {
+
+        Throwable unwrapped, t = throwable;
+
+        do {
+            unwrapped = t;
+
+            if (unwrapped instanceof UnsupportedOperationException) {
+                break;
+            }
+
+            t = unwrapped.getCause();
+
+        } while (t != null);
+
+        return unwrapped;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsageThresholdCount/getcount001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/getCollectionUsageThresholdCount/getcount001.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.getCollectionUsageThresholdCount()
+ *     1. returns not-negative value, if collection usage thresholds are supported;
+ *     2. throws UnsupportedOperationException, if collection usage thresholds are
+ *        not supported.
+ *     The test implements direct access to the metrics.
+ * COMMENT
+ *     Fixed the bug:
+ *     5035038 Chain of JMX exceptions impact on monitoring tests
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.MemoryPoolMBean.getCollectionUsageThresholdCount.getcount001
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsageThresholdCount/getcount002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/getCollectionUsageThresholdCount/getcount002.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.getCollectionUsageThresholdCount()
+ *     1. returns not-negative value, if collection usage thresholds are supported;
+ *     2. throws UnsupportedOperationException, if collection usage thresholds are
+ *        not supported.
+ *     The test implements access to the metrics via default MBean server.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.getCollectionUsageThresholdCount.getcount001
+ *      -testMode=server
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsageThresholdCount/getcount003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/getCollectionUsageThresholdCount/getcount003.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.getCollectionUsageThresholdCount()
+ *     1. returns not-negative value, if collection usage thresholds are supported;
+ *     2. throws UnsupportedOperationException, if collection usage thresholds are
+ *        not supported.
+ *     The test implements access to the metrics via custom MBean server.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.getCollectionUsageThresholdCount.getcount001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsageThresholdCount/getcount004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/getCollectionUsageThresholdCount/getcount004.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.getCollectionUsageThresholdCount()
+ *     1. returns not-negative value, if collection usage thresholds are supported;
+ *     2. throws UnsupportedOperationException, if collection usage thresholds are
+ *        not supported.
+ *     The test implements access to the metrics via default MBean server proxy.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.getCollectionUsageThresholdCount.getcount001
+ *      -testMode=proxy
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getCollectionUsageThresholdCount/getcount005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/getCollectionUsageThresholdCount/getcount005.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.getCollectionUsageThresholdCount()
+ *     1. returns not-negative value, if collection usage thresholds are supported;
+ *     2. throws UnsupportedOperationException, if collection usage thresholds are
+ *        not supported.
+ *     The test implements access to the metrics via custom MBean server proxy.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.getCollectionUsageThresholdCount.getcount001
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getPeakUsage/getpeak001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2004, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.MemoryPoolMBean.getPeakUsage;
+
+import java.io.*;
+import java.lang.management.*;
+import java.util.*;
+import nsk.share.*;
+import nsk.monitoring.share.*;
+
+public class getpeak001 {
+    private static boolean testFailed = false;
+
+    public static void main(String[] argv) {
+        System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
+    }
+
+    public static int run(String[] argv, PrintStream out) {
+        ArgumentHandler argHandler = new ArgumentHandler(argv);
+        Log log = new Log(out, argHandler);
+        MemoryMonitor monitor = Monitor.getMemoryMonitor(log, argHandler);
+        List pools = monitor.getMemoryPoolMBeans();
+        MemoryUsage usage = null;
+
+        for (int i = 0; i < pools.size(); i++) {
+            byte[] b = new byte[10 * 1024]; // Eat 10K
+            Object pool = pools.get(i);
+
+            // No exceptions should be thrown
+            try {
+                usage = monitor.getPeakUsage(pool);
+                log.display(i + " " + monitor.getName(pool) + ": " + usage);
+            } catch (Throwable t) {
+                if (t instanceof ThreadDeath)
+                    throw (ThreadDeath) t;
+                log.complain("Unexpected exception in pool "
+                           + monitor.getName(pool));
+                t.printStackTrace(log.getOutStream());
+                testFailed = true;
+                continue;
+            }
+
+            boolean isValid = monitor.isValid(pool);
+            if (isValid) {
+                if (usage == null) {
+                    log.complain("getPeakUsage() returned null for the valid "
+                           + "pool " + monitor.getName(pool));
+                    testFailed = true;
+                }
+            } else {
+                if (usage != null) {
+                    log.complain("getPeakUsage() returned not-null: " + usage
+                               + " for invalid pool " + monitor.getName(pool));
+                    testFailed = true;
+                }
+            }
+        } // for i
+
+        if (testFailed)
+            out.println("TEST FAILED");
+        return (testFailed) ? Consts.TEST_FAILED : Consts.TEST_PASSED;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getPeakUsage/getpeak001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/getPeakUsage/getpeak001.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.getPeakUsage()
+ *     1. does not throw any exceptions;
+ *     2. returns null, if the pool is invalid, and not-null MemoryUsage object,
+ *        if the pool is valid.
+ *     The test implements direct access to the metrics.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.MemoryPoolMBean.getPeakUsage.getpeak001
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getPeakUsage/getpeak002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/getPeakUsage/getpeak002.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.getPeakUsage()
+ *     1. does not throw any exceptions;
+ *     2. returns null, if the pool is invalid, and not-null MemoryUsage object,
+ *        if the pool is valid.
+ *     The test implements access to the metrics via default MBean server.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.MemoryPoolMBean.getPeakUsage.getpeak001 -testMode=server
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getPeakUsage/getpeak003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/getPeakUsage/getpeak003.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.getPeakUsage()
+ *     1. does not throw any exceptions;
+ *     2. returns null, if the pool is invalid, and not-null MemoryUsage object,
+ *        if the pool is valid.
+ *     The test implements access to the metrics via custom MBean server.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.getPeakUsage.getpeak001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getPeakUsage/getpeak004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/getPeakUsage/getpeak004.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.getPeakUsage()
+ *     1. does not throw any exceptions;
+ *     2. returns null, if the pool is invalid, and not-null MemoryUsage object,
+ *        if the pool is valid.
+ *     The test implements access to the metrics via default MBean server proxy.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.MemoryPoolMBean.getPeakUsage.getpeak001 -testMode=proxy
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getPeakUsage/getpeak005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/getPeakUsage/getpeak005.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.getPeakUsage()
+ *     1. does not throw any exceptions;
+ *     2. returns null, if the pool is invalid, and not-null MemoryUsage object,
+ *        if the pool is valid.
+ *     The test implements access to the metrics via custom MBean server proxy.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.getPeakUsage.getpeak001
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsage/getusage001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2004, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.MemoryPoolMBean.getUsage;
+
+import java.io.*;
+import java.lang.management.*;
+import java.util.*;
+import nsk.share.*;
+import nsk.monitoring.share.*;
+
+public class getusage001 {
+    private static boolean testFailed = false;
+
+    public static void main(String[] argv) {
+        System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
+    }
+
+    public static int run(String[] argv, PrintStream out) {
+        ArgumentHandler argHandler = new ArgumentHandler(argv);
+        Log log = new Log(out, argHandler);
+        MemoryMonitor monitor = Monitor.getMemoryMonitor(log, argHandler);
+        List pools = monitor.getMemoryPoolMBeans();
+        MemoryUsage usage = null;
+
+        for (int i = 0; i < pools.size(); i++) {
+            byte[] b = new byte[10 * 1024]; // Eat 10K
+            Object pool = pools.get(i);
+
+            // No exceptions should be thrown
+            try {
+                usage = monitor.getUsage(pool);
+                log.display(i + " " + monitor.getName(pool) + ": " + usage);
+            } catch (Throwable t) {
+                if (t instanceof ThreadDeath)
+                    throw (ThreadDeath) t;
+                log.complain("Unexpected exception in pool "
+                           + monitor.getName(pool));
+                t.printStackTrace(log.getOutStream());
+                testFailed = true;
+                continue;
+            }
+
+            boolean isValid = monitor.isValid(pool);
+            if (isValid) {
+                if (usage == null) {
+                    log.complain("getPeakUsage() returned null for the valid "
+                           + "pool " + monitor.getName(pool));
+                    testFailed = true;
+                }
+            } else {
+                if (usage != null) {
+                    log.complain("getPeakUsage() returned not-null: " + usage
+                               + " for invalid pool " + monitor.getName(pool));
+                    testFailed = true;
+                }
+            }
+        } // for i
+
+        if (testFailed)
+            out.println("TEST FAILED");
+        return (testFailed) ? Consts.TEST_FAILED : Consts.TEST_PASSED;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsage/getusage001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/getUsage/getusage001.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.getUsage()
+ *     1. does not throw any exceptions;
+ *     2. returns null, if the pool is invalid, and not-null MemoryUsage object,
+ *        if the pool is valid.
+ *     The test implements direct access to the metrics.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.MemoryPoolMBean.getUsage.getusage001
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsage/getusage002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/getUsage/getusage002.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.getUsage()
+ *     1. does not throw any exceptions;
+ *     2. returns null, if the pool is invalid, and not-null MemoryUsage object,
+ *        if the pool is valid.
+ *     The test implements access to the metrics via default MBean server.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.MemoryPoolMBean.getUsage.getusage001 -testMode=server
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsage/getusage003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/getUsage/getusage003.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.getUsage()
+ *     1. does not throw any exceptions;
+ *     2. returns null, if the pool is invalid, and not-null MemoryUsage object,
+ *        if the pool is valid.
+ *     The test implements access to the metrics via custom MBean server.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.getUsage.getusage001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsage/getusage004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/getUsage/getusage004.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.getUsage()
+ *     1. does not throw any exceptions;
+ *     2. returns null, if the pool is invalid, and not-null MemoryUsage object,
+ *        if the pool is valid.
+ *     The test implements access to the metrics via default MBean server proxy.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.MemoryPoolMBean.getUsage.getusage001 -testMode=proxy
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsage/getusage005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/getUsage/getusage005.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.getUsage()
+ *     1. does not throw any exceptions;
+ *     2. returns null, if the pool is invalid, and not-null MemoryUsage object,
+ *        if the pool is valid.
+ *     The test implements access to the metrics via custom MBean server proxy.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.getUsage.getusage001
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsageThreshold/getthreshold001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2004, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.MemoryPoolMBean.getUsageThreshold;
+
+import java.io.*;
+import java.util.*;
+import nsk.share.*;
+import nsk.monitoring.share.*;
+
+public class getthreshold001 {
+    private static boolean testFailed = false;
+    static MemoryMonitor monitor;
+
+    public static void main(String[] argv) {
+        System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
+    }
+
+    public static int run(String[] argv, PrintStream out) {
+        ArgumentHandler argHandler = new ArgumentHandler(argv);
+        Log log = new Log(out, argHandler);
+        monitor = Monitor.getMemoryMonitor(log, argHandler);
+        List pools = monitor.getMemoryPoolMBeans();
+
+        for (int i = 0; i < pools.size(); i++) {
+            Object pool = pools.get(i);
+            log.display(i + " pool " + monitor.getName(pool));
+
+            boolean isSupported = monitor.isUsageThresholdSupported(pool);
+            if (isSupported) {
+                log.display("  supports usage thresholds");
+
+                // Test three values for the threshold
+                long max = monitor.getUsage(pool).getMax();
+                long used = monitor.getUsage(pool).getUsed();
+
+                // max value can be -1, so take an absolute value
+                test(monitor, pool, Math.abs(max), log);
+                test(monitor, pool, 0, log);
+                test(monitor, pool, used, log);
+            } else {
+                log.display("  does not support usage thresholds");
+
+                // UnsupportedOperationException is expected
+                try {
+                    long threshold = monitor.getUsageThreshold(pool);
+                    log.complain("Threshold " + threshold + " is returned "
+                               + "instead of UnsupportedOperationException "
+                               + "in pool " + monitor.getName(pool));
+                    testFailed = true;
+                } catch (Exception e) {
+
+                    Throwable unwrapped = unwrap(e);
+
+                    if (unwrapped instanceof UnsupportedOperationException) {
+                        log.display("  UnsupportedOperationException is "
+                                  + "thrown");
+                    } else {
+                        log.complain("Incorrect execption " + unwrapped
+                                   + " is thrown, "
+                                   + "UnsupportedOperationException is "
+                                   + "expected in pool "
+                                   + monitor.getName(pool));
+                        unwrapped.printStackTrace(log.getOutStream());
+                        testFailed = true;
+                    }
+                } // try
+            }
+        } // for i
+
+        if (testFailed)
+            out.println("TEST FAILED");
+        return (testFailed) ? Consts.TEST_FAILED : Consts.TEST_PASSED;
+    }
+
+    private static void test(MemoryMonitor monitor, Object pool,
+                                                      long threshold, Log log) {
+        log.display("  setting threshold " + threshold);
+        try {
+            monitor.setUsageThreshold(pool, threshold);
+        } catch (Exception e) {
+            log.complain("Unexpected exception " + e);
+            e.printStackTrace(log.getOutStream());
+            testFailed = true;
+            return;
+        }
+        log.display("  threshold " + threshold + " is set");
+
+        long result = monitor.getUsageThreshold(pool);
+        if (threshold != result) {
+            log.complain("Threshold value is " + result + " in pool "
+                       + monitor.getName(pool) + ", " + threshold
+                       + " expected");
+            testFailed = true;
+        }
+        log.display("  threshold " + threshold + " is read");
+    } // test()
+
+    static Throwable unwrap(Throwable throwable) {
+
+        Throwable unwrapped, t = throwable;
+
+        do {
+            unwrapped = t;
+
+            if (unwrapped instanceof UnsupportedOperationException) {
+                break;
+            }
+
+            t = unwrapped.getCause();
+
+        } while (t != null);
+
+        return unwrapped;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsageThreshold/getthreshold001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/getUsageThreshold/getthreshold001.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.getUsageThreshold()
+ *     1. returns the correct threshold value that was just set to the pool,
+ *        if the pool supports usage thresholds. The tested values of the
+ *        threshold are:
+ *            - 0;
+ *            - max value for the pool;
+ *            - used value for the pool.
+ *     2. throws UnsupportedOperationException, if the pool does not support
+ *        usage thresholds.
+ *     The test implements direct access to the metrics.
+ * COMMENT
+ *     Fixed the bug
+ *     4989235 TEST: The spec is updated accoring to 4982289, 4985742
+ *     Fixed the bug:
+ *     5035038 Chain of JMX exceptions impact on monitoring tests
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.MemoryPoolMBean.getUsageThreshold.getthreshold001
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsageThreshold/getthreshold002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/getUsageThreshold/getthreshold002.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.getUsageThreshold()
+ *     1. returns the correct threshold value that was just set to the pool,
+ *        if the pool supports usage thresholds. The tested values of the
+ *        threshold are:
+ *            - 0;
+ *            - max value for the pool;
+ *            - used value for the pool.
+ *     2. returns -1, if the pool does not support usage thresholds.
+ *     The test implements access to the metrics via default MBean server.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.getUsageThreshold.getthreshold001
+ *      -testMode=server
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsageThreshold/getthreshold003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/getUsageThreshold/getthreshold003.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.getUsageThreshold()
+ *     1. returns the correct threshold value that was just set to the pool,
+ *        if the pool supports usage thresholds. The tested values of the
+ *        threshold are:
+ *            - 0;
+ *            - max value for the pool;
+ *            - used value for the pool.
+ *     2. returns -1, if the pool does not support usage thresholds.
+ *     The test implements access to the metrics via custom MBean server.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.getUsageThreshold.getthreshold001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsageThreshold/getthreshold004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/getUsageThreshold/getthreshold004.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.getUsageThreshold()
+ *     1. returns the correct threshold value that was just set to the pool,
+ *        if the pool supports usage thresholds. The tested values of the
+ *        threshold are:
+ *            - 0;
+ *            - max value for the pool;
+ *            - used value for the pool.
+ *     2. returns -1, if the pool does not support usage thresholds.
+ *     The test implements access to the metrics via default MBean server
+ *     proxy.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.getUsageThreshold.getthreshold001
+ *      -testMode=proxy
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsageThreshold/getthreshold005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/getUsageThreshold/getthreshold005.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.getUsageThreshold()
+ *     1. returns the correct threshold value that was just set to the pool,
+ *        if the pool supports usage thresholds. The tested values of the
+ *        threshold are:
+ *            - 0;
+ *            - max value for the pool;
+ *            - used value for the pool.
+ *     2. returns -1, if the pool does not support usage thresholds.
+ *     The test implements access to the metrics via custom MBean server proxy.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.getUsageThreshold.getthreshold001
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsageThresholdCount/getcount001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2004, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.MemoryPoolMBean.getUsageThresholdCount;
+
+import java.io.*;
+import java.util.*;
+import nsk.share.*;
+import nsk.monitoring.share.*;
+
+public class getcount001 {
+    private static boolean testFailed = false;
+    static MemoryMonitor monitor;
+
+    public static void main(String[] argv) {
+        System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
+    }
+
+    public static int run(String[] argv, PrintStream out) {
+        ArgumentHandler argHandler = new ArgumentHandler(argv);
+        Log log = new Log(out, argHandler);
+        monitor = Monitor.getMemoryMonitor(log, argHandler);
+        List pools = monitor.getMemoryPoolMBeans();
+
+        for (int i = 0; i < pools.size(); i++) {
+            Object pool = pools.get(i);
+            log.display(i + " pool " + monitor.getName(pool));
+
+            boolean isSupported = monitor.isUsageThresholdSupported(pool);
+
+            if (isSupported) {
+                log.display("  supports usage thresholds");
+                long count = monitor.getUsageThresholdCount(pool);
+                if (count < 0) {
+                    log.complain("Threshold count is less than zero: " + count
+                               + " in pool " + monitor.getName(pool));
+                    testFailed = true;
+                } else
+                    log.display("  getUsageThresholdCount() returned " + count);
+            } else {
+
+                // UnsupportedOperationException is expected
+                log.display("  does not support usage thresholds");
+                try {
+                    monitor.getUsageThresholdCount(pool);
+                    log.complain("UnsupportedOperationException is not thrown "
+                               + "in pool " + monitor.getName(pool));
+                    testFailed = true;
+                } catch (Exception e) {
+
+                    Throwable unwrapped = unwrap(e);
+
+                    if (unwrapped instanceof UnsupportedOperationException)
+                        log.display("  UnsupportedOperationException is "
+                                  + "thrown");
+                     else {
+                         log.complain("  Incorrect execption " + unwrapped
+                                    + " is thrown, "
+                                    + "UnsupportedOperationException is "
+                                    + "expected");
+                         unwrapped.printStackTrace(log.getOutStream());
+                         testFailed = true;
+                     }
+                } // try
+            }
+        } // for i
+
+        if (testFailed)
+            out.println("TEST FAILED");
+        return (testFailed) ? Consts.TEST_FAILED : Consts.TEST_PASSED;
+    }
+
+    static Throwable unwrap(Throwable throwable) {
+
+        Throwable unwrapped, t = throwable;
+
+        do {
+            unwrapped = t;
+
+            if (unwrapped instanceof UnsupportedOperationException) {
+                break;
+            }
+
+            t = unwrapped.getCause();
+
+        } while (t != null);
+
+        return unwrapped;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsageThresholdCount/getcount001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/getUsageThresholdCount/getcount001.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.getUsageThresholdCount()
+ *     1. returns not-negative value, if usage thresholds are supported;
+ *     2. throws UnsupportedOperationException, if usage thresholds are not
+ *        supported.
+ *     The test implements direct access to the metrics.
+ * COMMENT
+ *     Fixed the bug:
+ *     5035038 Chain of JMX exceptions impact on monitoring tests
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.MemoryPoolMBean.getUsageThresholdCount.getcount001
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsageThresholdCount/getcount002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/getUsageThresholdCount/getcount002.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.getUsageThresholdCount()
+ *     1. returns not-negative value, if usage thresholds are supported;
+ *     2. throws UnsupportedOperationException, if usage thresholds are not
+ *        supported.
+ *     The test implements access to the metrics via default MBean server.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.getUsageThresholdCount.getcount001
+ *      -testMode=server
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsageThresholdCount/getcount003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/getUsageThresholdCount/getcount003.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.getUsageThresholdCount()
+ *     1. returns not-negative value, if usage thresholds are supported;
+ *     2. throws UnsupportedOperationException, if usage thresholds are not
+ *        supported.
+ *     The test implements access to the metrics via custom MBean server.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.getUsageThresholdCount.getcount001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsageThresholdCount/getcount004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/getUsageThresholdCount/getcount004.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.getUsageThresholdCount()
+ *     1. returns not-negative value, if usage thresholds are supported;
+ *     2. throws UnsupportedOperationException, if usage thresholds are not
+ *        supported.
+ *     The test implements access to the metrics via default MBean server proxy.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.getUsageThresholdCount.getcount001
+ *      -testMode=proxy
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/getUsageThresholdCount/getcount005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/getUsageThresholdCount/getcount005.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.getUsageThresholdCount()
+ *     1. returns not-negative value, if usage thresholds are supported;
+ *     2. throws UnsupportedOperationException, if usage thresholds are not
+ *        supported.
+ *     The test implements access to the metrics via custom MBean server proxy.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.getUsageThresholdCount.getcount001
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdExceeded/isexceeded001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,173 @@
+/*
+ * Copyright (c) 2004, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.MemoryPoolMBean.isCollectionUsageThresholdExceeded;
+
+import java.lang.management.*;
+import java.io.*;
+import java.util.*;
+import nsk.share.*;
+import nsk.monitoring.share.*;
+
+public class isexceeded001 {
+    private static boolean testFailed = false;
+    static MemoryMonitor monitor;
+
+    public static void main(String[] argv) {
+        System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
+    }
+
+    public static int run(String[] argv, PrintStream out) {
+        ArgumentHandler argHandler = new ArgumentHandler(argv);
+        Log log = new Log(out, argHandler);
+        monitor = Monitor.getMemoryMonitor(log, argHandler);
+        List pools = monitor.getMemoryPoolMBeans();
+
+        for (int i = 0; i < pools.size(); i++) {
+            Object pool = pools.get(i);
+            log.display(i + " pool " + monitor.getName(pool));
+
+            if (!monitor.isCollectionThresholdSupported(pool)) {
+                log.display("  does not support collection usage thresholds");
+
+                // UnsupportedOperationException is expected
+                try {
+                    boolean isExceeded
+                        = monitor.isCollectionThresholdExceeded(pool);
+                    log.complain("isCollectionUsageThresholdExceeded() returned"
+                               + " " + isExceeded + "instead of "
+                               + "UnsupportedOperationException in pool "
+                               + monitor.getName(pool));
+                    testFailed = true;
+                } catch (Exception e) {
+
+                    Throwable unwrapped = unwrap(e);
+
+                    if (unwrapped instanceof UnsupportedOperationException) {
+                        log.display("  UnsupportedOperationException is "
+                                  + "thrown");
+                    } else {
+                        log.complain("Incorrect execption " + unwrapped
+                                   + " is thrown, "
+                                   + "UnsupportedOperationException is "
+                                   + "expected");
+                        unwrapped.printStackTrace(log.getOutStream());
+                        testFailed = true;
+                    }
+                } // try
+                continue;
+            } // if
+
+            log.display("  supports collection usage thresholds");
+
+            // Set a threshold that is greater than used value
+            MemoryUsage usage = monitor.getCollectionUsage(pool);
+            long used = usage.getUsed();
+            long max = usage.getMax();
+            long threshold = used + 1;
+
+            if ( (max > -1) && (threshold > max) )
+                threshold = max;
+            log.display("  setting threshold " + threshold + " "
+                      + monitor.getCollectionUsage(pool));
+            try {
+                monitor.setCollectionThreshold(pool, threshold);
+            } catch (Exception e) {
+                log.complain("Unexpected " + e + " in pool "
+                           + monitor.getName(pool));
+                e.printStackTrace(log.getOutStream());
+                testFailed = true;
+                continue;
+            }
+            boolean isExceeded = monitor.isCollectionThresholdExceeded(pool);
+            log.display("  threshold " + threshold + " is set, (used = " + used
+                      + ", isExceeded = " + isExceeded + ")");
+
+            // Eat some memory - provoke usage of the pool to cross the
+            // threshold value
+            byte[] b = new byte[100 * 1024]; // Eat 100K
+
+            threshold = monitor.getCollectionThreshold(pool);
+            usage = monitor.getCollectionUsage(pool);
+            used = usage.getUsed();
+
+            if (used >= threshold) {
+                log.display("  used value (" + used + ") crossed the threshold "
+                          + "value (" + threshold + ")");
+
+                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;
+                    }
+                }
+            } else {
+                log.display("  used value (" + used + ") did not cross the "
+                          + "threshold value (" + threshold + ")");
+
+                isExceeded = monitor.isCollectionThresholdExceeded(pool);
+                if (isExceeded) {
+
+                    // Refresh the values
+                    threshold = monitor.getCollectionThreshold(pool);
+                    usage = monitor.getCollectionUsage(pool);
+                    if (used < threshold) {
+                        log.complain("isCollectionUsageThresholdExceeded() "
+                                   + "returned true, while threshold = "
+                                   + threshold + " and " + "used = " + used);
+                        testFailed = true;
+                    }
+                }
+            }
+        } // for i
+
+        if (testFailed)
+            out.println("TEST FAILED");
+        return (testFailed) ? Consts.TEST_FAILED : Consts.TEST_PASSED;
+    }
+
+    static Throwable unwrap(Throwable throwable) {
+
+        Throwable unwrapped, t = throwable;
+
+        do {
+            unwrapped = t;
+
+            if (unwrapped instanceof UnsupportedOperationException) {
+                break;
+            }
+
+            t = unwrapped.getCause();
+
+        } while (t != null);
+
+        return unwrapped;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdExceeded/isexceeded001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdExceeded/isexceeded001.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.isCollectionUsageThresholdExceeded()
+ *     returns correct results, if the pool supports collection usage thresholds.
+ *     The test sets a threshold that is greater than used value, allocates 100K,
+ *     and checks that getCollectionUsageThreshold(), getUsed(),
+ *     isCollectionUsageThresholdExceeded() do not contradict each other, i.e.:
+ *         1. if used value is greater or equal than threshold, then
+ *            isCollectionUsageThresholdExceeded() is expected to return true;
+ *         2. if used value is less than threshold, then
+ *            isCollectionUsageThresholdExceeded() is expected to return false.
+ *     If the collection usage thresholds are not supported,
+ *     UnsupportedOperationException is expected to be thrown by the method.
+ *     The test implements direct access to the metrics.
+ * COMMENT
+ *     Fixed the bug
+ *     4989235 TEST: The spec is updated according to 4982289, 4985742
+ *     Fixed the bug:
+ *     5035038 Chain of JMX exceptions impact on monitoring tests
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.MemoryPoolMBean.isCollectionUsageThresholdExceeded.isexceeded001
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdExceeded/isexceeded002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdExceeded/isexceeded002.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.isCollectionUsageThresholdExceeded()
+ *     returns correct results, if the pool supports collection usage thresholds.
+ *     The test sets a threshold that is greater than used value, allocates 100K,
+ *     and checks that getCollectionUsageThreshold(), getUsed(),
+ *     isCollectionUsageThresholdExceeded() do not contradict each other, i.e.:
+ *         1. if used value is greater or equal than threshold, then
+ *            isCollectionUsageThresholdExceeded() is expected to return true;
+ *         2. if used value is less than threshold, then
+ *            isCollectionUsageThresholdExceeded() is expected to return false.
+ *     If the collection usage thresholds are not supported,
+ *     UnsupportedOperationException is expected to be thrown by the method.
+ *     The test implements access to the metrics via default MBean server.
+ * COMMENT
+ *     Fixed the bug
+ *     4989235 TEST: The spec is updated accoring to 4982289, 4985742
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.isCollectionUsageThresholdExceeded.isexceeded001
+ *      -testMode=server
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdExceeded/isexceeded003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdExceeded/isexceeded003.
+ * VM Testbase keywords: [quick, monitoring, quarantine]
+ * VM Testbase comments: JDK-8153598
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.isCollectionUsageThresholdExceeded()
+ *     returns correct results, if the pool supports collection usage thresholds.
+ *     The test sets a threshold that is greater than used value, allocates 100K,
+ *     and checks that getCollectionUsageThreshold(), getUsed(),
+ *     isCollectionUsageThresholdExceeded() do not contradict each other, i.e.:
+ *         1. if used value is greater or equal than threshold, then
+ *            isCollectionUsageThresholdExceeded() is expected to return true;
+ *         2. if used value is less than threshold, then
+ *            isCollectionUsageThresholdExceeded() is expected to return false.
+ *     If the collection usage thresholds are not supported,
+ *     UnsupportedOperationException is expected to be thrown by the method.
+ *     The test implements access to the metrics via custom MBean server.
+ * COMMENT
+ *     Fixed the bug
+ *     4989235 TEST: The spec is updated accoring to 4982289, 4985742
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.isCollectionUsageThresholdExceeded.isexceeded001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdExceeded/isexceeded004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdExceeded/isexceeded004.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.isCollectionUsageThresholdExceeded()
+ *     returns correct results, if the pool supports collection usage thresholds.
+ *     The test sets a threshold that is greater than used value, allocates 100K,
+ *     and checks that getCollectionUsageThreshold(), getUsed(),
+ *     isCollectionUsageThresholdExceeded() do not contradict each other, i.e.:
+ *         1. if used value is greater or equal than threshold, then
+ *            isCollectionUsageThresholdExceeded() is expected to return true;
+ *         2. if used value is less than threshold, then
+ *            isCollectionUsageThresholdExceeded() is expected to return false.
+ *     If the collection usage thresholds are not supported,
+ *     UnsupportedOperationException is expected to be thrown by the method.
+ *     The test implements access to the metrics via default MBean server proxy.
+ * COMMENT
+ *     Fixed the bug
+ *     4989235 TEST: The spec is updated accoring to 4982289, 4985742
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.isCollectionUsageThresholdExceeded.isexceeded001
+ *      -testMode=proxy
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdExceeded/isexceeded005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdExceeded/isexceeded005.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.isCollectionUsageThresholdExceeded()
+ *     returns correct results, if the pool supports collection usage thresholds.
+ *     The test sets a threshold that is greater than used value, allocates 100K,
+ *     and checks that getCollectionUsageThreshold(), getUsed(),
+ *     isCollectionUsageThresholdExceeded() do not contradict each other, i.e.:
+ *         1. if used value is greater or equal than threshold, then
+ *            isCollectionUsageThresholdExceeded() is expected to return true;
+ *         2. if used value is less than threshold, then
+ *            isCollectionUsageThresholdExceeded() is expected to return false.
+ *     If the collection usage thresholds are not supported,
+ *     UnsupportedOperationException is expected to be thrown by the method.
+ *     The test implements access to the metrics via custom MBean server proxy.
+ * COMMENT
+ *     Fixed the bug
+ *     4989235 TEST: The spec is updated accoring to 4982289, 4985742
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.isCollectionUsageThresholdExceeded.isexceeded001
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdSupported/issupported001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2004, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.MemoryPoolMBean.isCollectionUsageThresholdSupported;
+
+import java.io.*;
+import java.util.*;
+import nsk.share.*;
+import nsk.monitoring.share.*;
+
+public class issupported001 {
+    private static boolean testFailed = false;
+    static MemoryMonitor monitor;
+
+    public static void main(String[] argv) {
+        System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
+    }
+
+    public static int run(String[] argv, PrintStream out) {
+        ArgumentHandler argHandler = new ArgumentHandler(argv);
+        Log log = new Log(out, argHandler);
+        monitor = Monitor.getMemoryMonitor(log, argHandler);
+        List pools = monitor.getMemoryPoolMBeans();
+
+        for (int i = 0; i < pools.size(); i++) {
+            Object pool = pools.get(i);
+            log.display(i + " pool " + monitor.getName(pool));
+            boolean isSupported
+                = monitor.isCollectionThresholdSupported(pool);
+
+            if (isSupported) {
+
+                log.display("  supports collection usage thresholds");
+
+                // No exceptions are expected
+                try {
+                    long threshold = monitor.getCollectionThreshold(pool);
+                    log.display("  threshold " + threshold + " is read");
+                } catch (Exception e) {
+                    log.complain(e + " is thrown in pool "
+                               + monitor.getName(pool));
+                    e.printStackTrace(log.getOutStream());
+                    testFailed = true;
+                }
+            } else {
+
+                log.display("  does not support collection usage thresholds");
+
+                // UnsupportedOperationException is expected
+                try {
+                    long threshold = monitor.getCollectionThreshold(pool);
+                    log.complain("Threshold " + threshold + " is returned "
+                               + "instead of UnsupportedOperationException "
+                               + "in pool " + monitor.getName(pool));
+                    testFailed = true;
+                } catch (Exception e) {
+
+                    Throwable unwrapped = unwrap(e);
+
+                    if (unwrapped instanceof UnsupportedOperationException) {
+                        log.display("  UnsupportedOperationException is "
+                                  + "thrown");
+                    } else {
+                        log.complain("Incorrect execption " + unwrapped
+                                   + " is thrown, "
+                                   + "UnsupportedOperationException is "
+                                   + "expected");
+                        unwrapped.printStackTrace(log.getOutStream());
+                        testFailed = true;
+                    }
+                } // try
+            }
+        } // for i
+
+        if (testFailed)
+            out.println("TEST FAILED");
+        return (testFailed) ? Consts.TEST_FAILED : Consts.TEST_PASSED;
+    }
+
+    static Throwable unwrap(Throwable throwable) {
+
+        Throwable unwrapped, t = throwable;
+
+        do {
+            unwrapped = t;
+
+            if (unwrapped instanceof UnsupportedOperationException) {
+                break;
+            }
+
+            t = unwrapped.getCause();
+
+        } while (t != null);
+
+        return unwrapped;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdSupported/issupported001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdSupported/issupported001.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.isCollectionUsageThresholdSupported()
+ *     correctly detects if a pool supports collection thresholds.
+ *     1. getCollectionUsageThreshold() must not throw any exceptions, if
+ *        isCollectionUsageThresholdSupported() returns true for a pool;
+ *     2. getCollectionUsageThreshold() must throw UnsupportedOperationException,
+ *        if isCollectionUsageThresholdSupported() returns false for a pool;
+ *     The test implements access to the metrics via default MBean server.
+ * COMMENT
+ *     Fixed the bug:
+ *     5035038 Chain of JMX exceptions impact on monitoring tests
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.isCollectionUsageThresholdSupported.issupported001
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdSupported/issupported002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdSupported/issupported002.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.isCollectionUsageThresholdSupported()
+ *     correctly detects if a pool supports collection thresholds.
+ *     1. getCollectionUsageThreshold() must not throw any exceptions, if
+ *        isCollectionUsageThresholdSupported() returns true for a pool;
+ *     2. getCollectionUsageThreshold() must throw UnsupportedOperationException,
+ *        if isCollectionUsageThresholdSupported() returns false for a pool;
+ *     The test implements access to the metrics via default MBean server.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.isCollectionUsageThresholdSupported.issupported001
+ *      -testMode=server
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdSupported/issupported003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdSupported/issupported003.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.isCollectionUsageThresholdSupported()
+ *     correctly detects if a pool supports collection thresholds.
+ *     1. getCollectionUsageThreshold() must not throw any exceptions, if
+ *        isCollectionUsageThresholdSupported() returns true for a pool;
+ *     2. getCollectionUsageThreshold() must throw UnsupportedOperationException,
+ *        if isCollectionUsageThresholdSupported() returns false for a pool;
+ *     The test implements access to the metrics via custom MBean server.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.isCollectionUsageThresholdSupported.issupported001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdSupported/issupported004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdSupported/issupported004.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.isCollectionUsageThresholdSupported()
+ *     correctly detects if a pool supports collection thresholds.
+ *     1. getCollectionUsageThreshold() must not throw any exceptions, if
+ *        isCollectionUsageThresholdSupported() returns true for a pool;
+ *     2. getCollectionUsageThreshold() must throw UnsupportedOperationException,
+ *        if isCollectionUsageThresholdSupported() returns false for a pool;
+ *     The test implements access to the metrics via default MBean server proxy.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.isCollectionUsageThresholdSupported.issupported001
+ *      -testMode=proxy
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdSupported/issupported005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdSupported/issupported005.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.isCollectionUsageThresholdSupported()
+ *     correctly detects if a pool supports collection thresholds.
+ *     1. getCollectionUsageThreshold() must not throw any exceptions, if
+ *        isCollectionUsageThresholdSupported() returns true for a pool;
+ *     2. getCollectionUsageThreshold() must throw UnsupportedOperationException,
+ *        if isCollectionUsageThresholdSupported() returns false for a pool;
+ *     The test implements access to the metrics via custom MBean server proxy.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.isCollectionUsageThresholdSupported.issupported001
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdExceeded/isexceeded001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2004, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.MemoryPoolMBean.isUsageThresholdExceeded;
+
+import java.lang.management.*;
+import java.io.*;
+import java.util.*;
+import nsk.share.*;
+import nsk.monitoring.share.*;
+
+import javax.management.InstanceNotFoundException;
+import javax.management.Notification;
+import javax.management.NotificationFilter;
+import javax.management.NotificationListener;
+import javax.management.openmbean.CompositeData;
+
+public class isexceeded001 {
+    private static boolean testFailed = false;
+    private static final int INCREMENT = 100 * 1024; // 100kb
+    public static void main(String[] argv) {
+        System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
+    }
+
+    static byte[] b;
+
+    public static int run(String[] argv, PrintStream out) {
+        ArgumentHandler argHandler = new ArgumentHandler(argv);
+        Log log = new Log(out, argHandler);
+        MemoryMonitor monitor = Monitor.getMemoryMonitor(log, argHandler);
+        List pools = monitor.getMemoryPoolMBeans();
+
+        for (int i = 0; i < pools.size(); i++) {
+            Object pool = pools.get(i);
+            log.display(i + " pool " + monitor.getName(pool));
+
+            if (!monitor.isUsageThresholdSupported(pool)) {
+                log.display("  does not support usage thresholds");
+                continue;
+            } else
+                log.display("  supports usage thresholds");
+
+            // Set a threshold that is greater than used value
+            MemoryUsage usage = monitor.getUsage(pool);
+            long used = usage.getUsed();
+            long max = usage.getMax();
+            long threshold = used + 1;
+
+            if ( (max > -1) && (threshold > max) ) {
+                // we can't test threshold - not enough memory
+                log.display("not enough memory for testing threshold:" +
+                 " used=" + used +
+                 ", max = " + max );
+            }
+
+            monitor.setUsageThreshold(pool, threshold);
+            log.display("  threshold " + threshold + " is set, used = " + used );
+
+            monitor.resetPeakUsage(pool);
+            log.display("  resetting peak usage");
+            log.display("  peak usage = " + monitor.getPeakUsage(pool).getUsed());
+
+            // Eat some memory - provoke usage of the pool to cross the
+            // threshold value
+            b = new byte[INCREMENT]; // Eat 100K
+
+            boolean isExceeded = monitor.isUsageThresholdExceeded(pool);
+            usage = monitor.getPeakUsage(pool);
+            used = usage.getUsed();
+
+            log.display("  used value is " + used);
+
+            if (used < threshold && isExceeded) {
+                // There're problems with isUsageThresholdExceeded()
+                log.complain("isUsageThresholdExceeded() returned "
+                    + "true, while threshold = " + threshold
+                    + " and used peak = " + used);
+                    testFailed = true;
+            } else
+            if (used >= threshold && !isExceeded) {
+                // we can introduce some imprecision during pooling memory usage
+                // value at the Code Cache memory pool. Amount of used memory
+                // was changed after we'd calculated isExceeded value
+
+                if (monitor.isUsageThresholdExceeded(pool)) {
+                    // that's mean such imprecision
+                    log.display("isUsageThresholdExceeded() returned false,"
+                        + " while threshold = " + threshold + " and "
+                        + "used peak = " + used);
+                } else {
+                    // some other problems with isUsageThresholdExceeded()
+                    log.complain("isUsageThresholdExceeded() returned false,"
+                        + " while threshold = " + threshold + " and "
+                        + "used peak = " + used);
+                        testFailed = true;
+                }
+            }
+
+        } // for i
+
+        if (testFailed)
+            out.println("TEST FAILED");
+        return (testFailed) ? Consts.TEST_FAILED : Consts.TEST_PASSED;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdExceeded/isexceeded001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/isUsageThresholdExceeded/isexceeded001.
+ * VM Testbase keywords: [quick, monitoring, quarantine]
+ * VM Testbase comments: JDK-8153598
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.isUsageThresholdExceeded()
+ *     returns correct results, if the pool supports usage thresholds.
+ *     The test sets a threshold that is greater than used value, allocates 100K,
+ *     and chechs that getUsageThreshold(), getUsed(), isUsageThresholdExceeded()
+ *     do not contradict each other, i.e.:
+ *         1. if used value is greater or equal than threshold, then
+ *            isUsageThresholdExceeded() is expected to return true;
+ *         2. If used value is less than threshold, then isUsageThresholdExceeded()
+ *            is expected to return false.
+ *     The test implements direct access to the metrics.
+ * COMMENT
+ *     Fixed the bug
+ *     4989235 TEST: The spec is updated accoring to 4982289, 4985742
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.MemoryPoolMBean.isUsageThresholdExceeded.isexceeded001
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdExceeded/isexceeded002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/isUsageThresholdExceeded/isexceeded002.
+ * VM Testbase keywords: [quick, monitoring, quarantine]
+ * VM Testbase comments: JDK-8153598
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.isUsageThresholdExceeded()
+ *     returns correct results, if the pool supports usage thresholds.
+ *     The test sets a threshold that is greater than used value, allocates 100K,
+ *     and chechs that getUsageThreshold(), getUsed(), isUsageThresholdExceeded()
+ *     do not contradict each other, i.e.:
+ *         1. if used value is greater or equal than threshold, then
+ *            isUsageThresholdExceeded() is expected to return true;
+ *         2. If used value is less than threshold, then isUsageThresholdExceeded()
+ *            is expected to return false.
+ *     The test implements access to the metrics via default MBean server.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.isUsageThresholdExceeded.isexceeded001
+ *      -testMode=server
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdExceeded/isexceeded003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/isUsageThresholdExceeded/isexceeded003.
+ * VM Testbase keywords: [quick, monitoring, quarantine]
+ * VM Testbase comments: JDK-8153598
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.isUsageThresholdExceeded()
+ *     returns correct results, if the pool supports usage thresholds.
+ *     The test sets a threshold that is greater than used value, allocates 100K,
+ *     and chechs that getUsageThreshold(), getUsed(), isUsageThresholdExceeded()
+ *     do not contradict each other, i.e.:
+ *         1. if used value is greater or equal than threshold, then
+ *            isUsageThresholdExceeded() is expected to return true;
+ *         2. If used value is less than threshold, then isUsageThresholdExceeded()
+ *            is expected to return false.
+ *     The test implements access to the metrics via custom MBean server.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.isUsageThresholdExceeded.isexceeded001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdExceeded/isexceeded004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/isUsageThresholdExceeded/isexceeded004.
+ * VM Testbase keywords: [quick, monitoring, quarantine]
+ * VM Testbase comments: JDK-8153598
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.isUsageThresholdExceeded()
+ *     returns correct results, if the pool supports usage thresholds.
+ *     The test sets a threshold that is greater than used value, allocates 100K,
+ *     and chechs that getUsageThreshold(), getUsed(), isUsageThresholdExceeded()
+ *     do not contradict each other, i.e.:
+ *         1. if used value is greater or equal than threshold, then
+ *            isUsageThresholdExceeded() is expected to return true;
+ *         2. If used value is less than threshold, then isUsageThresholdExceeded()
+ *            is expected to return false.
+ *     The test implements access to the metrics via default MBean server proxy.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.isUsageThresholdExceeded.isexceeded001
+ *      -testMode=proxy
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdExceeded/isexceeded005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/isUsageThresholdExceeded/isexceeded005.
+ * VM Testbase keywords: [quick, monitoring, quarantine]
+ * VM Testbase comments: JDK-8153598
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.isUsageThresholdExceeded()
+ *     returns correct results, if the pool supports usage thresholds.
+ *     The test sets a threshold that is greater than used value, allocates 100K,
+ *     and chechs that getUsageThreshold(), getUsed(), isUsageThresholdExceeded()
+ *     do not contradict each other, i.e.:
+ *         1. if used value is greater or equal than threshold, then
+ *            isUsageThresholdExceeded() is expected to return true;
+ *         2. If used value is less than threshold, then isUsageThresholdExceeded()
+ *            is expected to return false.
+ *     The test implements access to the metrics via custom MBean server proxy.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.isUsageThresholdExceeded.isexceeded001
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdSupported/issupported001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2004, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.MemoryPoolMBean.isUsageThresholdSupported;
+
+import java.io.*;
+import java.util.*;
+import nsk.share.*;
+import nsk.monitoring.share.*;
+
+public class issupported001 {
+    private static boolean testFailed = false;
+    static MemoryMonitor monitor;
+
+    public static void main(String[] argv) {
+        System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
+    }
+
+    public static int run(String[] argv, PrintStream out) {
+        ArgumentHandler argHandler = new ArgumentHandler(argv);
+        Log log = new Log(out, argHandler);
+        monitor = Monitor.getMemoryMonitor(log, argHandler);
+        List pools = monitor.getMemoryPoolMBeans();
+
+        for (int i = 0; i < pools.size(); i++) {
+            Object pool = pools.get(i);
+            boolean isSupported = monitor.isUsageThresholdSupported(pool);
+
+            if (isSupported) {
+                log.display("  supports usage thresholds");
+
+                // No exceptions are expected
+                try {
+                    long threshold = monitor.getUsageThreshold(pool);
+                    log.display("  threshold " + threshold + " is read");
+                } catch (Exception e) {
+                    log.complain(e + " is thrown in pool "
+                               + monitor.getName(pool));
+                    e.printStackTrace(log.getOutStream());
+                    testFailed = true;
+                }
+            } else {
+                log.display("  does not support usage thresholds");
+
+                // UnsupportedOperationException is expected
+                try {
+                    long threshold = monitor.getUsageThreshold(pool);
+                    log.complain("Threshold " + threshold + " is returned "
+                               + "instead of UnsupportedOperationException "
+                               + "in pool " + monitor.getName(pool));
+                    testFailed = true;
+                } catch (Exception e) {
+
+                    Throwable unwrapped = unwrap(e);
+
+                    if (unwrapped instanceof UnsupportedOperationException) {
+                        log.display("  UnsupportedOperationException is "
+                                  + "thrown");
+                    } else {
+                        log.complain("Incorrect execption " + unwrapped
+                                   + " is thrown, "
+                                   + "UnsupportedOperationException is "
+                                   + "expected");
+                        unwrapped.printStackTrace(log.getOutStream());
+                        testFailed = true;
+                    }
+                } // try
+            }
+        } // for i
+
+        if (testFailed)
+            out.println("TEST FAILED");
+        return (testFailed) ? Consts.TEST_FAILED : Consts.TEST_PASSED;
+    }
+
+    static Throwable unwrap(Throwable throwable) {
+
+        Throwable unwrapped, t = throwable;
+
+        do {
+            unwrapped = t;
+
+            if (unwrapped instanceof UnsupportedOperationException) {
+                break;
+            }
+
+            t = unwrapped.getCause();
+
+        } while (t != null);
+
+        return unwrapped;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdSupported/issupported001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/isUsageThresholdSupported/issupported001.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.isUsageThresholdSupported()
+ *     returns correct results.
+ *     The test checks that for each memory pool
+ *         1. isUsageThresholdSupported() returns true and getUsageThreshold()
+ *            returns not -1 value, or
+ *         2. isUsageThresholdSupported() returns false and getUsageThreshold()
+ *            returns -1 value
+ *     Otherwise, the test fails.
+ *     The test implements direct access to the metrics.
+ * COMMENT
+ *     Fixed the bug
+ *     4989235 TEST: The spec is updated accoring to 4982289, 4985742
+ *     Adjusted the bug to Tiger-b40.
+ *     Fixed the bug:
+ *     5035038 Chain of JMX exceptions impact on monitoring tests
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.MemoryPoolMBean.isUsageThresholdSupported.issupported001
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdSupported/issupported002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/isUsageThresholdSupported/issupported002.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.isUsageThresholdSupported()
+ *     returns correct results.
+ *     The test checks that for each memory pool
+ *         1. isUsageThresholdSupported() returns true and getUsageThreshold()
+ *            returns not -1 value, or
+ *         2. isUsageThresholdSupported() returns false and getUsageThreshold()
+ *            returns -1 value
+ *     Otherwise, the test fails.
+ *     The test implements access to the metrics via default MBean server.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.isUsageThresholdSupported.issupported001
+ *      -testMode=server
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdSupported/issupported003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/isUsageThresholdSupported/issupported003.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.isUsageThresholdSupported()
+ *     returns correct results.
+ *     The test checks that for each memory pool
+ *         1. isUsageThresholdSupported() returns true and getUsageThreshold()
+ *            returns not -1 value, or
+ *         2. isUsageThresholdSupported() returns false and getUsageThreshold()
+ *            returns -1 value
+ *     Otherwise, the test fails.
+ *     The test implements access to the metrics via custom MBean server.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.isUsageThresholdSupported.issupported001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdSupported/issupported004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/isUsageThresholdSupported/issupported004.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.isUsageThresholdSupported()
+ *     returns correct results.
+ *     The test checks that for each memory pool
+ *         1. isUsageThresholdSupported() returns true and getUsageThreshold()
+ *            returns not -1 value, or
+ *         2. isUsageThresholdSupported() returns false and getUsageThreshold()
+ *            returns -1 value
+ *     Otherwise, the test fails.
+ *     The test implements access to the metrics via default MBean server proxy.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.isUsageThresholdSupported.issupported001
+ *      -testMode=proxy
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdSupported/issupported005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/isUsageThresholdSupported/issupported005.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.isUsageThresholdSupported()
+ *     returns correct results.
+ *     The test checks that for each memory pool
+ *         1. isUsageThresholdSupported() returns true and getUsageThreshold()
+ *            returns not -1 value, or
+ *         2. isUsageThresholdSupported() returns false and getUsageThreshold()
+ *            returns -1 value
+ *     Otherwise, the test fails.
+ *     The test implements access to the metrics via custom MBean server proxy.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.isUsageThresholdSupported.issupported001
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/resetPeakUsage/reset001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2004, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.MemoryPoolMBean.resetPeakUsage;
+
+import java.io.*;
+import java.util.*;
+import nsk.share.*;
+import nsk.monitoring.share.*;
+
+public class reset001 {
+    private static boolean testFailed = false;
+
+    public static void main(String[] argv) {
+        System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
+    }
+
+    public static int run(String[] argv, PrintStream out) {
+        ArgumentHandler argHandler = new ArgumentHandler(argv);
+        Log log = new Log(out, argHandler);
+        MemoryMonitor monitor = Monitor.getMemoryMonitor(log, argHandler);
+        List pools = monitor.getMemoryPoolMBeans();
+
+        for (int i = 0; i < pools.size(); i++) {
+            byte[] b = new byte[10 * 1024]; // Eat 10K
+            Object pool = pools.get(i);
+
+            // No exceptions should be thrown
+            try {
+                monitor.resetPeakUsage(pool);
+            } catch (Throwable t) {
+                if (t instanceof ThreadDeath)
+                    throw (ThreadDeath) t;
+                log.complain("Unexpected exception in pool "
+                           + monitor.getName(pool));
+                t.printStackTrace(log.getOutStream());
+                testFailed = true;
+            }
+        } // for i
+
+        if (testFailed)
+            out.println("TEST FAILED");
+        return (testFailed) ? Consts.TEST_FAILED : Consts.TEST_PASSED;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/resetPeakUsage/reset001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/resetPeakUsage/reset001.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.resetPeakUsage()
+ *     does not throw any exceptions.
+ *     The test implements direct access to the metrics.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.MemoryPoolMBean.resetPeakUsage.reset001
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/resetPeakUsage/reset002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/resetPeakUsage/reset002.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.resetPeakUsage()
+ *     does not throw any exceptions.
+ *     The test implements access to the metrics via default MBean server.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.MemoryPoolMBean.resetPeakUsage.reset001 -testMode=server
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/resetPeakUsage/reset003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/resetPeakUsage/reset003.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.resetPeakUsage()
+ *     does not throw any exceptions.
+ *     The test implements access to the metrics via custom MBean server.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.resetPeakUsage.reset001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/resetPeakUsage/reset004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/resetPeakUsage/reset004.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.resetPeakUsage()
+ *     does not throw any exceptions.
+ *     The test implements access to the metrics via default MBean server proxy.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.MemoryPoolMBean.resetPeakUsage.reset001 -testMode=proxy
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/resetPeakUsage/reset005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/resetPeakUsage/reset005.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.resetPeakUsage()
+ *     does not throw any exceptions.
+ *     The test implements access to the metrics via custom MBean server proxy.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.resetPeakUsage.reset001
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/setCollectionUsageThreshold/setthreshold001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,242 @@
+/*
+ * Copyright (c) 2004, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.MemoryPoolMBean.setCollectionUsageThreshold;
+
+import java.io.*;
+import java.util.*;
+import java.lang.management.*;
+import nsk.share.*;
+import nsk.monitoring.share.*;
+
+public class setthreshold001 {
+    private static class TestParameters {
+        private final long max, validThreshold, invalidThreshold;
+        private final boolean supportsMax;
+
+        public TestParameters(MemoryUsage usg) {
+            max = usg.getMax();
+            supportsMax = (max != -1);
+            validThreshold = supportsMax ? max : 1;
+            invalidThreshold = supportsMax ? max * 2 : Long.MAX_VALUE;
+        }
+    }
+    private static MemoryMonitor monitor;
+    private static boolean testFailed = false;
+
+    public static void main(String[] argv) {
+        System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
+    }
+
+    public static int run(String[] argv, PrintStream out) {
+        ArgumentHandler argHandler = new ArgumentHandler(argv);
+        Log log = new Log(out, argHandler);
+        monitor = Monitor.getMemoryMonitor(log, argHandler);
+        List pools = monitor.getMemoryPoolMBeans();
+
+        for (int i = 0; i < pools.size(); i++) {
+            Object pool = pools.get(i);
+            log.display(i + " pool " + monitor.getName(pool));
+
+            boolean isSupported = monitor.isCollectionThresholdSupported(pool);
+            MemoryUsage usage = monitor.getCollectionUsage(pool);
+            if (usage == null) {
+                log.display("  getCollectionUsage() is not supported: it "
+                          + "returned null");
+                continue;
+            }
+
+            if (isSupported) {
+                // Usage thresholds are supported
+                log.display("  supports collection usage thresholds");
+                testcase1(log, pool);
+                testcase2(log, pool);
+                testcase3(log, pool);
+            } else {
+                log.display("  does not support usage thresholds");
+                testcase4(log, pool);
+
+
+            }
+        } // for i
+
+        if (testFailed)
+            out.println("TEST FAILED");
+        return (testFailed) ? Consts.TEST_FAILED : Consts.TEST_PASSED;
+    }
+
+    private static void testcase4(Log log, Object pool) {
+        // 4. If the usage thresholds are not supported, the method
+        // must throw UnsupportedOperationException
+        TestParameters tp = new TestParameters(monitor.getUsage(pool));
+        try {
+            monitor.setUsageThreshold(pool, tp.validThreshold);
+            log.complain("UnsupportedOperationException is not thrown "
+                       + "in pool " + monitor.getName(pool));
+            testFailed = true;
+        } catch (Exception e) {
+
+            // The exception is expected, since the usage thresholds are
+            // not supported
+            handleUOE(e, log, "Testcase 4.");
+        }
+    }
+
+    private static void testcase3(Log log, Object pool) {
+        // 3. Try to set threshold that is greater than max value
+        //    or somehow invalid
+        TestParameters tp = new TestParameters(monitor.getUsage(pool));
+        if (tp.supportsMax) {
+            try {
+                // setCollectionThreshold() should throw an exception
+                // given that the threshold is invalid
+
+                monitor.setCollectionThreshold(pool, tp.invalidThreshold);
+                log.complain("IllegalArgumentException is not thrown "
+                             + "in pool " + monitor.getName(pool) + " for "
+                             + "threshold " + tp.invalidThreshold + " ("
+                             + monitor.getCollectionUsage(pool) + ")");
+                testFailed = true;
+            } catch (Exception e) {
+                // The exception is expected, since the threshold is invalid
+                handleIAE(e, log, "Testcase 3.");
+            }
+        } else {
+            try {
+                // setCollectionThreshold() should not throw
+                // an exception given that the memory pool
+                // does not support a max, even though the
+                // threshold is invalid
+
+                monitor.setCollectionThreshold(pool, tp.invalidThreshold);
+                log.display("  threshold " + tp.invalidThreshold + " is set");
+                long used = monitor.getCollectionUsage(pool).getUsed();
+                monitor.setCollectionThreshold(pool, used);
+                log.display("  threshold " + used + " is set");
+                long threshold = monitor.getCollectionThreshold(pool);
+                if (threshold != used) {
+                    log.complain("Threshold value is " + threshold + ", "
+                                 + "but " + used + " was set in pool "
+                                 + monitor.getName(pool));
+                    testFailed = true;
+                } else
+                    log.display("  threshold " + threshold + " is read");
+            } catch (Exception e) {
+                log.complain("Unexpected " + e + " in pool "
+                             + monitor.getName(pool));
+                e.printStackTrace(log.getOutStream());
+                testFailed = true;
+            }
+        }
+    }
+
+    private static void testcase2(Log log, Object pool) {
+        // 2. Try to set negative threshold
+        try {
+            monitor.setCollectionThreshold(pool, -1);
+            log.complain("IllegalArgumentException is not thrown "
+                       + "in pool " + monitor.getName(pool) + " for "
+                       + "negative threshold");
+            testFailed = true;
+        } catch (Exception e) {
+
+            // The IllegalArgumentException  is expected, since the
+            // threshold is negative
+            handleIAE(e, log, "Testcase 2.");
+        }
+    }
+
+    private static void testcase1(Log log, Object pool) {
+        // 1. Try to set two different values of thresholds
+        try {
+            TestParameters tp = new TestParameters(monitor.getUsage(pool));
+
+            monitor.setCollectionThreshold(pool, tp.validThreshold);
+            log.display("  threshold " + tp.validThreshold + " is set");
+            long used = monitor.getCollectionUsage(pool).getUsed();
+            monitor.setCollectionThreshold(pool, used);
+            log.display("  threshold " + used + " is set");
+            long threshold = monitor.getCollectionThreshold(pool);
+            if (threshold != used) {
+                log.complain("Threshold value is " + threshold + ", "
+                           + "but " + used + " was set in pool "
+                           + monitor.getName(pool));
+                testFailed = true;
+            } else
+                log.display("  threshold " + threshold + " is read");
+        } catch (Exception e) {
+            log.complain("Unexpected " + e + " in pool "
+                       + monitor.getName(pool));
+            e.printStackTrace(log.getOutStream());
+            testFailed = true;
+        }
+    }
+
+    // Handle UnsupportedOperationException
+    private static void handleUOE(Throwable e, Log log, String testcase) {
+        Throwable tmp = unwrap(e);
+
+        if (tmp instanceof UnsupportedOperationException) {
+            log.display("  " + testcase + " UnsupportedOperationException is "
+                      + "thrown");
+        } else {
+            log.complain("  " + testcase + " Incorrect execption " + tmp + " is "
+                       + "thrown, UnsupportedOperationException is expected");
+            tmp.printStackTrace(log.getOutStream());
+            testFailed = true;
+        }
+    }
+
+    // Handle IllegalArgumentException
+    private static void handleIAE(Throwable e, Log log, String testcase) {
+        Throwable tmp = unwrap(e);
+
+        if (tmp instanceof IllegalArgumentException) {
+            log.display("  " + testcase + " IllegalArgumentException is "
+                      + "thrown");
+        } else {
+            log.complain("  " + testcase + " Incorrect execption " + tmp + " is "
+                       + "thrown, IllegalArgumentException is expected");
+            tmp.printStackTrace(log.getOutStream());
+            testFailed = true;
+        }
+    }
+
+    static Throwable unwrap(Throwable throwable) {
+
+        Throwable unwrapped, t = throwable;
+
+        do {
+            unwrapped = t;
+
+            if (unwrapped instanceof UnsupportedOperationException) {
+                break;
+            }
+
+            t = unwrapped.getCause();
+
+        } while (t != null);
+
+        return unwrapped;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/setCollectionUsageThreshold/setthreshold001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/setCollectionUsageThreshold/setthreshold001.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.setCollectionUsageThreshold()
+ *     sets values correctly.
+ *     If collection usage thresholds are supported in the pool, the test
+ *         1. sets two different values and expects that
+ *            getCollectionUsageThreshold() returns the latest one;
+ *         2. sets negative threshold and expects IllegalArgumentException;
+ *         3. sets threshold that has value greater than max value and expects
+ *            IllegalArgumentException.
+ *     If collection usage thresholds are not supported, the test sets a
+ *     threshold and expects UnsupportedOperationException.
+ *     The test implements direct access to the metrics.
+ * COMMENT
+ *     Fixed the bug:
+ *     5035038 Chain of JMX exceptions impact on monitoring tests
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.MemoryPoolMBean.setCollectionUsageThreshold.setthreshold001
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/setCollectionUsageThreshold/setthreshold002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/setCollectionUsageThreshold/setthreshold002.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.setCollectionUsageThreshold()
+ *     sets values correctly.
+ *     If collection usage thresholds are supported in the pool, the test
+ *         1. sets two different values and expects that
+ *            getCollectionUsageThreshold() returns the latest one;
+ *         2. sets negative threshold and expects IllegalArgumentException;
+ *         3. sets threshold that has value greater than max value and expects
+ *            IllegalArgumentException.
+ *     If collection usage thresholds are not supported, the test sets a
+ *     threshold and expects UnsupportedOperationException.
+ *     The test implements access to the metrics via default MBean server.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.setCollectionUsageThreshold.setthreshold001
+ *      -testMode=server
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/setCollectionUsageThreshold/setthreshold003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/setCollectionUsageThreshold/setthreshold003.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.setCollectionUsageThreshold()
+ *     sets values correctly.
+ *     If collection usage thresholds are supported in the pool, the test
+ *         1. sets two different values and expects that
+ *            getCollectionUsageThreshold() returns the latest one;
+ *         2. sets negative threshold and expects IllegalArgumentException;
+ *         3. sets threshold that has value greater than max value and expects
+ *            IllegalArgumentException.
+ *     If collection usage thresholds are not supported, the test sets a
+ *     threshold and expects UnsupportedOperationException.
+ *     The test implements access to the metrics via custom MBean server.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.setCollectionUsageThreshold.setthreshold001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/setCollectionUsageThreshold/setthreshold004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/setCollectionUsageThreshold/setthreshold004.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.setCollectionUsageThreshold()
+ *     sets values correctly.
+ *     If collection usage thresholds are supported in the pool, the test
+ *         1. sets two different values and expects that
+ *            getCollectionUsageThreshold() returns the latest one;
+ *         2. sets negative threshold and expects IllegalArgumentException;
+ *         3. sets threshold that has value greater than max value and expects
+ *            IllegalArgumentException.
+ *     If collection usage thresholds are not supported, the test sets a
+ *     threshold and expects UnsupportedOperationException.
+ *     The test implements access to the metrics via default MBean server proxy.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.setCollectionUsageThreshold.setthreshold001
+ *      -testMode=proxy
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/setCollectionUsageThreshold/setthreshold005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/setCollectionUsageThreshold/setthreshold005.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.setCollectionUsageThreshold()
+ *     sets values correctly.
+ *     If collection usage thresholds are supported in the pool, the test
+ *         1. sets two different values and expects that
+ *            getCollectionUsageThreshold() returns the latest one;
+ *         2. sets negative threshold and expects IllegalArgumentException;
+ *         3. sets threshold that has value greater than max value and expects
+ *            IllegalArgumentException.
+ *     If collection usage thresholds are not supported, the test sets a
+ *     threshold and expects UnsupportedOperationException.
+ *     The test implements access to the metrics via custom MBean server proxy.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.setCollectionUsageThreshold.setthreshold001
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/setUsageThreshold/setthreshold001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,208 @@
+/*
+ * Copyright (c) 2004, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.MemoryPoolMBean.setUsageThreshold;
+
+import java.io.*;
+import java.util.*;
+import nsk.share.*;
+import nsk.monitoring.share.*;
+
+public class setthreshold001 {
+    private static MemoryMonitor monitor;
+    private static boolean testFailed = false;
+
+    public static void main(String[] argv) {
+        System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
+    }
+
+    public static int run(String[] argv, PrintStream out) {
+        ArgumentHandler argHandler = new ArgumentHandler(argv);
+        Log log = new Log(out, argHandler);
+        monitor = Monitor.getMemoryMonitor(log, argHandler);
+        List pools = monitor.getMemoryPoolMBeans();
+
+        for (int i = 0; i < pools.size(); i++) {
+            Object pool = pools.get(i);
+            log.display(i + " pool " + monitor.getName(pool));
+
+            boolean isSupported = monitor.isUsageThresholdSupported(pool);
+            long max = monitor.getUsage(pool).getMax();
+            boolean supportsMax = true;
+            long validThreshold = 0;
+            long invalidThreshold = 0;
+            if (max == -1) {
+                // max is undefined for this pool.
+                supportsMax = false;
+                validThreshold = 1;
+                invalidThreshold = Long.MAX_VALUE;
+            } else {
+                supportsMax = true;
+                validThreshold = max;
+                invalidThreshold = max + 1;
+            }
+
+            if (isSupported) {
+
+                // Usage thresholds are supported
+                log.display("  supports usage thresholds");
+
+                // 1. Try to set two different values of thresholds
+                monitor.setUsageThreshold(pool, validThreshold);
+                log.display("  threshold " + validThreshold + " is set");
+                long used = monitor.getUsage(pool).getUsed();
+                monitor.setUsageThreshold(pool, used);
+                log.display("  threshold " + used + " is set");
+
+                long threshold = monitor.getUsageThreshold(pool);
+                if (threshold != used) {
+                    log.complain("Threshold value is " + threshold + ", but "
+                               + used + " was set in pool "
+                               + monitor.getName(pool));
+                    testFailed = true;
+                } else
+                    log.display("  threshold " + threshold + " is read");
+
+                // 2. Try to set negative threshold
+                try {
+                    monitor.setUsageThreshold(pool, -1);
+                    log.complain("IllegalArgumentException is not thrown "
+                               + "in pool " + monitor.getName(pool) + " for "
+                               + "negative threshold");
+                    testFailed = true;
+                } catch (Exception e) {
+
+                    // The IllegalArgumentException  is expected, since the
+                    // threshold is negative
+                    handleIAE(e, log, "Testcase 2.");
+                }
+
+                // 3. Try to set threshold that is invalid
+                if (supportsMax) {
+                    try {
+                        // setUsageThreshold() should throw an exception
+                        // given that the threshold is invalid
+                        monitor.setUsageThreshold(pool, invalidThreshold);
+                        log.complain("IllegalArgumentException is not thrown "
+                                     + "in pool " + monitor.getName(pool) + " for "
+                                     + " threshold " + invalidThreshold + " ("
+                                     + monitor.getUsage(pool) + ")");
+                        testFailed = true;
+                    } catch (Exception e) {
+
+                        // The exception is expected, since the threshold is invalid
+                        handleIAE(e, log, "Testcase 3.");
+                    }
+                } else {
+                    // setUsageThreshold() should not throw an
+                    // exception given that the memory pool does not
+                    // support a max, even though the threshold is invalid
+
+                    monitor.setUsageThreshold(pool, invalidThreshold);
+                    log.display("  threshold " + invalidThreshold + " is set");
+                    long used2 = monitor.getUsage(pool).getUsed();
+                    monitor.setUsageThreshold(pool, used2);
+                    log.display("  threshold " + used2 + " is set");
+
+                    long threshold2 = monitor.getUsageThreshold(pool);
+                    if (threshold2 != used2) {
+                        log.complain("Threshold value is " + threshold2 + ", but "
+                                     + used2 + " was set in pool "
+                                     + monitor.getName(pool));
+                        testFailed = true;
+                    } else
+                        log.display("  threshold " + threshold2 + " is read");
+                }
+            } else {
+
+                // 4. If the usage thresholds are not supported, the method
+                // must throw UnsupportedOperationException
+                log.display("  does not support usage thresholds");
+
+                try {
+                    monitor.setUsageThreshold(pool, max);
+                    log.complain("UnsupportedOperationException is not thrown "
+                               + "in pool " + monitor.getName(pool));
+                    testFailed = true;
+                } catch (Exception e) {
+
+                    // The exception is expected, since the usage thresholds are
+                    // not supported
+                    handleUOE(e, log, "Testcase 4.");
+                }
+            }
+        } // for i
+
+        if (testFailed)
+            out.println("TEST FAILED");
+        return (testFailed) ? Consts.TEST_FAILED : Consts.TEST_PASSED;
+    }
+
+    // Handle UnsupportedOperationException
+    private static void handleUOE(Throwable e, Log log, String testcase) {
+        Throwable tmp = unwrap(e);
+
+        if (tmp instanceof UnsupportedOperationException) {
+            log.display("  " + testcase + " UnsupportedOperationException is "
+                      + "thrown");
+        } else {
+            log.complain("  " + testcase + " Incorrect execption " + tmp + " is "
+                       + "thrown, UnsupportedOperationException is expected");
+            tmp.printStackTrace(log.getOutStream());
+            testFailed = true;
+        }
+    }
+
+    // Handle IllegalArgumentException
+    private static void handleIAE(Throwable e, Log log, String testcase) {
+        Throwable tmp = unwrap(e);
+
+        if (tmp instanceof IllegalArgumentException) {
+            log.display("  " + testcase + " IllegalArgumentException is "
+                      + "thrown");
+        } else {
+            log.complain("  " + testcase + " Incorrect execption " + tmp + " is "
+                       + "thrown, IllegalArgumentException is expected");
+            tmp.printStackTrace(log.getOutStream());
+            testFailed = true;
+        }
+    }
+
+    static Throwable unwrap(Throwable throwable) {
+
+        Throwable unwrapped, t = throwable;
+
+        do {
+            unwrapped = t;
+
+            if (unwrapped instanceof UnsupportedOperationException) {
+                break;
+            }
+
+            t = unwrapped.getCause();
+
+        } while (t != null);
+
+        return unwrapped;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/setUsageThreshold/setthreshold001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/setUsageThreshold/setthreshold001.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.setUsageThreshold()
+ *     sets values correctly.
+ *     If the usage thresholds are supported in the pool, the test
+ *         1. sets two different values and expects that getUsageThreshold()
+ *            returns the latest one;
+ *         2. sets negative threshold and expects IllegalArgumentException;
+ *         3. sets threshold that has value greater than max value and expects
+ *            IllegalArgumentException.
+ *     If the usage thresholds are not supported, the test sets a threshold and
+ *     expects UnsupportedOperationException.
+ *     The test implements direct access to the metrics.
+ * COMMENT
+ *     Fixed the bug:
+ *     5035038 Chain of JMX exceptions impact on monitoring tests
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.MemoryPoolMBean.setUsageThreshold.setthreshold001
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/setUsageThreshold/setthreshold002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/setUsageThreshold/setthreshold002.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.setUsageThreshold()
+ *     sets values correctly.
+ *     If the usage thresholds are supported in the pool, the test
+ *         1. sets two different values and expects that getUsageThreshold()
+ *            returns the latest one;
+ *         2. sets negative threshold and expects IllegalArgumentException;
+ *         3. sets threshold that has value greater than max value and expects
+ *            IllegalArgumentException.
+ *     If the usage thresholds are not supported, the test sets a threshold and
+ *     expects UnsupportedOperationException.
+ *     The test implements access to the metrics via default MBean server.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.setUsageThreshold.setthreshold001
+ *      -testMode=server
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/setUsageThreshold/setthreshold003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/setUsageThreshold/setthreshold003.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.setUsageThreshold()
+ *     sets values correctly.
+ *     If the usage thresholds are supported in the pool, the test
+ *         1. sets two different values and expects that getUsageThreshold()
+ *            returns the latest one;
+ *         2. sets negative threshold and expects IllegalArgumentException;
+ *         3. sets threshold that has value greater than max value and expects
+ *            IllegalArgumentException.
+ *     If the usage thresholds are not supported, the test sets a threshold and
+ *     expects UnsupportedOperationException.
+ *     The test implements access to the metrics via custom MBean server.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.setUsageThreshold.setthreshold001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/setUsageThreshold/setthreshold004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/setUsageThreshold/setthreshold004.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.setUsageThreshold()
+ *     sets values correctly.
+ *     If the usage thresholds are supported in the pool, the test
+ *         1. sets two different values and expects that getUsageThreshold()
+ *            returns the latest one;
+ *         2. sets negative threshold and expects IllegalArgumentException;
+ *         3. sets threshold that has value greater than max value and expects
+ *            IllegalArgumentException.
+ *     If the usage thresholds are not supported, the test sets a threshold and
+ *     expects UnsupportedOperationException.
+ *     The test implements access to the metrics via default MBean server proxy.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.setUsageThreshold.setthreshold001
+ *      -testMode=proxy
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/setUsageThreshold/setthreshold005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryPoolMBean/setUsageThreshold/setthreshold005.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryPoolMBean.setUsageThreshold()
+ *     sets values correctly.
+ *     If the usage thresholds are supported in the pool, the test
+ *         1. sets two different values and expects that getUsageThreshold()
+ *            returns the latest one;
+ *         2. sets negative threshold and expects IllegalArgumentException;
+ *         3. sets threshold that has value greater than max value and expects
+ *            IllegalArgumentException.
+ *     If the usage thresholds are not supported, the test sets a threshold and
+ *     expects UnsupportedOperationException.
+ *     The test implements access to the metrics via custom MBean server proxy.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.MemoryPoolMBean.setUsageThreshold.setthreshold001
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryUsage/MemoryUsage/memoryusage001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,174 @@
+/*
+ * Copyright (c) 2004, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.MemoryUsage.MemoryUsage;
+
+import java.lang.management.*;
+import java.io.*;
+import nsk.share.*;
+
+public class memoryusage001 {
+    private static boolean testFailed = false;
+
+    public static void main(String[] argv) {
+        System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
+    }
+
+    public static int run(String[] argv, PrintStream out) {
+
+        // Check all conditions for IllegalArgumentException
+
+        // 1.1. init is negative, but not -1
+        try {
+            new MemoryUsage(-2, 2, 3, 4);
+            out.println("Failure 1.1.");
+            out.println("new MemoryUsage(-2, 2, 3, 4) does not throw "
+                      + "IllegalArgumentException. init is negative, but not "
+                      + "-1.");
+            testFailed = true;
+        } catch (IllegalArgumentException e) {
+        }
+
+        // 1.2. max is negative, but not -1
+        try {
+            new MemoryUsage(1, 2, 3, -4);
+            out.println("Failure 1.2.");
+            out.println("new MemoryUsage(1, 2, 3, -4) does not throw "
+                      + "IllegalArgumentException. max is negative, but not "
+                      + "-1.");
+            testFailed = true;
+        } catch (IllegalArgumentException e) {
+        }
+
+        // 1.3. used is negative
+        try {
+            new MemoryUsage(1, -1, 3, 4);
+            out.println("Failure 1.3.");
+            out.println("new MemoryUsage(1, -1, 3, 4) does not throw "
+                      + "IllegalArgumentException. used is negative.");
+            testFailed = true;
+        } catch (IllegalArgumentException e) {
+        }
+
+        // 1.4. committed is negative
+        try {
+            new MemoryUsage(1, 2, -1, 4);
+            out.println("Failure 1.4.");
+            out.println("new MemoryUsage(1, 2, -1, 4) does not throw "
+                      + "IllegalArgumentException. committed is negative.");
+            testFailed = true;
+        } catch (IllegalArgumentException e) {
+        }
+
+        // 1.5. used is greater than committed
+        try {
+            new MemoryUsage(1, 2, 1, 4);
+            out.println("Failure 1.5.");
+            out.println("new MemoryUsage(1, 2, 1, 4) does not throw "
+                      + "IllegalArgumentException. used is greater than "
+                      + "committed.");
+            testFailed = true;
+        } catch (IllegalArgumentException e) {
+        }
+
+        // 1.6. used is greater than max, while max is not -1
+        try {
+            new MemoryUsage(1, 5, 6, 4);
+            out.println("Failure 1.6.");
+            out.println("new MemoryUsage(1, 5, 6, 4) does not throw "
+                      + "IllegalArgumentException. used is greater than max, "
+                      + "while max is not -1.");
+            testFailed = true;
+        } catch (IllegalArgumentException e) {
+        }
+
+        // Check different correct sets of values for MemoryUsage
+
+        // 2.1. init is -1
+        try {
+            new MemoryUsage(-1, 2, 3, 4);
+        } catch (IllegalArgumentException e) {
+            out.println("Failure 2.1.");
+            out.println("new MemoryUsage(-1, 2, 3, 4) throws " + e + ". init is"
+                      + " -1.");
+            testFailed = true;
+        }
+
+        // 2.2. max is -1
+        try {
+            new MemoryUsage(1, 2, 3, -1);
+        } catch (IllegalArgumentException e) {
+            out.println("Failure 2.2.");
+            out.println("new MemoryUsage(1, 2, 3, -1) throws " + e + ". max is "
+                      + "-1.");
+            testFailed = true;
+        }
+
+        // 2.3. used is equal to max
+        try {
+            new MemoryUsage(1, 2, 3, 2);
+
+            out.println("Failure 2.3.");
+            out.println("new MemoryUsage(1, 2, 3, 2) does not throw IllegalArgumentException. "
+                      + "used is equal to max.");
+            testFailed = true;
+        } catch (IllegalArgumentException e) {
+            // expected exception
+        }
+
+        // 2.4. used is less than max
+        try {
+            new MemoryUsage(1, 2, 3, 4);
+        } catch (IllegalArgumentException e) {
+            out.println("Failure 2.4.");
+            out.println("new MemoryUsage(1, 2, 3, 4) throws " + e + ". used is "
+                      + "less than max.");
+            testFailed = true;
+        }
+
+        // 2.5. committed is less than init
+        try {
+            new MemoryUsage(4, 2, 3, -1);
+        } catch (IllegalArgumentException e) {
+            out.println("Failure 2.5.");
+            out.println("new MemoryUsage(4, 2, 3, -1) throws " + e + ". "
+                      + "committed is less than init.");
+            testFailed = true;
+        }
+
+        // 2.6. max is less than committed
+        try {
+            new MemoryUsage(1, 2, 4, 3);
+            out.println("Failure 2.6.");
+            out.println("new MemoryUsage(1, 2, 4, 3) does not throw IllegalArgumentException. "
+                      + "max is less than committed.");
+            testFailed = true;
+        } catch (IllegalArgumentException e) {
+            // expected exception
+        }
+
+        if (testFailed)
+            out.println("TEST FAILED");
+        return (testFailed) ? Consts.TEST_FAILED : Consts.TEST_PASSED;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryUsage/MemoryUsage/memoryusage001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryUsage/MemoryUsage/memoryusage001.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryUsage(long init, long used, long committed, long max)
+ *     correctly throws IllegalArgumentException, if:
+ *         1. init is negative, but not -1
+ *         2. max is negative, but not -1
+ *         3. used is negative
+ *         4. committed is negative
+ *         5. used is greater than committed
+ *         6. used is greater than max, while max is not -1
+ *     The method also checks that the constructor does not throw
+ *     IllegalArgumentException, if:
+ *         1. init is -1
+ *         2. max is -1
+ *         3. used is equal to max
+ *         4. used is less than max
+ *         5. committed is less than init
+ *         6. max is less than committed
+ * COMMENT
+ *     Fixed the bug:
+ *     5050603 memoryusage001 needs to be updated for MemoryUsage
+ *             spec change.
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.MemoryUsage.MemoryUsage.memoryusage001
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryUsage/from/from001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2004, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.MemoryUsage.from;
+
+import java.lang.management.*;
+import javax.management.*;
+import javax.management.openmbean.*;
+import java.io.*;
+import nsk.share.*;
+import nsk.monitoring.share.*;
+
+public class from001 {
+
+    private static boolean testFailed = false;
+
+    public static void main(String[] argv) {
+        System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
+    }
+
+    public static int run(String[] argv, PrintStream out) {
+
+        ArgumentHandler argHandler = new ArgumentHandler(argv);
+        Log log = new Log(out, argHandler);
+
+        // 1. Check null CompositeData - null must be returned
+        MemoryUsage result = MemoryUsage.from(null);
+
+        if (result != null) {
+            log.complain("FAILURE 1.");
+            log.complain("MemoryUsage.from(null) returned " + result
+                      + ", expected: null.");
+            testFailed = true;
+        }
+
+        // 2. Check CompositeData that doest not represnt
+        // MemoryUsage - IllegalArgumentException must be thrown
+        Monitor.getThreadMonitor(log, argHandler);
+
+        Thread thread = Thread.currentThread();
+        long id = thread.getId();
+
+        Object[] params = {new Long(id), new Integer(Integer.MAX_VALUE)};
+        String[] signature = {"long", "int"};
+
+        ObjectName mbeanObjectName = null;
+        CompositeData cdata = null;
+        try {
+            mbeanObjectName = new ObjectName(ManagementFactory.THREAD_MXBEAN_NAME);
+            cdata = (CompositeData) Monitor.getMBeanServer().invoke(
+                                                mbeanObjectName,
+                                                "getThreadInfo", params, signature);
+        } catch (Exception e) {
+            log.complain("Unexpected exception " + e);
+            e.printStackTrace(log.getOutStream());
+            testFailed = true;
+        }
+
+        try {
+            result = MemoryUsage.from(cdata);
+            log.complain("FAILURE 2.");
+            log.complain("MemoryUsage.from(CompositeData) returned " + result
+                      + ", expected: IllegalArgumentException.");
+            testFailed = true;
+        } catch (IllegalArgumentException e) {
+
+            // Expected: CompositeData doest not represnt MemoryUsage
+        }
+
+        // 3. Check correct CompositeData
+        CompositeData correctCD = null;
+        try {
+            mbeanObjectName = new ObjectName(ManagementFactory.MEMORY_MXBEAN_NAME);
+            correctCD = (CompositeData) Monitor.getMBeanServer().getAttribute(
+                                                mbeanObjectName,
+                                                "HeapMemoryUsage");
+        } catch (Exception e) {
+            log.complain("Unexpected exception " + e);
+            e.printStackTrace(log.getOutStream());
+            testFailed = true;
+        }
+
+        result = MemoryUsage.from(correctCD);
+        long init = result.getInit();
+        long used = result.getUsed();
+        long comm = result.getCommitted();
+        long max = result.getMax();
+
+        if (testFailed)
+            log.complain("TEST FAILED");
+        return (testFailed) ? Consts.TEST_FAILED : Consts.TEST_PASSED;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryUsage/from/from001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/MemoryUsage/from/from001.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         MemoryUsage.from(CompositeData)
+ *     returns correct results:
+ *     1. null, if CompositeData is null;
+ *     2. trows IllegalArgumentException, if CompositeData doest not represnt
+ *        MemoryNotificationInfo;
+ *     3. correct MemoryUsage object, if CompositeData is correct (i.e all
+ *        attributes of the CompositeData must have correct values: init, used,
+ *        committed, max).
+ * COMMENT
+ *     Updated according to:
+ *     5014783 Move ThreadState class from java.lang.management to java.lang
+ *     5024531 Fix MBeans design flaw that restricts to use JMX CompositeData
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.MemoryUsage.from.from001 -testMode=server
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/RuntimeMXBean/RuntimeMXBean001/RuntimeMXBean001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/RuntimeMXBean/RuntimeMXBean001.
+ * VM Testbase keywords: [quick, monitoring]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.RuntimeMXBean.RuntimeMXBean001.RuntimeMXBean001
+ *      -testMode=directly
+ */
+
+package nsk.monitoring.RuntimeMXBean.RuntimeMXBean001;
+
+import nsk.share.*;
+import nsk.share.test.*;
+import nsk.monitoring.share.*;
+import java.lang.management.*;
+
+/**
+ * Test functions of RuntimeMXBean.
+ *
+ *
+ * Checks that values returned by getStartTime() and getUptime()
+ * measure actual uptime well enough, i.e.
+ *  - start time does not change with time
+ *  - start time + uptime is approximately current time
+ */
+public class RuntimeMXBean001 extends MonitoringTestBase implements Initializable {
+        private static final long NANO_MS = 1000000;
+
+        private RuntimeMXBean runtime;
+        private int iterations = 10;
+        private long maxDiff = 5000;
+        private int fail_count = 0;
+
+        public void initialize() {
+                runtime = monitoringFactory.getRuntimeMXBean();
+        }
+
+        private static final long getMillis() {
+            return System.nanoTime() / NANO_MS;
+        }
+
+        private void checkTimes(long startTime, long upTime, String msg) {
+                if (startTime <= 0)
+                        throw new TestFailure("Invalid start time: " + startTime);
+                if (upTime <= 0)
+                        throw new TestFailure("Invalid uptime: " + upTime);
+        }
+
+        private void testUptimeOne(long sleepTime) {
+                long startTime1 = runtime.getStartTime();
+                long uptime1 = runtime.getUptime();
+                long time1 = getMillis();
+                log.info("startTime: " + startTime1 + ", uptime1: " + uptime1 + ", time1: " + time1);
+                checkTimes(startTime1, uptime1, "Before sleep");
+                try {
+                        Thread.sleep(sleepTime);
+                } catch (InterruptedException e) {
+                        throw new TestFailure("Sleep was interrupted", e);
+                }
+                long startTime2 = runtime.getStartTime();
+                long uptime2 = runtime.getUptime();
+                long time2 = getMillis();
+                checkTimes(startTime2, uptime2, "After sleep");
+
+                if (startTime1 != startTime2)
+                        throw new TestFailure("Start time before sleep: " + startTime1 + " start time after sleep: " + startTime2);
+                if (uptime2 < uptime1)
+                        throw new TestFailure("Uptime before sleep: " + uptime1 + " uptime after sleep: " + uptime2);
+
+                long utDiff = (uptime2 - uptime1);
+                long tDiff = (time2 - time1);
+                long flowDiff = Math.abs(utDiff -tDiff);
+                if (flowDiff > maxDiff) {
+                        throw new TestFailure("Difference between timeflow of uptime and current time is too big: " + flowDiff + ", expecting at most " + maxDiff);
+                }
+        }
+
+        private void testUptime() {
+                for (int i = 0; i < iterations; ++i) {
+                        log.info("Iteration: " + i);
+                        testUptimeOne(LocalRandom.randomPauseTime());
+                }
+        }
+
+        public void run() {
+                testUptime();
+        }
+
+        public static void main(String[] args) {
+                Monitoring.runTest(new RuntimeMXBean001(), args);
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/RuntimeMXBean/RuntimeMXBean002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/RuntimeMXBean/RuntimeMXBean002.
+ * VM Testbase keywords: [quick, monitoring]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.RuntimeMXBean.RuntimeMXBean001.RuntimeMXBean001
+ *      -testMode=server
+ *      -MBeanServer=default
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/RuntimeMXBean/RuntimeMXBean003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/RuntimeMXBean/RuntimeMXBean003.
+ * VM Testbase keywords: [quick, monitoring]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.RuntimeMXBean.RuntimeMXBean001.RuntimeMXBean001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/RuntimeMXBean/RuntimeMXBean004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/RuntimeMXBean/RuntimeMXBean004.
+ * VM Testbase keywords: [quick, monitoring]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.RuntimeMXBean.RuntimeMXBean001.RuntimeMXBean001
+ *      -testMode=proxy
+ *      -MBeanServer=default
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/RuntimeMXBean/RuntimeMXBean005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/RuntimeMXBean/RuntimeMXBean005.
+ * VM Testbase keywords: [quick, monitoring]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.RuntimeMXBean.RuntimeMXBean001.RuntimeMXBean001
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/RuntimeMXBean/RuntimeMXBean006/RuntimeMXBean006.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2012, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/RuntimeMXBean/RuntimeMXBean006.
+ * VM Testbase keywords: [quick, monitoring, feature_jrockit_mxbeans_7u4]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         RuntimeMXBean.getName()
+ *     returns a name on the form <pid><at><hostname>.
+ *     The test accesses RuntimeMXBean directly.
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.RuntimeMXBean.RuntimeMXBean006.RuntimeMXBean006
+ *      -testMode=directly
+ */
+
+package nsk.monitoring.RuntimeMXBean.RuntimeMXBean006;
+
+import java.lang.management.RuntimeMXBean;
+import java.util.regex.Pattern;
+
+import nsk.monitoring.share.Monitoring;
+import nsk.monitoring.share.MonitoringTestBase;
+import nsk.share.test.Initializable;
+
+public class RuntimeMXBean006 extends MonitoringTestBase implements Initializable {
+    private RuntimeMXBean runtime;
+    private Pattern namePattern;
+
+    public void initialize() {
+        runtime = monitoringFactory.getRuntimeMXBean();
+        /* Name should be on the format <pid>@<hostname>. */
+        namePattern = Pattern.compile("^[0-9]+@(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\\-]*[A-Za-z0-9])$");
+    }
+
+    private void testGetName() {
+        String name = runtime.getName();
+        log.debug(String.format("RuntimeMXBean.getName() returned \"%s\".", name));
+
+        if (namePattern.matcher(name).matches()) {
+            setFailed(false);
+        } else {
+            log.info(String.format("Test failure: name did not match format <pid>@<hostname>: \"%s\"", name));
+        }
+    }
+
+    public void run() {
+        setFailed(true);
+        testGetName();
+    }
+
+    public static void main(String[] args) {
+        Monitoring.runTest(new RuntimeMXBean006(), args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/RuntimeMXBean/RuntimeMXBean007/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/RuntimeMXBean/RuntimeMXBean007.
+ * VM Testbase keywords: [quick, monitoring, feature_jrockit_mxbeans_7u4]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         RuntimeMXBean.getName()
+ *     returns a name on the form <pid><at><hostname>.
+ *     The test accesses RuntimeMXBean via default MBean server.
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.RuntimeMXBean.RuntimeMXBean006.RuntimeMXBean006
+ *      -testMode=server
+ *      -MBeanServer=default
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/RuntimeMXBean/RuntimeMXBean008/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/RuntimeMXBean/RuntimeMXBean008.
+ * VM Testbase keywords: [quick, monitoring, feature_jrockit_mxbeans_7u4]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         RuntimeMXBean.getName()
+ *     returns a name on the form <pid><at><hostname>.
+ *     The test accesses RuntimeMXBean via custom MBean server.
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.RuntimeMXBean.RuntimeMXBean006.RuntimeMXBean006
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/RuntimeMXBean/RuntimeMXBean009/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/RuntimeMXBean/RuntimeMXBean009.
+ * VM Testbase keywords: [quick, monitoring, feature_jrockit_mxbeans_7u4]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         RuntimeMXBean.getName()
+ *     returns a name on the form <pid><at><hostname>.
+ *     The test accesses RuntimeMXBean via default MBean server proxy.
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.RuntimeMXBean.RuntimeMXBean006.RuntimeMXBean006
+ *      -testMode=proxy
+ *      -MBeanServer=default
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/RuntimeMXBean/RuntimeMXBean010/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/RuntimeMXBean/RuntimeMXBean010.
+ * VM Testbase keywords: [quick, monitoring, feature_jrockit_mxbeans_7u4]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         RuntimeMXBean.getName()
+ *     returns a name on the form <pid><at><hostname>.
+ *     The test accesses RuntimeMXBean via custom MBean server proxy.
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.RuntimeMXBean.RuntimeMXBean006.RuntimeMXBean006
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadInfo/from_c/from_c001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2004, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.ThreadInfo.from_c;
+
+import java.lang.management.*;
+import javax.management.*;
+import javax.management.openmbean.*;
+import java.io.*;
+import nsk.share.*;
+import nsk.monitoring.share.*;
+
+public class from_c001 {
+
+    private static boolean testFailed = false;
+
+    public static void main(String[] argv) {
+        System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
+    }
+
+    public static int run(String[] argv, PrintStream out) {
+
+        ArgumentHandler argHandler = new ArgumentHandler(argv);
+        Log log = new Log(out, argHandler);
+
+        ThreadInfo result = null;
+
+        // 1. Check null CompositeData - null must be returned
+        result = ThreadInfo.from((CompositeData) null);
+
+        if (result != null) {
+            log.complain("FAILURE 1.");
+            log.complain("ThreadInfo.from(null) returned " + result
+                      + ", expected: null.");
+            testFailed = true;
+        }
+
+        MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
+
+        ObjectName mbeanObjectName;
+        CompositeData cdata = null;
+
+        // 2. Check CompositeData that does not represent
+        // ThreadInfo - IllegalArgumentException must be thrown
+
+        try {
+            mbeanObjectName = new ObjectName(ManagementFactory.MEMORY_MXBEAN_NAME);
+            cdata = (CompositeData )mbeanServer.getAttribute(mbeanObjectName,
+                                                                    "HeapMemoryUsage");
+        } catch (Exception e) {
+            log.complain("Unexpected exception " + e);
+            e.printStackTrace(log.getOutStream());
+            testFailed = true;
+        }
+
+        try {
+            result = ThreadInfo.from(cdata);
+            log.complain("FAILURE 2.");
+            log.complain("ThreadInfo.from(CompositeData) returned " + result
+                      + ", expected: IllegalArgumentException.");
+            testFailed = true;
+        } catch (IllegalArgumentException e) {
+
+            // Expected: CompositeData doest not represnt ThreadInfo
+        }
+
+
+        Thread thread = Thread.currentThread();
+        long id = thread.getId();
+
+        Object[] params = {new Long(id), new Integer(Integer.MAX_VALUE)};
+        String[] signature = {"long", "int"};
+
+        cdata = null;
+        try {
+            mbeanObjectName = new ObjectName(ManagementFactory.THREAD_MXBEAN_NAME);
+            cdata = (CompositeData )mbeanServer.invoke(
+                                                mbeanObjectName,
+                                                "getThreadInfo", params, signature);
+        } catch (Exception e) {
+            log.complain("Unexpected exception " + e);
+            e.printStackTrace(log.getOutStream());
+            testFailed = true;
+        }
+
+        try {
+            result = ThreadInfo.from(cdata);
+        } catch (Exception e) {
+            log.complain("FAILURE 3.");
+            log.complain("Unexpected " + e);
+            e.printStackTrace(log.getOutStream());
+            testFailed = true;
+        }
+
+        long threadId = result.getThreadId();
+        Thread.State state = result.getThreadState();
+        boolean isInNative = result.isInNative();
+        boolean isSuspended = result.isSuspended();
+
+        // Thread ID, state, isInNative, isSuspended values must be correct
+        if (id != threadId) {
+            log.complain("FAILURE 3.1.");
+            log.complain("Wrong id value: " + threadId + ", expected: " + id);
+            testFailed = true;
+        }
+
+        if (state != Thread.State.RUNNABLE) {
+            log.complain("FAILURE 3.2.");
+            log.complain("Wrong id value: \"" + state + "\", expected: \""
+                      + Thread.State.RUNNABLE + "\"");
+            testFailed = true;
+        }
+
+        if (isInNative) {
+            log.complain("FAILURE 3.3.");
+            log.complain("Wrong isInNative value: true, expected: false");
+            testFailed = true;
+        }
+
+        if (isSuspended) {
+            log.complain("FAILURE 3.4.");
+            log.complain("Wrong isSuspended value: true, expected: false");
+            testFailed = true;
+        }
+
+        if (testFailed)
+            log.complain("TEST FAILED");
+        return (testFailed) ? Consts.TEST_FAILED : Consts.TEST_PASSED;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadInfo/from_c/from_c001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadInfo/from_c/from_c001.
+ * VM Testbase keywords: [quick, monitoring, jdk_desktop]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         ThreadInfo.from(CompositeData)
+ *     returns correct results:
+ *     1. null, if CompositeData is null;
+ *     2. trows IllegalArgumentException, if CompositeData doest not represnt
+ *        ThreadInfo;
+ *     3. correct ThreadInfo object, if CompositeData is correct (i.e attributes
+ *        of the CompositeData must have correct values: thread ID, state,
+ *        isInNative, isSuspended).
+ * COMMENT
+ *     Updated according to:
+ *     5014783 Move ThreadState class from java.lang.management to java.lang
+ *     5024531 Fix MBeans design flaw that restricts to use JMX CompositeData
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.ThreadInfo.from_c.from_c001 -testMode=server -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadInfo/getLockName/getlockname001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2004, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.ThreadInfo.getLockName;
+
+import java.lang.management.*;
+import java.io.*;
+import nsk.share.*;
+
+public class getlockname001 {
+    private static Wicket mainEntrance = new Wicket();
+    private static Object backDoor = new Object();
+    private static String lock
+        = backDoor.getClass().getName() + "@"
+        + Integer.toHexString(System.identityHashCode(backDoor));
+    private static boolean testFailed = false;
+
+    public static void main(String[] argv) {
+        System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
+    }
+
+    public static int run(String[] argv, PrintStream out) {
+        ThreadMXBean mbean = ManagementFactory.getThreadMXBean();
+        ThreadInfo info;
+        String name;
+
+        // Test MyThread that is going to be locked on "backDoor" object
+        MyThread myThread = new MyThread(out);
+        myThread.start();
+        long id = myThread.getId();
+
+        // Wait for MyThread to start
+        mainEntrance.waitFor();
+
+        synchronized(backDoor) {
+
+            // MyThread is about to be locked on "backDoor" right now
+            info = mbean.getThreadInfo(id, Integer.MAX_VALUE);
+            name = info.getLockName();
+            backDoor.notify();
+
+            if (!lock.equals(name)) {
+                out.println("Failure 1.");
+                out.println("ThreadInfo.getLockName() returned string \"" + name
+                          + "\" for a locked thread, but \"" + lock
+                          + "\" expected.");
+                testFailed = true;
+            }
+        }
+
+        // Test "main" that is not locked on any object
+        id = Thread.currentThread().getId();
+        info = mbean.getThreadInfo(id, Integer.MAX_VALUE);
+        name = info.getLockName();
+
+        if (name != null) {
+            out.println("Failure 2.");
+            out.println("ThreadInfo.getLockName() returned not-null \"" + name
+                      + "\" for a running thread.");
+            testFailed = true;
+        }
+
+        if (testFailed)
+            out.println("TEST FAILED");
+        return (testFailed) ? Consts.TEST_FAILED : Consts.TEST_PASSED;
+    }
+
+    private static class MyThread extends Thread {
+        PrintStream out;
+
+        MyThread(PrintStream out) {
+            this.out = out;
+        }
+
+        public void run() {
+            synchronized(backDoor) {
+
+                // Notify "main" thread that "backDoor" is waiting for a signal
+                mainEntrance.unlock();
+
+                // The thread is locked on "backDoor" object
+                try {
+                    backDoor.wait();
+                } catch (InterruptedException e) {
+                    out.println("Unexpected exception.");
+                    e.printStackTrace(out);
+                    testFailed = true;
+                }
+            }
+        } // run()
+    } // MyThread
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadInfo/getLockName/getlockname001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadInfo/getLockName/getlockname001.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         ThreadInfo.getLockName()
+ *     returns correct string for a blocked thread and for a running thread.
+ *     The test starts an instance of MyThread, waits to be sure that it is blocked
+ *     on "backDoor" object and then calls getLockName() for it. Since the thread
+ *     is blocked, the expected string is:
+ *         backDoor.getClass().getName() + "<at>"
+ *         + Integer.toHexString(System.identityHashCode(backDoor))
+ *     After that current thread is checked. Since it is not blocked on any object,
+ *     getLockName() must return null.
+ *     Testing of the method does not depend on the way to access metrics, so
+ *     only one (direct access) is implemented in the test.
+ * COMMENT
+ *     Fixed the bug
+ *     4989235 TEST: The spec is updated accoring to 4982289, 4985742
+ *     Updated according to:
+ *     5024531 Fix MBeans design flaw that restricts to use JMX CompositeData
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.ThreadInfo.getLockName.getlockname001
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadInfo/getLockOwnerName/getlockownername001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2004, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.ThreadInfo.getLockOwnerName;
+
+import java.lang.management.*;
+import java.io.*;
+import nsk.share.*;
+
+public class getlockownername001 {
+    public static void main(String[] argv) {
+        System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
+    }
+
+    public static int run(String[] argv, PrintStream out) {
+        ThreadMXBean mbean = ManagementFactory.getThreadMXBean();
+        long id = Thread.currentThread().getId();
+        ThreadInfo info = mbean.getThreadInfo(id, Integer.MAX_VALUE);
+        String name = info.getLockOwnerName();
+
+        if (name != null) {
+            out.println("TEST FAILED.");
+            out.println("ThreadInfo.getLockOwnerName() returned not-null \""
+                      + name + "\" for a running thread.");
+            return Consts.TEST_FAILED;
+        }
+        return Consts.TEST_PASSED;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadInfo/getLockOwnerName/getlockownername001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadInfo/getLockOwnerName/getlockownername001.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         ThreadInfo.getLockOwnerName()
+ *     returns null string for a running thread.
+ *     The test examines the current thread that is not blocked on any object. So,
+ *     the method must return null.
+ *     Testing of the method does not depend on the way to access metrics, so
+ *     only one (direct access) is implemented in the test.
+ * COMMENT
+ *     Fixed the bug
+ *     4989235 TEST: The spec is updated accoring to 4982289, 4985742
+ *     Updated according to:
+ *     5024531 Fix MBeans design flaw that restricts to use JMX CompositeData
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.ThreadInfo.getLockOwnerName.getlockownername001
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadInfo/isInNative/isinnative001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2004, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.ThreadInfo.isInNative;
+
+import java.lang.management.*;
+import java.io.*;
+import nsk.share.*;
+
+public class isinnative001 {
+    public static void main(String[] argv) {
+        System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
+    }
+
+    public static int run(String[] argv, PrintStream out) {
+        ThreadMXBean mbean = ManagementFactory.getThreadMXBean();
+        Thread thread = Thread.currentThread();
+        long id = thread.getId();
+        ThreadInfo info = mbean.getThreadInfo(id, Integer.MAX_VALUE);
+        boolean isInNative = info.isInNative();
+
+        if (isInNative) {
+            out.println("TEST FAILED");
+            out.println("ThreadInfo.isInNative() returned true, in pure java "
+                      + "thread.");
+            return Consts.TEST_FAILED;
+        }
+        return Consts.TEST_PASSED;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadInfo/isInNative/isinnative001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadInfo/isInNative/isinnative001.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         ThreadInfo.isInNative()
+ *     returns true for a pure java thread.
+ *     The test examines the current thread and expects the method to return true.
+ *     Testing of the method does not depend on the way to access metrics, so
+ *     only one (direct access) is implemented in the test.
+ * COMMENT
+ *     Fixed the bug
+ *     4989235 TEST: The spec is updated accoring to 4982289, 4985742
+ *     Updated according to:
+ *     5024531 Fix MBeans design flaw that restricts to use JMX CompositeData
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.ThreadInfo.isInNative.isinnative001
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadInfo/isSuspended/issuspended001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2004, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.ThreadInfo.isSuspended;
+
+import java.lang.management.*;
+import java.io.*;
+import nsk.share.*;
+
+public class issuspended001 {
+    private static Wicket mainEntrance = new Wicket();
+    private static boolean testFailed = false;
+
+    public static void main(String[] argv) {
+        System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
+    }
+
+    public static int run(String[] argv, PrintStream out) {
+        ThreadMXBean mbean = ManagementFactory.getThreadMXBean();
+        MyThread thread = new MyThread(out);
+        thread.start();
+
+        // Wait for MyThread to start
+        mainEntrance.waitFor();
+
+        long id = thread.getId();
+        ThreadInfo info = mbean.getThreadInfo(id, Integer.MAX_VALUE);
+        boolean isSuspended = info.isSuspended();
+        if (isSuspended) {
+            out.println("Failure 1.");
+            out.println("ThreadInfo.isSuspended() returned true, before "
+                      + "Thread.suspend() was invoked.");
+            testFailed = true;
+        }
+
+        thread.suspend();
+        info = mbean.getThreadInfo(id, Integer.MAX_VALUE);
+        isSuspended = info.isSuspended();
+        if (!isSuspended) {
+            out.println("Failure 2.");
+            out.println("ThreadInfo.isSuspended() returned false, after "
+                      + "Thread.suspend() was invoked.");
+            testFailed = true;
+        }
+
+        thread.resume();
+        info = mbean.getThreadInfo(id, Integer.MAX_VALUE);
+        isSuspended = info.isSuspended();
+        if (isSuspended) {
+            out.println("Failure 3.");
+            out.println("ThreadInfo.isSuspended() returned true, after "
+                      + "Thread.resume() was invoked.");
+            testFailed = true;
+        }
+
+        thread.die = true;
+
+        if (testFailed)
+            out.println("TEST FAILED");
+        return (testFailed) ? Consts.TEST_FAILED : Consts.TEST_PASSED;
+    }
+
+    private static class MyThread extends Thread {
+        final static long WAIT_TIME = 500; // Milliseconds
+        Object object = new Object();
+        boolean die = false;
+        PrintStream out;
+
+        MyThread(PrintStream out) {
+            this.out = out;
+        }
+
+        public void run() {
+
+            // Notify "main" thread that MyThread has started
+            mainEntrance.unlock();
+
+            while (!die) {
+                synchronized(object) {
+                    try {
+                        object.wait(WAIT_TIME);
+                    } catch (InterruptedException e) {
+                        out.println("Unexpected exception.");
+                        e.printStackTrace(out);
+                        testFailed = true;
+                    }
+                } // synchronized
+            }
+        } // run()
+    } // MyThread
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadInfo/isSuspended/issuspended001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadInfo/isSuspended/issuspended001.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         ThreadInfo.isSuspended()
+ *     returns correct values for a thread in different states.
+ *     The test starts an instance of MyThread and checks that isSuspended()
+ *     returns false for it. Then it suspends the thread and expects the method
+ *     to return true. After that the MyThread is resumed and isSuspended() must
+ *     return false.
+ *     Testing of the method does not depend on the way to access metrics, so
+ *     only one (direct access) is implemented in the test.
+ * COMMENT
+ *     Fixed the bug
+ *     4989235 TEST: The spec is updated accoring to 4982289, 4985742
+ *     Updated according to:
+ *     5024531 Fix MBeans design flaw that restricts to use JMX CompositeData
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.ThreadInfo.isSuspended.issuspended001
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadInfo/isSuspended/issuspended002.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2004, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.ThreadInfo.isSuspended;
+
+import java.lang.management.*;
+import java.io.*;
+import nsk.share.*;
+
+public class issuspended002 {
+    private static Wicket mainEntrance = new Wicket();
+    private static boolean testFailed = false;
+
+    public static void main(String[] argv) {
+        System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
+    }
+
+    public static int run(String[] argv, PrintStream out) {
+        ThreadMXBean mbean = ManagementFactory.getThreadMXBean();
+        MyThread thread = new MyThread(out);
+        thread.start();
+
+        // Wait for MyThread to start
+        mainEntrance.waitFor();
+
+        long id = thread.getId();
+        ThreadInfo info = mbean.getThreadInfo(id, Integer.MAX_VALUE);
+        boolean isSuspended = info.isSuspended();
+        if (isSuspended) {
+            out.println("Failure 1.");
+            out.println("ThreadInfo.isSuspended() returned true, before "
+                      + "Thread.suspend() was invoked.");
+            testFailed = true;
+        }
+
+        thread.suspend();
+        info = mbean.getThreadInfo(id, Integer.MAX_VALUE);
+        isSuspended = info.isSuspended();
+        if (!isSuspended) {
+            out.println("Failure 2.");
+            out.println("ThreadInfo.isSuspended() returned false, after "
+                      + "Thread.suspend() was invoked.");
+            testFailed = true;
+        }
+
+        thread.resume();
+        info = mbean.getThreadInfo(id, Integer.MAX_VALUE);
+        isSuspended = info.isSuspended();
+        if (isSuspended) {
+            out.println("Failure 3.");
+            out.println("ThreadInfo.isSuspended() returned true, after "
+                      + "Thread.resume() was invoked.");
+            testFailed = true;
+        }
+
+        thread.die = true;
+
+        int count = 0;
+        while (true) {
+            info = mbean.getThreadInfo(id, Integer.MAX_VALUE);
+            if (info == null) {
+                // the thread has exited
+                break;
+            }
+            count++;
+            isSuspended = info.isSuspended();
+            if (isSuspended) {
+                out.println("Failure 4.");
+                out.println("ThreadInfo.isSuspended() returned true, after "
+                          + "thread.die was set to true.");
+                testFailed = true;
+                break;
+            }
+        }
+
+        out.println("INFO: made " + count + " late getThreadInfo() calls.");
+
+        if (testFailed)
+            out.println("TEST FAILED");
+        return (testFailed) ? Consts.TEST_FAILED : Consts.TEST_PASSED;
+    }
+
+    private static class MyThread extends Thread {
+        final static long WAIT_TIME = 500; // Milliseconds
+        Object object = new Object();
+        volatile boolean die = false;
+        PrintStream out;
+
+        MyThread(PrintStream out) {
+            this.out = out;
+        }
+
+        public void run() {
+
+            // Notify "main" thread that MyThread has started
+            mainEntrance.unlock();
+
+            while (!die) {
+                synchronized(object) {
+                    try {
+                        object.wait(WAIT_TIME);
+                    } catch (InterruptedException e) {
+                        out.println("Unexpected exception.");
+                        e.printStackTrace(out);
+                        testFailed = true;
+                    }
+                } // synchronized
+            }
+        } // run()
+    } // MyThread
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadInfo/isSuspended/issuspended002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadInfo/isSuspended/issuspended002.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     Same test as issuspended001 with additional calls to
+ *     ThreadInfo.isSuspended() as the worker thread is exiting.
+ * COMMENT
+ *     Derived from nsk/monitoring/ThreadInfo/isSuspended/issuspended001.
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm -Xlog:thread+smr=debug nsk.monitoring.ThreadInfo.isSuspended.issuspended002
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMBean/findMonitorDeadlockedThreads/find001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.ThreadMBean.findMonitorDeadlockedThreads;
+
+import java.io.*;
+import nsk.share.*;
+import nsk.monitoring.share.*;
+
+public class find001 {
+    public static void main(String[] argv) {
+        System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
+    }
+
+    public static int run(String[] argv, PrintStream out) {
+        ArgumentHandler argHandler = new ArgumentHandler(argv);
+        Log log = new Log(out, argHandler);
+        ThreadMonitor monitor = Monitor.getThreadMonitor(log, argHandler);
+        long id = Thread.currentThread().getId();
+        long[] ids = monitor.findMonitorDeadlockedThreads();
+
+        if (ids == null) {
+            log.display("findCircularBlockedThread() returned null");
+            return Consts.TEST_PASSED;
+        }
+
+        if (ids.length == 0) {
+            log.display("findCircularBlockedThread() returned array of length "
+                      + "0");
+            return Consts.TEST_PASSED;
+        }
+
+        for (int i = 0; i < ids.length; i++) {
+            if (ids[i] == id) {
+                log.complain("TEST FAILED");
+                log.complain("findCircularBlockedThread() returned current "
+                           + "thread (id = " + id + ")");
+                return Consts.TEST_FAILED;
+            }
+        }
+        return Consts.TEST_PASSED;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMBean/isCurrentThreadCpuTimeSupported/curthcputime001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.ThreadMBean.isCurrentThreadCpuTimeSupported;
+
+import java.io.*;
+import nsk.share.*;
+import nsk.monitoring.share.*;
+
+public class curthcputime001 {
+    public static void main(String[] argv) {
+        System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
+    }
+
+    public static int run(String[] argv, PrintStream out) {
+        ArgumentHandler argHandler = new ArgumentHandler(argv);
+        Log log = new Log(out, argHandler);
+        ThreadMonitor monitor = Monitor.getThreadMonitor(log, argHandler);
+
+        // Check the method is... for the specified way of access to MBeans
+        boolean isSupported = monitor.isCurrentThreadCpuTimeSupported();
+        if (isSupported) {
+            log.display("Current thread cpu time is supported.");
+        } else {
+            log.display("Current thread cpu time is not supported.");
+        }
+        return 0;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMBean/isThreadContentionMonitoringSupported/thcontmonitor001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.ThreadMBean.isThreadContentionMonitoringSupported;
+
+import java.io.*;
+import nsk.share.*;
+import nsk.monitoring.share.*;
+
+public class thcontmonitor001 {
+    public static void main(String[] argv) {
+        System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
+    }
+
+    public static int run(String[] argv, PrintStream out) {
+        ArgumentHandler argHandler = new ArgumentHandler(argv);
+        Log log = new Log(out, argHandler);
+        ThreadMonitor monitor = Monitor.getThreadMonitor(log, argHandler);
+
+        // Check the method is... for the specified way of access to MBeans
+        if (!monitor.isThreadContentionMonitoringSupported()) {
+            log.complain("Thread contention monitoring is not supported.");
+            return 2;
+        }
+        return 0;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMBean/isThreadCpuTimeSupported/thcputime001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.ThreadMBean.isThreadCpuTimeSupported;
+
+import java.io.*;
+import nsk.share.*;
+import nsk.monitoring.share.*;
+
+public class thcputime001 {
+    public static void main(String[] argv) {
+        System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
+    }
+
+    public static int run(String[] argv, PrintStream out) {
+        ArgumentHandler argHandler = new ArgumentHandler(argv);
+        Log log = new Log(out, argHandler);
+        ThreadMonitor monitor = Monitor.getThreadMonitor(log, argHandler);
+
+        // Check the method is... for the specified way of access to MBeans
+        boolean isSupported = monitor.isThreadCpuTimeSupported();
+        if (isSupported) {
+            log.display("Thread cpu time is supported.");
+        } else {
+            log.display("Thread cpu time is not supported.");
+        }
+        return 0;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMBean/resetPeakThreadCount/reset001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.ThreadMBean.resetPeakThreadCount;
+
+import java.io.*;
+import nsk.share.*;
+import nsk.monitoring.share.*;
+
+public class reset001 {
+    private static boolean testFailed = false;
+
+    public static void main(String[] argv) {
+        System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
+    }
+
+    public static int run(String[] argv, PrintStream out) {
+        ArgumentHandler argHandler = new ArgumentHandler(argv);
+        Log log = new Log(out, argHandler);
+        ThreadMonitor monitor = Monitor.getThreadMonitor(log, argHandler);
+
+        // Start a couple of threads and wait until they exit
+        Thread left = new Thread();
+        Thread right = new Thread();
+        left.start();
+        right.start();
+
+        try {
+            left.join();
+            right.join();
+        } catch (InterruptedException e) {
+            log.complain("Unexpected exception.");
+            e.printStackTrace(log.getOutStream());
+            testFailed = true;
+        }
+
+        // The test supposes that no threads are appered/disappeared between
+        // "getPeakThreadCount()" and "getThreadCount()" calls
+        monitor.resetPeakThreadCount();
+        int peak = monitor.getPeakThreadCount();
+        int live = monitor.getThreadCount();
+
+        if (peak != live) {
+            log.complain("getPeakThreadCount() returned " + peak + ", but "
+                      + "getThreadCount() returned " + live + " after "
+                      + "resetPeakThreadCount().");
+            testFailed = true;
+        }
+
+        if (testFailed)
+            out.println("TEST FAILED");
+        return (testFailed) ? Consts.TEST_FAILED : Consts.TEST_PASSED;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/BarrierHandler.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2011, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.ThreadMXBean;
+
+import java.util.concurrent.*;
+
+/**
+ * Provide synchronization between management thread and its
+ * managed threads.
+ */
+public class BarrierHandler {
+
+    /**
+     * CyclicBarries for internal synchronization
+     */
+    private CyclicBarrier monitoredThreadsBarrier, startActionBarrier,
+            finishActionBarrier;
+
+    /**
+     * Creates new BarrierHandler that will match specified Threads with
+     * management threads
+     *
+     * @param threads managed threads that are handled by BarrierHandler
+     */
+    public BarrierHandler(MXBeanTestThread... threads) {
+        startActionBarrier = new CyclicBarrier(2);
+        finishActionBarrier = new CyclicBarrier(2);
+        monitoredThreadsBarrier = new CyclicBarrier(threads.length, new ActionThread());
+    }
+
+    /**
+     * Waits when managed thread completes iteration and some action should
+     * be performed by management thread. Should be called within managed thread
+     * only.
+     *
+     */
+    public void ready() {
+        try {
+            monitoredThreadsBarrier.await();
+        } catch (Exception ignored) {}
+    }
+
+    /**
+     * Allows managed threads to proceed to next iteration. Should be called
+     * within management thread only.
+     */
+    public void proceed() {
+        try {
+            finishActionBarrier.await();
+            startActionBarrier.await();
+        } catch (Exception ignored) {}
+    }
+
+    /**
+     * Waits until all managed threads complete first iteration. Should be
+     * called within management thread only.
+     */
+    public void start() {
+        try {
+            startActionBarrier.await();
+        } catch (Exception ignored) {}
+    }
+
+    /**
+     * Allows managed threads to finish after last iteration. Should be called
+     * within management thread only.
+     */
+    public void finish() {
+        try {
+            finishActionBarrier.await();
+        } catch (Exception ignored) {}
+    }
+
+    /**
+     * Action performed on main barrier. Used for synchronization between
+     * management and managed threads
+     */
+    private class ActionThread extends Thread {
+        @Override
+        public void run() {
+            try {
+                startActionBarrier.await();
+                finishActionBarrier.await();
+            } catch (Exception ignored) {}
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/AllocatedMemorySupportedTest.README	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,42 @@
+Copyright (c) 2011, 2018, 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
+under the terms of the GNU General Public License version 2 only, as
+published by the Free Software Foundation.
+
+This code is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+version 2 for more details (a copy is included in the LICENSE file that
+accompanied this code).
+
+You should have received a copy of the GNU General Public License version
+2 along with this work; if not, write to the Free Software Foundation,
+Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+or visit www.oracle.com if you need additional information or have any
+questions.
+
+DESCRIPTION
+    Tests isThreadAllocatedMemorySupported(), isThreadAllocatedMemoryEnabled()
+    and setThreadAllocatedMemoryEnabled(boolean enabled) functions
+    of com.sun.management.ThreadMXBean
+
+    - isThreadAllocatedMemorySupported() should return true
+    - isThreadAllocatedMemoryEnabled() should return true by default
+    - isThreadAllocatedMemoryEnabled() should return false after
+    setThreadAllocatedMemoryEnabled(false) call
+    - isThreadAllocatedMemoryEnabled() should return true again after
+    setThreadAllocatedMemoryEnabled(true) call
+
+    Test is executed in following configurations:
+    ThreadMXBean is accessed
+      - directly threw ManagementFactory.getThreadMXBean()
+      - threw default MBeanServer
+      - threw custom MBeanServer
+      - threw default Proxy
+      - threw custom Proxy
+
+COMMENTS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/AllocatedMemorySupportedTest.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2011, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes;
+
+import nsk.share.*;
+import nsk.monitoring.share.*;
+import nsk.monitoring.ThreadMXBean.ThreadMXBeanTestBase;
+
+/**
+ * Tests isThreadAllocatedMemorySupported(), isThreadAllocatedMemoryEnabled()
+ * and setThreadAllocatedMemoryEnabled(boolean enabled) functions
+ * of com.sun.management.ThreadMXBean
+ * <p>
+ *  - isThreadAllocatedMemorySupported() should return true
+ * <br>
+ *  - isThreadAllocatedMemoryEnabled() should return true by default
+ * <br>
+ *  - isThreadAllocatedMemoryEnabled() should return false after
+ * setThreadAllocatedMemoryEnabled(false) call
+ * <br>
+ *  - isThreadAllocatedMemoryEnabled() should return true again after
+ * setThreadAllocatedMemoryEnabled(true) call
+ */
+public class AllocatedMemorySupportedTest extends ThreadMXBeanTestBase {
+
+    /**
+     * Actually runs the test
+     */
+    public void run() {
+        if (threadMXBean == null)
+            return;
+        // Check that isThreadAllocatedMemorySupported() returns true by default
+        if (! threadMXBean.isThreadAllocatedMemorySupported()) {
+            throw new TestFailure("Failure! isThreadAllocatedMemorySupported() "
+                   + "does not return true by default...");
+        }
+        // Check that isThreadAllocatedMemoryEnabled() returns true by default
+        if (! threadMXBean.isThreadAllocatedMemoryEnabled()) {
+            throw new TestFailure("Failure! isThreadAllocatedMemoryEnabled() "
+                    + "does not return true by default...");
+        }
+        // Call setThreadAllocatedMemoryEnabled(false)
+        threadMXBean.setThreadAllocatedMemoryEnabled(false);
+        // Check that isThreadAllocatedMemoryEnabled() now returns false
+        if (threadMXBean.isThreadAllocatedMemoryEnabled()) {
+            throw new TestFailure("Failure! setThreadAllocatedMemoryEnabled(false) "
+                    + "does not operate as expected...");
+        }
+        // Call setThreadAllocatedMemoryEnabled(true)
+        threadMXBean.setThreadAllocatedMemoryEnabled(true);
+        // Check that isThreadAllocatedMemoryEnabled() returns true again
+        if (! threadMXBean.isThreadAllocatedMemoryEnabled()) {
+            throw new TestFailure("Failure! setThreadAllocatedMemoryEnabled(true) "
+                    + "does not operate as expected...");
+        }
+        log.info("AllocatedMemorySupportedTest passed.");
+    }
+
+    /**
+     * Entry point for java program
+     * @param args sets the test configuration
+     */
+    public static void main(String[] args) {
+        Monitoring.runTest(new AllocatedMemorySupportedTest(), args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/BaseBehaviorTest.README	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,41 @@
+Copyright (c) 2011, 2018, 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
+under the terms of the GNU General Public License version 2 only, as
+published by the Free Software Foundation.
+
+This code is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+version 2 for more details (a copy is included in the LICENSE file that
+accompanied this code).
+
+You should have received a copy of the GNU General Public License version
+2 along with this work; if not, write to the Free Software Foundation,
+Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+or visit www.oracle.com if you need additional information or have any
+questions.
+
+DESCRIPTION
+
+    Tests getThreadAllocatedBytes(long id) and  getThreadAllocatedBytes(long[] ids),
+    functions of com.sun.management.ThreadMXBean
+
+    All methods should
+    - return -1 if ThreadCpuTime allocation is not enabled
+    - return -1 for not started thread
+    - return > 0 value for any running thread
+    - return -1 for finished thread
+
+    Test is executed in following configurations:
+    ThreadMXBean is accessed
+      - directly threw ManagementFactory.getThreadMXBean()
+      - threw default MBeanServer
+      - threw custom MBeanServer
+      - threw default Proxy
+      - threw custom Proxy
+
+COMMENTS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/BaseBehaviorTest.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2011, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes;
+
+import nsk.share.*;
+import nsk.monitoring.share.*;
+import nsk.monitoring.ThreadMXBean.*;
+
+/**
+ * Tests getThreadAllocatedBytes(long id) and  getThreadAllocatedBytes(long[] ids),
+ * functions of com.sun.management.ThreadMXBean
+ * <p>
+ * All methods should
+ * <br>
+ * -  return -1 if ThreadAllocatedMemory allocation is
+ * not enabled
+ *  <br>
+ * - return -1 for not started thread
+ *  <br>
+ * - return > 0 value for any running thread
+ *  <br>
+ * - return -1 for finished thread
+ */
+public class BaseBehaviorTest extends ThreadMXBeanTestBase {
+
+    /**
+     * Actually runs the test
+     */
+    public void run() {
+        if (threadMXBean == null)
+            return;
+        MXBeanTestThread thread = new MXBeanTestThread();
+        long id = thread.getId();
+        long[] idArr = new long[] { id };
+        long result;
+        long[] resultArr;
+        // Expect -1 for not started threads
+        result = threadMXBean.getThreadAllocatedBytes(id);
+        if (result != -1)
+            throw new TestFailure("Failure! getThreadAllocatedBytes(long id) should "
+                    + "return -1 for not started threads. Recieved : " + result);
+        resultArr = threadMXBean.getThreadAllocatedBytes(idArr);
+        if (resultArr[0] != -1)
+            throw new TestFailure("Failure! getThreadAllocatedBytes(long[] ids) should "
+                    + "return -1 for not started threads. Recieved : " + resultArr[0]);
+        BarrierHandler handler = startThreads(thread);
+        try {
+            handler.proceed();
+            // Expect -1 for running thread if ThreadAllocatedMemory (CpuTime) is disabled
+            threadMXBean.setThreadAllocatedMemoryEnabled(false);
+            result = threadMXBean.getThreadAllocatedBytes(id);
+            if (result != -1)
+                throw new TestFailure("Failure! getThreadAllocatedBytes(long id) should "
+                    + "return -1 if ThreadAllocatedMemoryEnabled is set to false. "
+                    + "Recieved : " + result);
+            resultArr = threadMXBean.getThreadAllocatedBytes(idArr);
+            if (resultArr[0] != -1)
+                throw new TestFailure("Failure! getThreadAllocatedBytes(long[] ids) should "
+                    + "return -1 if ThreadAllocatedMemoryEnabled is set to false. "
+                    + "Recieved : " + resultArr[0]);
+
+            threadMXBean.setThreadAllocatedMemoryEnabled(true);
+            // Expect > 0 value for running threads
+            result = threadMXBean.getThreadAllocatedBytes(id);
+            if (result < 0)
+            throw new TestFailure("Failure! getThreadAllocatedBytes(long id) should "
+                    + "return > 0 value for RUNNING thread. Recieved : " + result);
+            resultArr = threadMXBean.getThreadAllocatedBytes(idArr);
+            if (resultArr[0] < 0)
+                throw new TestFailure("Failure! getThreadAllocatedBytes(long[] ids) should "
+                    + "return > 0 value for RUNNING thread. Recieved : " + resultArr[0]);
+        } finally {
+            // Let thread finish
+            handler.finish();
+        }
+        try {
+            thread.join();
+        } catch (InterruptedException e) {}
+        // Expect -1 for finished thread
+        result = threadMXBean.getThreadAllocatedBytes(id);
+        if (result != -1)
+            throw new TestFailure("Failure! getThreadAllocatedBytes(long id) should "
+                    + "return -1 for finished threads. Recieved : " + result);
+        resultArr = threadMXBean.getThreadAllocatedBytes(idArr);
+        if (resultArr[0] != -1)
+            throw new TestFailure("Failure! getThreadAllocatedBytes(long[] ids) should "
+                    + "return -1 for finished threads. Recieved : " + resultArr[0]);
+        log.info("BaseBehaviorTest passed.");
+    }
+
+    /**
+     * Entry point for java program
+     * @param args sets the test configuration
+     */
+    public static void main(String[] args) {
+        ThreadMXBeanTestBase test = new BaseBehaviorTest();
+        Monitoring.runTest(test, test.setGarbageProducer(args));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/DoubleAllocationTest.README	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,43 @@
+Copyright (c) 2011, 2018, 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
+under the terms of the GNU General Public License version 2 only, as
+published by the Free Software Foundation.
+
+This code is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+version 2 for more details (a copy is included in the LICENSE file that
+accompanied this code).
+
+You should have received a copy of the GNU General Public License version
+2 along with this work; if not, write to the Free Software Foundation,
+Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+or visit www.oracle.com if you need additional information or have any
+questions.
+
+DESCRIPTION
+
+    Tests getThreadAllocatedBytes(long id) function of com.sun.management.ThreadMXBean
+
+    - Test starts thread and allocates some amount of memory, then calculates this
+    allocation using getThreadAllocatedBytes() call (allocation1). Then this thread
+    allocates just the same amount of memory and calculates getThreadAllocatedBytes()
+    again (allocation2). It is assumed that allocation2/allocation1 ~ 2.
+
+    Test is executed in following configurations:
+    ThreadMXBean is accessed
+      - directly threw ManagementFactory.getThreadMXBean()
+      - threw default MBeanServer
+      - threw custom MBeanServer
+      - threw default Proxy
+      - threw custom Proxy
+    Allocated object types are
+      - primitive arrays
+      - Class instances
+      - interned String instances
+
+COMMENTS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/DoubleAllocationTest.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2011, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes;
+
+import nsk.share.*;
+import nsk.monitoring.share.*;
+import nsk.monitoring.ThreadMXBean.ThreadMXBeanTestBase;
+import nsk.monitoring.ThreadMXBean.MXBeanTestThread;
+import nsk.monitoring.ThreadMXBean.BarrierHandler;
+
+/**
+ * Tests getThreadAllocatedBytes(long id) function of com.sun.management.ThreadMXBean
+ * <p>
+ *  - Test starts thread and allocates some amount of memory, then calculates this
+ * allocation using getThreadAllocatedBytes() call (allocation1). Then this thread
+ * allocates just the same amount of memory and calculates getThreadAllocatedBytes()
+ * again (allocation2). It is assumed that allocation2/allocation1 ~ 2.
+ */
+public class DoubleAllocationTest extends ThreadMXBeanTestBase {
+
+    /**
+     * Actually runs the test
+     */
+    public void run() {
+        if (threadMXBean == null)
+            return;
+        //TestThread tr = new DoubleAllocationTestThread();
+
+        // Double allocation TestThread thread.
+        // Run behavior : Allocates memory, waits for notify() call,
+        // allocates memory again and waits for notify() call again
+        MXBeanTestThread.warmUp(garbageProducerId);
+        MXBeanTestThread tr = new MXBeanTestThread(garbageProducerId) {
+            @Override
+            public void doWork() {
+                //threadStartBytes = threadMXBean.getThreadAllocatedBytes(Thread.currentThread().getId());
+                //allocate();
+                handler.ready();
+                allocate();
+                handler.ready();
+                allocate();
+                handler.ready();
+            }
+        };
+        BarrierHandler handler = startThreads(tr);
+        try {
+            long startBytes = threadMXBean.getThreadAllocatedBytes(tr.getId());
+            handler.proceed();
+            long value1 = threadMXBean.getThreadAllocatedBytes(tr.getId())
+                    - startBytes;
+            handler.proceed();
+            long value2 = threadMXBean.getThreadAllocatedBytes(tr.getId())
+                    - startBytes;
+            // Expect value1 and value2 differs not more then for 15%
+            if (Math.abs(((double) value2 / (double) value1) - 2) > (double)2*DELTA_PERCENT/100)
+            //if ( Math.abs(2*value1 - value2) > value1*DELTA_PERCENT/100)
+                throw new TestFailure("Failure! Expected getThreadAllocatedBytes() "
+                        + "measurement for some thread at one moment could not be "
+                        + "greater then similar measurement for the same thread "
+                        + "at later moment. Thread allocates same amount of memory "
+                        + "before each measurement. Excpected ~2 times difference. "
+                        + "Recieved: " + value1 + " and " + value2);
+            log.info("DoubleAllocationTest passed.");
+        } finally {
+            handler.finish();
+        }
+    }
+
+    /**
+     * Entry point for java program
+     * @param args sets the test configuration
+     */
+    public static void main(String[] args) {
+        ThreadMXBeanTestBase test = new DoubleAllocationTest();
+        Monitoring.runTest(test, test.setGarbageProducer(args));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/EqualThreadsTest.README	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,41 @@
+Copyright (c) 2011, 2018, 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
+under the terms of the GNU General Public License version 2 only, as
+published by the Free Software Foundation.
+
+This code is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+version 2 for more details (a copy is included in the LICENSE file that
+accompanied this code).
+
+You should have received a copy of the GNU General Public License version
+2 along with this work; if not, write to the Free Software Foundation,
+Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+or visit www.oracle.com if you need additional information or have any
+questions.
+
+DESCRIPTION
+
+    Tests getThreadAllocatedBytes(long id) function of com.sun.management.ThreadMXBean
+
+    - Check that result of getThreadAllocatedBytes(long id) call for similar
+    threads are approximately equals.
+
+    Test is executed in following configurations:
+    ThreadMXBean is accessed
+      - directly threw ManagementFactory.getThreadMXBean()
+      - threw default MBeanServer
+      - threw custom MBeanServer
+      - threw default Proxy
+      - threw custom Proxy
+    Allocated object types are
+      - primitive arrays
+      - Class instances
+      - interned String instances
+
+COMMENTS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/EqualThreadsTest.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2011, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes;
+
+import nsk.share.*;
+import nsk.monitoring.share.*;
+import nsk.monitoring.ThreadMXBean.ThreadMXBeanTestBase;
+import nsk.monitoring.ThreadMXBean.MXBeanTestThread;
+import nsk.monitoring.ThreadMXBean.BarrierHandler;
+
+/**
+ * Tests getThreadAllocatedBytes(long id) function of com.sun.management.ThreadMXBean
+ * <p>
+ *  - Check that result of getThreadAllocatedBytes(long id) call for similar
+ * threads are approximately equals.
+ */
+public class EqualThreadsTest extends ThreadMXBeanTestBase {
+
+    /**
+     * Actually runs the test
+     */
+    public void run() {
+        if (threadMXBean == null)
+            return;
+        MXBeanTestThread.warmUp(garbageProducerId);
+        MXBeanTestThread tr1 = new MXBeanTestThread(garbageProducerId);
+        MXBeanTestThread tr2 = new MXBeanTestThread(garbageProducerId);
+        BarrierHandler handler = startThreads(tr1, tr2);
+        try {
+            long startBytesTr1 = threadMXBean.getThreadAllocatedBytes(tr1.getId());
+            long startBytesTr2 = threadMXBean.getThreadAllocatedBytes(tr2.getId());
+            handler.proceed();
+            long value1 = threadMXBean.getThreadAllocatedBytes(tr1.getId())
+                - startBytesTr1;
+            long value2 = threadMXBean.getThreadAllocatedBytes(tr2.getId())
+                - startBytesTr2;
+            // Expect value1 and value2 differs not more then for 10%
+            if ( Math.abs(value1 - value2) > value1*DELTA_PERCENT/100)
+                throw new TestFailure("Failure! Let f(thread) = getThreadAllocatedBytes()."
+                    + " Expected if thread tr1 is similar to thread tr2"
+                    + " then f(tr1) and f(tr2) differs not more then for "
+                    + DELTA_PERCENT + " %. Recieved: f(tr1)=" + value1
+                    + " f(tr2)=" + value2);
+            log.info("EqualThreadsTest passed.");
+        } finally {
+            handler.finish();
+        }
+    }
+
+    /**
+     * Entry point for java program
+     * @param args sets the test configuration
+     */
+    public static void main(String[] args) {
+        ThreadMXBeanTestBase test = new EqualThreadsTest();
+        Monitoring.runTest(test, test.setGarbageProducer(args));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/IllegalArgumentsTest.README	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,43 @@
+Copyright (c) 2011, 2018, 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
+under the terms of the GNU General Public License version 2 only, as
+published by the Free Software Foundation.
+
+This code is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+version 2 for more details (a copy is included in the LICENSE file that
+accompanied this code).
+
+You should have received a copy of the GNU General Public License version
+2 along with this work; if not, write to the Free Software Foundation,
+Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+or visit www.oracle.com if you need additional information or have any
+questions.
+
+DESCRIPTION
+
+    Tests getThreadAllocatedBytes(long id), getThreadAllocatedBytes(long[] ids)
+    and setThreadAllocatedMemoryEnabled(boolean enabled) functions of
+    com.sun.management.ThreadMXBean
+
+    - any method called with null argument should throw NullPointerException
+    for direct and proxy MBean delivery methods and RuntimeException for
+    server MBean delivery method (MBeanServer)
+    - any method called with zero (0 for long, { 0 } for long[]) argument
+    should throw IllegalArgumentException for direct and proxy MBean delivery
+    methods and RuntimeException for server MBean delivery method (MBeanServer)
+
+    Test is executed in following configurations:
+    ThreadMXBean is accessed
+      - directly threw ManagementFactory.getThreadMXBean()
+      - threw default MBeanServer
+      - threw custom MBeanServer
+      - threw default Proxy
+      - threw custom Proxy
+
+COMMENTS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/IllegalArgumentsTest.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2011, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes;
+
+import nsk.share.*;
+import nsk.monitoring.share.*;
+import nsk.monitoring.ThreadMXBean.ThreadMXBeanTestBase;
+
+
+/**
+ * Tests getThreadAllocatedBytes(long id), getThreadAllocatedBytes(long[] ids)
+ * and setThreadAllocatedMemoryEnabled(boolean enabled) functions of
+ * com.sun.management.ThreadMXBean
+ * <p>
+ *  - any method called with null argument should throw NullPointerException
+ * for direct and proxy MBean delivery methods and RuntimeException for
+ * server MBean delivery method (MBeanServer)
+ *  <br>
+ *  - any method called with zero (0 for long, { 0 } for long[]) argument
+ * should throw IllegalArgumentException for direct and proxy MBean delivery
+ * methods and RuntimeException for server MBean delivery method (MBeanServer)
+ */
+public class IllegalArgumentsTest extends ThreadMXBeanTestBase {
+
+    /**
+     * Actually runs the test
+     */
+    public void run() {
+        if (threadMXBean == null)
+            return;
+        int exceptions = 0;
+        // getThreadAllocatedBytes with null argument
+        try {
+            threadMXBean.getThreadAllocatedBytes(null);
+        } catch (NullPointerException e) {
+            log.info("Caught expected NPE : " + e.getMessage());
+            exceptions++;
+        } catch (RuntimeException e1) {
+            log.info("Caught expected RuntimeException : "
+                    + e1.getMessage());
+            exceptions++;
+        }
+        // getThreadAllocatedBytes(long) with 0
+        try {
+            threadMXBean.getThreadAllocatedBytes(0);
+        } catch (IllegalArgumentException e) {
+            log.info("Caught expected IllegalArgumentException : " + e.getMessage());
+            exceptions++;
+        } catch (RuntimeException e1) {
+            log.info("Caught expected RuntimeException : " + e1.getMessage());
+            exceptions++;
+        }
+        // getThreadAllocatedBytes(long[]) with { 0 }
+        try {
+            threadMXBean.getThreadAllocatedBytes(new long[] { 0 });
+        } catch (IllegalArgumentException e) {
+            log.info("Caught expected IllegalArgumentException : " + e.getMessage());
+            exceptions++;
+        } catch (RuntimeException e1) {
+            log.info("Caught expected RuntimeException : " + e1.getMessage());
+            exceptions++;
+        }
+        // setThreadAllocatedMemoryEnabled(boolean) with null
+        Boolean b = null;
+        try {
+            threadMXBean.setThreadAllocatedMemoryEnabled(b);
+        } catch (NullPointerException e) {
+            log.info("Caught expected NPE : " + e.getMessage());
+            exceptions++;
+        }
+        // 4 exceptions should have been caught
+        if (exceptions != 4)
+            throw new TestFailure("Failure! Expected to catch 4 exceptions, "
+                    + "actually caught : " + exceptions);
+        log.info("IllegalArgumentsTest passed.");
+    }
+
+    /**
+     * Entry point for java program
+     * @param args sets the test configuration
+     */
+    public static void main(String[] args) {
+        Monitoring.runTest(new IllegalArgumentsTest(), args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/NoAllocationTest.README	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,40 @@
+Copyright (c) 2011, 2018, 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
+under the terms of the GNU General Public License version 2 only, as
+published by the Free Software Foundation.
+
+This code is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+version 2 for more details (a copy is included in the LICENSE file that
+accompanied this code).
+
+You should have received a copy of the GNU General Public License version
+2 along with this work; if not, write to the Free Software Foundation,
+Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+or visit www.oracle.com if you need additional information or have any
+questions.
+
+DESCRIPTION
+
+    Tests getThreadAllocatedBytes(long id) function of com.sun.management.ThreadMXBean
+
+    - Test starts thread that does not allocate any additional memory and stores
+    it's getThreadAllocatedBytes() result (value1)
+    Then it starts several other threads that does allocate memory and, after these
+    threads are finished, checks that getThreadAllocatedBytes() result (value2)
+    does not differ from value1
+
+    Test is executed in following configurations:
+    ThreadMXBean is accessed
+      - directly threw ManagementFactory.getThreadMXBean()
+      - threw default MBeanServer
+      - threw custom MBeanServer
+      - threw default Proxy
+      - threw custom Proxy
+
+COMMENTS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/NoAllocationTest.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2011, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes;
+
+import nsk.share.*;
+import nsk.monitoring.share.*;
+import nsk.monitoring.ThreadMXBean.ThreadMXBeanTestBase;
+import nsk.monitoring.ThreadMXBean.MXBeanTestThread;
+import nsk.monitoring.ThreadMXBean.BarrierHandler;
+
+/**
+ * Tests getThreadAllocatedBytes(long id) function of com.sun.management.ThreadMXBean
+ * <p>
+ *  - Test starts thread that does not allocate any additional memory and stores
+ * it's getThreadAllocatedBytes() result (value1)
+ * Then it starts several other threads that does allocate memory and, after these
+ * threads are finished, checks that getThreadAllocatedBytes() result (value2)
+ * does not differ from value1
+ */
+public class NoAllocationTest extends ThreadMXBeanTestBase {
+    private volatile boolean start = false;
+    private volatile boolean stop = false;
+
+    /**
+     * Actually runs the test
+     */
+    public void run() {
+        if (threadMXBean == null)
+            return;
+        // No allocation TestThread thread.
+        // Run behavior : does nothing,  waits for notify() call
+        MXBeanTestThread tr = new MXBeanTestThread() {
+                @Override
+                public void doWork() {
+                    start = true;
+                    while (!stop) { /* empty */ }
+                }
+            };
+        tr.start();
+        MXBeanTestThread tr1 = new MXBeanTestThread();
+        MXBeanTestThread tr2 = new MXBeanTestThread();
+        BarrierHandler handler = startThreads(tr1, tr2);
+        while (!start) { /* empty */ }
+        long value1 = threadMXBean.getThreadAllocatedBytes(tr.getId());
+        handler.proceed();
+        long value2 = threadMXBean.getThreadAllocatedBytes(tr.getId());
+        if (value1 != value2) {
+            throw new TestFailure("Failure! It is expected that idle thread "
+                                  + "does not allocate any memory. getThreadAllocatedBytes() call "
+                                  + "for idle TestThread-" + tr.getName() + " returns different "
+                                  + "values. Recieved : " + value1 + " and " + value2);
+        }
+        log.info("NoAllocationTest passed.");
+        stop = true;
+        handler.finish();
+    }
+
+    /**
+     * Entry point for java program
+     * @param args sets the test configuration
+     */
+    public static void main(String[] args) {
+        ThreadMXBeanTestBase test = new NoAllocationTest();
+        Monitoring.runTest(test, test.setGarbageProducer(args));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/StressTest.README	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,39 @@
+Copyright (c) 2011, 2018, 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
+under the terms of the GNU General Public License version 2 only, as
+published by the Free Software Foundation.
+
+This code is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+version 2 for more details (a copy is included in the LICENSE file that
+accompanied this code).
+
+You should have received a copy of the GNU General Public License version
+2 along with this work; if not, write to the Free Software Foundation,
+Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+or visit www.oracle.com if you need additional information or have any
+questions.
+
+DESCRIPTION
+
+    Tests getThreadAllocatedBytes(long[] id) function of com.sun.management.ThreadMXBean
+
+    This test starts several threads (according test machine processor count). Each
+    thread allocates different size objects (from 8 bytes to 2 megabytes) during
+    defined Stresser time (default is 1 minute). After that for each thread allocated
+    memory is counted and compared to the result of getThreadAllocatedBytes() call.
+
+    Test is executed in following configurations:
+    ThreadMXBean is accessed
+      - directly threw ManagementFactory.getThreadMXBean()
+      - threw default MBeanServer
+      - threw custom MBeanServer
+      - threw default Proxy
+      - threw custom Proxy
+
+COMMENTS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/StressTest.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2011, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes;
+
+import nsk.share.*;
+import nsk.monitoring.share.*;
+import nsk.monitoring.ThreadMXBean.*;
+import nsk.share.test.Stresser;
+
+/**
+ * Tests getThreadAllocatedBytes(long[] id) function of com.sun.management.ThreadMXBean
+ * <p>
+ * This test starts several threads (according test machine processor count). Each
+ * thread allocates different size objects (from 8 bytes to 2 megabytes) during
+ * defined Stresser time (default is 1 minute). After that for each thread allocated
+ * memory is counted and compared to the result of getThreadAllocatedBytes() call.
+ */
+public class StressTest extends ThreadMXBeanTestBase {
+
+    /**
+     * Stress allocation TestThread thread.
+     * Run behavior : Allocates memory for specified amount of time
+     * (default - 1 minute) and waits for notify() call
+     */
+    private class StressTestThread extends MXBeanTestThread {
+        private StressTestThread(Stresser stresser) {
+            super(stresser);
+        }
+
+        @Override
+        public void doWork() {
+            allocateStress();
+            handler.ready();
+        }
+    }
+
+    /**
+     * Actually runs the test
+     */
+    public void run() {
+        if (threadMXBean == null)
+            return;
+        int threadCount = Runtime.getRuntime().availableProcessors();
+        long memMax = Runtime.getRuntime().maxMemory();
+        long threadMemMax = Math.round((((double) memMax) * 0.6) / (double) threadCount);
+        MXBeanTestThread[] threadArr = new MXBeanTestThread[threadCount];
+        long[] idArr = new long[threadCount];
+        for (int i = 0; i < threadCount; i++) {
+            threadArr[i] = new StressTestThread(stresser);
+            threadArr[i].setMaxThreadMemory(threadMemMax);
+            idArr[i] = threadArr[i].getId();
+        }
+        stresser.start(0);
+        BarrierHandler handler = startThreads(threadArr);
+        try {
+            long[] actual = threadMXBean.getThreadAllocatedBytes(idArr);
+            long[] expected = this.getStressAllocatedBytes(threadArr);
+            for (int i = 0; i < threadCount; i++) {
+                if (expected[i] > MIN_STRESS_ALLOCATION_AMOUNT
+                        && Math.abs(actual[i] - expected[i]) >  expected[i]*DELTA_PERCENT/100)
+                {
+                    throw new TestFailure("Failure! Expected that Thread-"
+                        + threadArr[i].getName() + " allocate " + expected[i]
+                        + " bytes. getThreadAllocatedBytes() call returns "
+                        + actual[i]);
+                }
+            }
+            log.info("StressTest passed.");
+        } finally {
+            handler.finish();
+        }
+    }
+
+    /**
+     * Entry point for java program
+     * @param args sets the test configuration
+     */
+    public static void main(String[] args) {
+        ThreadMXBeanTestBase test = new StressTest();
+        test.setStresser(args);
+        Monitoring.runTest(test, test.setGarbageProducer(args));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/allocatedMemorySupportedTest_directly/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/allocatedMemorySupportedTest_directly.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes AllocatedMemorySupportedTest
+ *     For more info please refer to AllocatedMemorySupportedTest.README
+ *     Test configuration:
+ *     Direct access to management metrics
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.AllocatedMemorySupportedTest
+ *      -testMode=directly
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/allocatedMemorySupportedTest_proxy_custom/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/allocatedMemorySupportedTest_proxy_custom.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes AllocatedMemorySupportedTest
+ *     For more info please refer to AllocatedMemorySupportedTest.README
+ *     Test configuration:
+ *     Access to management metrics via default MBean server proxy
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.AllocatedMemorySupportedTest
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/allocatedMemorySupportedTest_proxy_default/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/allocatedMemorySupportedTest_proxy_default.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes AllocatedMemorySupportedTest
+ *     For more info please refer to AllocatedMemorySupportedTest.README
+ *     Test configuration:
+ *     Access to management metrics via default MBean server proxy
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.AllocatedMemorySupportedTest
+ *      -testMode=proxy
+ *      -MBeanServer=default
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/allocatedMemorySupportedTest_server_custom/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/allocatedMemorySupportedTest_server_custom.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes AllocatedMemorySupportedTest
+ *     For more info please refer to AllocatedMemorySupportedTest.README
+ *     Test configuration:
+ *     Access to management metrics via custom MBean server
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.AllocatedMemorySupportedTest
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/allocatedMemorySupportedTest_server_default/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/allocatedMemorySupportedTest_server_default.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes AllocatedMemorySupportedTest
+ *     For more info please refer to AllocatedMemorySupportedTest.README
+ *     Test configuration:
+ *     Access to management metrics via default MBean server
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.AllocatedMemorySupportedTest
+ *      -testMode=server
+ *      -MBeanServer=default
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/baseBehaviorTest_directly/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/baseBehaviorTest_directly.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes BaseBehaviorTest
+ *     For more info please refer to BaseBehaviorTest.README
+ *     Test configuration:
+ *     Direct access to management metrics
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.BaseBehaviorTest
+ *      -testMode=directly
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/baseBehaviorTest_proxy_custom/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/baseBehaviorTest_proxy_custom.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes BaseBehaviorTest
+ *     For more info please refer to BaseBehaviorTest.README
+ *     Test configuration:
+ *     Access to management metrics via default MBean server proxy
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.BaseBehaviorTest
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/baseBehaviorTest_proxy_default/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/baseBehaviorTest_proxy_default.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes BaseBehaviorTest
+ *     For more info please refer to BaseBehaviorTest.README
+ *     Test configuration:
+ *     Access to management metrics via default MBean server proxy
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.BaseBehaviorTest
+ *      -testMode=proxy
+ *      -MBeanServer=default
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/baseBehaviorTest_server_custom/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/baseBehaviorTest_server_custom.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes BaseBehaviorTest
+ *     For more info please refer to BaseBehaviorTest.README
+ *     Test configuration:
+ *     Access to management metrics via custom MBean server
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.BaseBehaviorTest
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/baseBehaviorTest_server_default/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/baseBehaviorTest_server_default.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes BaseBehaviorTest
+ *     For more info please refer to BaseBehaviorTest.README
+ *     Test configuration:
+ *     Access to management metrics via default MBean server
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.BaseBehaviorTest
+ *      -testMode=server
+ *      -MBeanServer=default
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_directly_array/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_directly_array.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes DoubleAllocationTest
+ *     For more info please refer to DoubleAllocationTest.README
+ *     Test configuration:
+ *     Direct access to management metrics
+ *     Allocation objects are primitive arrays (IntArrayProducer GarbageProducer)
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.DoubleAllocationTest
+ *      -testMode=directly
+ *      -gp intArr
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_directly_string/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_directly_string.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes DoubleAllocationTest
+ *     For more info please refer to DoubleAllocationTest.README
+ *     Test configuration:
+ *     Direct access to management metrics
+ *     Allocation objects are interned Strings (Interned(SimpleString) GarbageProducer)
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.DoubleAllocationTest
+ *      -testMode=directly
+ *      -gp interned(simpleString)
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_proxy_custom_array/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_proxy_custom_array.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes DoubleAllocationTest
+ *     For more info please refer to DoubleAllocationTest.README
+ *     Test configuration:
+ *     Access to management metrics via default MBean server proxy
+ *     Allocation objects are primitive arrays (IntArrayProducer GarbageProducer)
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.DoubleAllocationTest
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ *      -gp intArr
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_proxy_custom_string/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_proxy_custom_string.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes DoubleAllocationTest
+ *     For more info please refer to DoubleAllocationTest.README
+ *     Test configuration:
+ *     Access to management metrics via default MBean server proxy
+ *     Allocation objects are interned Strings (Interned(SimpleString) GarbageProducer)
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.DoubleAllocationTest
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ *      -gp interned(simpleString)
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_proxy_default_array/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_proxy_default_array.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes DoubleAllocationTest
+ *     For more info please refer to DoubleAllocationTest.README
+ *     Test configuration:
+ *     Access to management metrics via default MBean server proxy
+ *     Allocation objects are primitive arrays (IntArrayProducer GarbageProducer)
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.DoubleAllocationTest
+ *      -testMode=proxy
+ *      -MBeanServer=default
+ *      -gp intArr
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_proxy_default_string/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_proxy_default_string.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes DoubleAllocationTest
+ *     For more info please refer to DoubleAllocationTest.README
+ *     Test configuration:
+ *     Access to management metrics via default MBean server proxy
+ *     Allocation objects are interned Strings (Interned(SimpleString) GarbageProducer)
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.DoubleAllocationTest
+ *      -testMode=proxy
+ *      -MBeanServer=default
+ *      -gp interned(simpleString)
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_server_custom_array/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_server_custom_array.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes DoubleAllocationTest
+ *     For more info please refer to DoubleAllocationTest.README
+ *     Test configuration:
+ *     Access to management metrics via custom MBean server
+ *     Allocation objects are primitive arrays (IntArrayProducer GarbageProducer)
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.DoubleAllocationTest
+ *      -testMode=server
+ *      -MBeanServer=custom
+ *      -gp intArr
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_server_custom_string/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_server_custom_string.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes DoubleAllocationTest
+ *     For more info please refer to DoubleAllocationTest.README
+ *     Test configuration:
+ *     Access to management metrics via custom MBean server
+ *     Allocation objects are interned Strings (Interned(SimpleString) GarbageProducer)
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.DoubleAllocationTest
+ *      -testMode=server
+ *      -MBeanServer=custom
+ *      -gp interned(simpleString)
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_server_default_array/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_server_default_array.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes DoubleAllocationTest
+ *     For more info please refer to DoubleAllocationTest.README
+ *     Test configuration:
+ *     Access to management metrics via default MBean server
+ *     Allocation objects are primitive arrays (IntArrayProducer GarbageProducer)
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.DoubleAllocationTest
+ *      -testMode=server
+ *      -MBeanServer=default
+ *      -gp intArr
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_server_default_string/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/doubleAllocationTest_server_default_string.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes DoubleAllocationTest
+ *     For more info please refer to DoubleAllocationTest.README
+ *     Test configuration:
+ *     Access to management metrics via default MBean server
+ *     Allocation objects are interned Strings (Interned(SimpleString) GarbageProducer)
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.DoubleAllocationTest
+ *      -testMode=server
+ *      -MBeanServer=default
+ *      -gp interned(simpleString)
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_directly_array/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_directly_array.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes EqualThreadsTest
+ *     For more info please refer to EqualThreadsTest.README
+ *     Test configuration:
+ *     Direct access to management metrics
+ *     Allocation objects are primitive arrays (IntArrayProducer GarbageProducer)
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.EqualThreadsTest
+ *      -testMode=directly
+ *      -gp intArr
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_directly_string/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_directly_string.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes EqualThreadsTest
+ *     For more info please refer to EqualThreadsTest.README
+ *     Test configuration:
+ *     Direct access to management metrics
+ *     Allocation objects are interned Strings (Interned(SimpleString) GarbageProducer)
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.EqualThreadsTest
+ *      -testMode=directly
+ *      -gp interned(simpleString)
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_proxy_custom_array/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_proxy_custom_array.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes EqualThreadsTest
+ *     For more info please refer to EqualThreadsTest.README
+ *     Test configuration:
+ *     Access to management metrics via default MBean server proxy
+ *     Allocation objects are primitive arrays (IntArrayProducer GarbageProducer)
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.EqualThreadsTest
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ *      -gp intArr
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_proxy_custom_string/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_proxy_custom_string.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes EqualThreadsTest
+ *     For more info please refer to EqualThreadsTest.README
+ *     Test configuration:
+ *     Access to management metrics via default MBean server proxy
+ *     Allocation objects are interned Strings (Interned(SimpleString) GarbageProducer)
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.EqualThreadsTest
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ *      -gp interned(simpleString)
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_proxy_default_array/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_proxy_default_array.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes EqualThreadsTest
+ *     For more info please refer to EqualThreadsTest.README
+ *     Test configuration:
+ *     Access to management metrics via default MBean server proxy
+ *     Allocation objects are primitive arrays (IntArrayProducer GarbageProducer)
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.EqualThreadsTest
+ *      -testMode=proxy
+ *      -MBeanServer=default
+ *      -gp intArr
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_proxy_default_string/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_proxy_default_string.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes EqualThreadsTest
+ *     For more info please refer to EqualThreadsTest.README
+ *     Test configuration:
+ *     Access to management metrics via default MBean server proxy
+ *     Allocation objects are interned Strings (Interned(SimpleString) GarbageProducer)
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.EqualThreadsTest
+ *      -testMode=proxy
+ *      -MBeanServer=default
+ *      -gp interned(simpleString)
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_server_custom_array/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_server_custom_array.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes EqualThreadsTest
+ *     For more info please refer to EqualThreadsTest.README
+ *     Test configuration:
+ *     Access to management metrics via custom MBean server
+ *     Allocation objects are primitive arrays (IntArrayProducer GarbageProducer)
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.EqualThreadsTest
+ *      -testMode=server
+ *      -MBeanServer=custom
+ *      -gp intArr
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_server_custom_string/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_server_custom_string.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes EqualThreadsTest
+ *     For more info please refer to EqualThreadsTest.README
+ *     Test configuration:
+ *     Access to management metrics via custom MBean server
+ *     Allocation objects are interned Strings (Interned(SimpleString) GarbageProducer)
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.EqualThreadsTest
+ *      -testMode=server
+ *      -MBeanServer=custom
+ *      -gp interned(simpleString)
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_server_default_array/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_server_default_array.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes EqualThreadsTest
+ *     For more info please refer to EqualThreadsTest.README
+ *     Test configuration:
+ *     Access to management metrics via default MBean server
+ *     Allocation objects are primitive arrays (IntArrayProducer GarbageProducer)
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.EqualThreadsTest
+ *      -testMode=server
+ *      -MBeanServer=default
+ *      -gp intArr
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_server_default_string/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/equalThreadsTest_server_default_string.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes EqualThreadsTest
+ *     For more info please refer to EqualThreadsTest.README
+ *     Test configuration:
+ *     Access to management metrics via default MBean server
+ *     Allocation objects are interned Strings (Interned(SimpleString) GarbageProducer)
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.EqualThreadsTest
+ *      -testMode=server
+ *      -MBeanServer=default
+ *      -gp interned(simpleString)
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/illegalArgumentsTest_directly/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/illegalArgumentsTest_directly.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes IllegalArgumentsTest
+ *     For more info please refer to IllegalArgumentsTest.README
+ *     Test configuration:
+ *     Direct access to management metrics
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.IllegalArgumentsTest
+ *      -testMode=directly
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/illegalArgumentsTest_proxy_custom/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/illegalArgumentsTest_proxy_custom.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes IllegalArgumentsTest
+ *     For more info please refer to IllegalArgumentsTest.README
+ *     Test configuration:
+ *     Access to management metrics via default MBean server proxy
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.IllegalArgumentsTest
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/illegalArgumentsTest_proxy_default/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/illegalArgumentsTest_proxy_default.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes IllegalArgumentsTest
+ *     For more info please refer to IllegalArgumentsTest.README
+ *     Test configuration:
+ *     Access to management metrics via default MBean server proxy
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.IllegalArgumentsTest
+ *      -testMode=proxy
+ *      -MBeanServer=default
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/illegalArgumentsTest_server_custom/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/illegalArgumentsTest_server_custom.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes IllegalArgumentsTest
+ *     For more info please refer to IllegalArgumentsTest.README
+ *     Test configuration:
+ *     Access to management metrics via custom MBean server
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.IllegalArgumentsTest
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/illegalArgumentsTest_server_default/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/illegalArgumentsTest_server_default.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes IllegalArgumentsTest
+ *     For more info please refer to IllegalArgumentsTest.README
+ *     Test configuration:
+ *     Access to management metrics via default MBean server
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.IllegalArgumentsTest
+ *      -testMode=server
+ *      -MBeanServer=default
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/noAllocationTest_directly/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/noAllocationTest_directly.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes NoAllocationTest
+ *     For more info please refer to NoAllocationTest.README
+ *     Test configuration:
+ *     Direct access to management metrics
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.NoAllocationTest
+ *      -testMode=directly
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/noAllocationTest_proxy_custom/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/noAllocationTest_proxy_custom.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes NoAllocationTest
+ *     For more info please refer to NoAllocationTest.README
+ *     Test configuration:
+ *     Access to management metrics via default MBean server proxy
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.NoAllocationTest
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/noAllocationTest_proxy_default/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/noAllocationTest_proxy_default.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes NoAllocationTest
+ *     For more info please refer to NoAllocationTest.README
+ *     Test configuration:
+ *     Access to management metrics via default MBean server proxy
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.NoAllocationTest
+ *      -testMode=proxy
+ *      -MBeanServer=default
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/noAllocationTest_server_custom/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/noAllocationTest_server_custom.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes NoAllocationTest
+ *     For more info please refer to NoAllocationTest.README
+ *     Test configuration:
+ *     Access to management metrics via custom MBean server
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.NoAllocationTest
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/noAllocationTest_server_default/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/noAllocationTest_server_default.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes NoAllocationTest
+ *     For more info please refer to NoAllocationTest.README
+ *     Test configuration:
+ *     Access to management metrics via default MBean server
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.NoAllocationTest
+ *      -testMode=server
+ *      -MBeanServer=default
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/stressTest_directly/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/stressTest_directly/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/stressTest_directly.
+ * VM Testbase keywords: [stress, monitoring, feature_memory_alloc, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes StressTest
+ *     For more info please refer to StressTest.README
+ *     Test configuration:
+ *     Direct access to management metrics
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.StressTest
+ *      -testMode=directly
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/stressTest_proxy_custom/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/stressTest_proxy_custom/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/stressTest_proxy_custom.
+ * VM Testbase keywords: [stress, monitoring, feature_memory_alloc, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes StressTest
+ *     For more info please refer to StressTest.README
+ *     Test configuration:
+ *     Access to management metrics via default MBean server proxy
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.StressTest
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/stressTest_proxy_default/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/stressTest_proxy_default/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/stressTest_proxy_default.
+ * VM Testbase keywords: [stress, monitoring, feature_memory_alloc, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes StressTest
+ *     For more info please refer to StressTest.README
+ *     Test configuration:
+ *     Access to management metrics via default MBean server proxy
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.StressTest
+ *      -testMode=proxy
+ *      -MBeanServer=default
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/stressTest_server_custom/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/stressTest_server_custom/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/stressTest_server_custom.
+ * VM Testbase keywords: [stress, monitoring, feature_memory_alloc, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes StressTest
+ *     For more info please refer to StressTest.README
+ *     Test configuration:
+ *     Access to management metrics via custom MBean server
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.StressTest
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/stressTest_server_default/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/stressTest_server_default/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/stressTest_server_default.
+ * VM Testbase keywords: [stress, monitoring, feature_memory_alloc, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes StressTest
+ *     For more info please refer to StressTest.README
+ *     Test configuration:
+ *     Access to management metrics via default MBean server
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.ThreadMXBean.GetThreadAllocatedBytes.StressTest
+ *      -testMode=server
+ *      -MBeanServer=default
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/BaseBehaviorTest.README	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,41 @@
+Copyright (c) 2011, 2018, 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
+under the terms of the GNU General Public License version 2 only, as
+published by the Free Software Foundation.
+
+This code is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+version 2 for more details (a copy is included in the LICENSE file that
+accompanied this code).
+
+You should have received a copy of the GNU General Public License version
+2 along with this work; if not, write to the Free Software Foundation,
+Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+or visit www.oracle.com if you need additional information or have any
+questions.
+
+DESCRIPTION
+
+    Tests getThreadCpuTime(long[] ids) and getThreadUserTime(long[] ids)
+    functions of com.sun.management.ThreadMXBean
+
+    All methods should
+    - return -1 if ThreadCpuTime allocation is not enabled
+    - return -1 for not started thread
+    - return > 0 value for any running thread
+    - return -1 for finished thread
+
+    Test is executed in following configurations:
+    ThreadMXBean is accessed
+      - directly threw ManagementFactory.getThreadMXBean()
+      - threw default MBeanServer
+      - threw custom MBeanServer
+      - threw default Proxy
+      - threw custom Proxy
+
+COMMENTS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/BaseBehaviorTest.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2011, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package nsk.monitoring.ThreadMXBean.GetThreadCpuTime;
+
+import nsk.share.*;
+import nsk.monitoring.share.*;
+import nsk.monitoring.ThreadMXBean.*;
+
+/**
+ * Tests getThreadCpuTime(long[] ids) and getThreadUserTime(long[] ids)
+ * functions of com.sun.management.ThreadMXBean
+ * <p>
+ * All methods should
+ * <br>
+ * -  return -1 if ThreadCpuTime allocation is
+ * not enabled
+ * <br>
+ * - return -1 for not started thread
+ * <br>
+ * - return > 0 value for any running thread
+ * <br>
+ * - return -1 for finished thread
+ */
+public class BaseBehaviorTest extends ThreadMXBeanTestBase {
+
+    /**
+     * Actually runs the test
+     */
+    public void run() {
+        if (threadMXBean == null)
+            return;
+        MXBeanTestThread thread = new MXBeanTestThread();
+        long id = thread.getId();
+        long[] idArr = new long[] { id };
+        long[] resultArr;
+        // Expect -1 for not started threads
+        resultArr = threadMXBean.getThreadCpuTime(idArr);
+        if (resultArr[0] != -1)
+            throw new TestFailure("Failure! getThreadCpuTime(long[] ids) should "
+                    + "return -1 for not started threads. Recieved : " + resultArr[0]);
+        resultArr = threadMXBean.getThreadUserTime(idArr);
+        if (resultArr[0] != -1)
+            throw new TestFailure("Failure! getThreadUserTime(long[] ids) should "
+                    + "return -1 for not started threads. Recieved : " + resultArr[0]);
+        BarrierHandler handler = startThreads(thread);
+        try {
+            handler.proceed();
+            // Expect -1 for running thread if ThreadAllocatedMemory (CpuTime) is disabled
+            threadMXBean.setThreadCpuTimeEnabled(false);
+            resultArr = threadMXBean.getThreadCpuTime(idArr);
+            if (resultArr[0] != -1)
+                throw new TestFailure("Failure! getThreadCpuTime(long[] ids) should "
+                    + "return -1 if threadCpuTimeEnabled is set to false. "
+                    + "Recieved : " + resultArr[0]);
+            resultArr = threadMXBean.getThreadUserTime(idArr);
+            if (resultArr[0] != -1)
+                throw new TestFailure("Failure! getThreadUserTime(long[] ids) should "
+                    + "return -1 if threadCpuTimeEnabled is set to false. "
+                    + "Recieved : " + resultArr[0]);
+            threadMXBean.setThreadCpuTimeEnabled(true);
+            // Expect > 0 value for running threads
+            resultArr = threadMXBean.getThreadCpuTime(idArr);
+            if (resultArr[0] < 0)
+                throw new TestFailure("Failure! getThreadCpuTime(long[] ids) should "
+                    + "return > 0 value for RUNNING thread. Recieved : " + resultArr[0]);
+            resultArr = threadMXBean.getThreadUserTime(idArr);
+            if (resultArr[0] < 0)
+                throw new TestFailure("Failure! getThreadUserTime(long[] ids) should "
+                    + "return > 0 value for RUNNING thread. Recieved : " + resultArr[0]);
+        } finally {
+            // Let thread finish
+            handler.finish();
+        }
+        try {
+            thread.join();
+        } catch (InterruptedException e) {}
+        // Expect -1 for finished thread
+        resultArr = threadMXBean.getThreadCpuTime(idArr);
+        if (resultArr[0] != -1)
+            throw new TestFailure("Failure! getThreadCpuTime(long[] ids) should "
+                    + "return -1 for finished threads. Recieved : " + resultArr[0]);
+        resultArr = threadMXBean.getThreadUserTime(idArr);
+        if (resultArr[0] != -1)
+            throw new TestFailure("Failure! getThreadUserTime(long[] ids) should "
+                    + "return -1 for finished threads. Recieved : " + resultArr[0]);
+        log.info("BaseBehaviorTest passed.");
+    }
+
+    /**
+     * Entry point for java program
+     * @param args sets the test configuration
+     */
+    public static void main(String[] args) {
+        ThreadMXBeanTestBase test = new BaseBehaviorTest();
+        Monitoring.runTest(test, test.setGarbageProducer(args));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/IllegalArgumentsTest.README	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,42 @@
+Copyright (c) 2011, 2018, 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
+under the terms of the GNU General Public License version 2 only, as
+published by the Free Software Foundation.
+
+This code is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+version 2 for more details (a copy is included in the LICENSE file that
+accompanied this code).
+
+You should have received a copy of the GNU General Public License version
+2 along with this work; if not, write to the Free Software Foundation,
+Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+or visit www.oracle.com if you need additional information or have any
+questions.
+
+DESCRIPTION
+
+    Tests  getThreadCpuTime(long[] ids) and getThreadUserTime(long[] ids)
+    functions of com.sun.management.ThreadMXBean
+
+    - any method called with null argument should throw NullPointerException
+    for direct and proxy MBean delivery methods and RuntimeException for
+    server MBean delivery method (MBeanServer)
+    - any method called with zero (0 for long, { 0 } for long[]) argument
+    should throw IllegalArgumentException for direct and proxy MBean delivery
+    methods and RuntimeException for server MBean delivery method (MBeanServer)
+
+    Test is executed in following configurations:
+    ThreadMXBean is accessed
+      - directly threw ManagementFactory.getThreadMXBean()
+      - threw default MBeanServer
+      - threw custom MBeanServer
+      - threw default Proxy
+      - threw custom Proxy
+
+COMMENTS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/IllegalArgumentsTest.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2011, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.ThreadMXBean.GetThreadCpuTime;
+
+import nsk.share.*;
+import nsk.monitoring.share.*;
+import nsk.monitoring.ThreadMXBean.ThreadMXBeanTestBase;
+
+
+/**
+ * Tests  getThreadCpuTime(long[] ids) and getThreadUserTime(long[] ids)
+ * functions of com.sun.management.ThreadMXBean
+ * <p>
+ *  - any method called with null argument should throw NullPointerException
+ * for direct and proxy MBean delivery methods and RuntimeException for
+ * server MBean delivery method (MBeanServer)
+ * <br>
+ *  - any method called with zero (0 for long, { 0 } for long[]) argument
+ * should throw IllegalArgumentException for direct and proxy MBean delivery
+ * methods and RuntimeException for server MBean delivery method (MBeanServer)
+ */
+public class IllegalArgumentsTest extends ThreadMXBeanTestBase {
+
+    /**
+     * Actually runs the test
+     */
+    public void run() {
+        if (threadMXBean == null)
+            return;
+        int exceptions = 0;
+        // getThreadCpuTime(long[]) with null
+        try {
+            threadMXBean.getThreadCpuTime(null);
+        } catch (NullPointerException e) {
+            log.info("Caught expected NPE : " + e.getMessage());
+            exceptions++;
+        } catch (RuntimeException e1) {
+            log.info("Caught expected RuntimeException : " + e1.getMessage());
+            exceptions++;
+        }
+        // getThreadCpuTime(long[]) with { 0 }
+        try {
+            threadMXBean.getThreadCpuTime(new long[] { 0 });
+        } catch (IllegalArgumentException e) {
+            log.info("Caught expected IllegalArgumentException : " + e.getMessage());
+            exceptions++;
+        } catch (RuntimeException e1) {
+            log.info("Caught expected RuntimeException : " + e1.getMessage());
+            exceptions++;
+        }
+        // getThreadUserTime(long[]) with null
+        try {
+            threadMXBean.getThreadUserTime(null);
+        } catch (NullPointerException e) {
+            log.info("Caught expected NPE : " + e.getMessage());
+            exceptions++;
+        } catch (RuntimeException e1) {
+            log.info("Caught expected RuntimeException : " + e1.getMessage());
+            exceptions++;
+        }
+        // getThreadCpuTime(long[]) with { 0 }
+        try {
+            threadMXBean.getThreadUserTime(new long[] { 0 });
+        } catch (IllegalArgumentException e) {
+            log.info("Caught expected IllegalArgumentException : " + e.getMessage());
+            exceptions++;
+        } catch (RuntimeException e1) {
+            log.info("Caught expected RuntimeException : " + e1.getMessage());
+            exceptions++;
+        }
+        // 4 exceptions should have been caught
+        if (exceptions != 4)
+            throw new TestFailure("Failure! Expected to catch 4 exceptions, "
+                    + "actually caught : " + exceptions);
+        log.info("IllegalArgumentsTest passed.");
+    }
+
+    /**
+     * Entry point for java program
+     * @param args sets the test configuration
+     */
+    public static void main(String[] args) {
+        Monitoring.runTest(new IllegalArgumentsTest(), args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/baseBehaviorTest_directly/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadCpuTime/baseBehaviorTest_directly.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes BaseBehaviorTest
+ *     For more info please refer to BaseBehaviorTest.README
+ *     Test configuration:
+ *     Direct access to management metrics
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadCpuTime.BaseBehaviorTest
+ *      -testMode=directly
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/baseBehaviorTest_proxy_custom/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadCpuTime/baseBehaviorTest_proxy_custom.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes BaseBehaviorTest
+ *     For more info please refer to BaseBehaviorTest.README
+ *     Test configuration:
+ *     Access to management metrics via default MBean server proxy
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadCpuTime.BaseBehaviorTest
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/baseBehaviorTest_proxy_default/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadCpuTime/baseBehaviorTest_proxy_default.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes BaseBehaviorTest
+ *     For more info please refer to BaseBehaviorTest.README
+ *     Test configuration:
+ *     Access to management metrics via default MBean server proxy
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadCpuTime.BaseBehaviorTest
+ *      -testMode=proxy
+ *      -MBeanServer=default
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/baseBehaviorTest_server_custom/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadCpuTime/baseBehaviorTest_server_custom.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes BaseBehaviorTest
+ *     For more info please refer to BaseBehaviorTest.README
+ *     Test configuration:
+ *     Access to management metrics via custom MBean server
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadCpuTime.BaseBehaviorTest
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/baseBehaviorTest_server_default/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadCpuTime/baseBehaviorTest_server_default.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes BaseBehaviorTest
+ *     For more info please refer to BaseBehaviorTest.README
+ *     Test configuration:
+ *     Access to management metrics via default MBean server
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadCpuTime.BaseBehaviorTest
+ *      -testMode=server
+ *      -MBeanServer=default
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/illegalArgumentsTest_directly/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadCpuTime/illegalArgumentsTest_directly.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes IllegalArgumentsTest
+ *     For more info please refer to IllegalArgumentsTest.README
+ *     Test configuration:
+ *     Direct access to management metrics
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadCpuTime.IllegalArgumentsTest
+ *      -testMode=directly
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/illegalArgumentsTest_proxy_custom/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadCpuTime/illegalArgumentsTest_proxy_custom.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes IllegalArgumentsTest
+ *     For more info please refer to IllegalArgumentsTest.README
+ *     Test configuration:
+ *     Access to management metrics via default MBean server proxy
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadCpuTime.IllegalArgumentsTest
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/illegalArgumentsTest_proxy_default/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadCpuTime/illegalArgumentsTest_proxy_default.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes IllegalArgumentsTest
+ *     For more info please refer to IllegalArgumentsTest.README
+ *     Test configuration:
+ *     Access to management metrics via default MBean server proxy
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadCpuTime.IllegalArgumentsTest
+ *      -testMode=proxy
+ *      -MBeanServer=default
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/illegalArgumentsTest_server_custom/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadCpuTime/illegalArgumentsTest_server_custom.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes IllegalArgumentsTest
+ *     For more info please refer to IllegalArgumentsTest.README
+ *     Test configuration:
+ *     Access to management metrics via custom MBean server
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadCpuTime.IllegalArgumentsTest
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime/illegalArgumentsTest_server_default/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/GetThreadCpuTime/illegalArgumentsTest_server_default.
+ * VM Testbase keywords: [quick, monitoring, feature_memory_alloc]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     This test executes IllegalArgumentsTest
+ *     For more info please refer to IllegalArgumentsTest.README
+ *     Test configuration:
+ *     Access to management metrics via default MBean server
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.GetThreadCpuTime.IllegalArgumentsTest
+ *      -testMode=server
+ *      -MBeanServer=default
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/MXBeanTestThread.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,197 @@
+/*
+ * Copyright (c) 2011, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.ThreadMXBean;
+
+import java.util.ArrayList;
+import java.util.List;
+import nsk.share.gc.gp.GarbageProducer;
+import nsk.share.gc.gp.GarbageUtils;
+import nsk.share.test.Stresser;
+
+
+public class MXBeanTestThread extends Thread {
+
+    /**
+     * BarrierHandler instance for synchronization with management thread
+     */
+    protected BarrierHandler handler;
+
+    /**
+     * List where allocated objects are stored
+     */
+    private List<Object> allocatedList;
+    /**
+     * Number of simultaneously running threads
+     */
+    private static int threadCount;
+    /**
+     * java.util.Random instance for stress test (allocateStress())
+     */
+    private java.util.Random random = new java.util.Random();
+    /**
+     * Expected amount of memory allocated during stress test
+     */
+    private long stressAllocatedBytes;
+    /**
+     * Maximum memory in bytes that one thread is allowed to use at once
+     */
+    private long maxThreadMemory = 0;
+    /**
+     * GarbageProducer for objects creation
+     */
+    private GarbageProducer gp;
+    /**
+     * Stresser instance for allocateStress()
+     */
+    private Stresser stresser;
+
+    public static void warmUp(String garbageProducerId) {
+        MXBeanTestThread warmUpThread = new MXBeanTestThread(garbageProducerId) {
+                @Override
+                public void doWork() {
+                    allocate();
+                }
+            };
+        warmUpThread.start();
+        do {
+            try {
+                warmUpThread.join();
+            } catch (InterruptedException ie) {}
+        } while(warmUpThread.isAlive());
+    }
+
+    /**
+     * Sets BarrierHandler for this thread
+     *
+     * @param handler BarrierHandler to synchronize with
+     */
+    public void setHandler(BarrierHandler handler) {
+        this.handler = handler;
+    }
+
+    /**
+     * Returns an instance of MXBeanTestThread with already defined
+     * allocatedList List and GarbageProducer
+     */
+    public MXBeanTestThread(String garbageProducerId) {
+        super(Integer.toString(++threadCount));
+        allocatedList = new ArrayList<Object>();
+        gp = GarbageUtils.getGarbageProducer(garbageProducerId);
+        maxThreadMemory = Runtime.getRuntime().maxMemory()/4;
+    }
+
+    /**
+     * Returns an instance of MXBeanTestThread with already defined
+     * allocatedList List and default GarbageProducer
+     */
+    public MXBeanTestThread() {
+        this("intArr");
+    }
+
+    /**
+     * Returns an instance of MXBeanTestThread with already defined
+     * allocatedList List and Stresser
+     */
+    public MXBeanTestThread(Stresser stresser) {
+        this("intArr");
+        this.stresser = stresser;
+    }
+
+    /**
+     * Sets maximum amount of memory that could be used at once for each
+     * TestThread in StressTest
+     */
+    public void setMaxThreadMemory (long memory) {
+        maxThreadMemory = memory;
+    }
+
+    /**
+     * Returns expected memory allocated by TestThread during StressTest
+     * @return expected memory amount
+     */
+    public long getStressAllocatedBytes() {
+        return stressAllocatedBytes;
+    }
+
+    @Override
+    public void run() {
+        doWork();
+    }
+
+    /**
+     * Implementation of TestThread behavior logic
+     */
+    public void doWork() {
+        handler.ready();
+        allocate();
+        handler.ready();
+    }
+
+    /**
+     * Allocates memory for amount of time specified in Stresser instance
+     */
+    protected void allocateStress() {
+        // Size of long[] array that allocates 2 Mb + 1 byte
+        int MAX_ARR_SIZE=262146;
+        // Anount of memory allocated by thread with existing links
+        // Which means that these objects can't be collected by GC
+        long actuallyAllocated = 0;
+        try {
+            while (stresser.continueExecution()) {
+                //int chunkSize = random.nextInt(MAX_OBJECT_SIZE);
+                //Object obj = gp.create(chunkSize);
+                int chunkSize = random.nextInt(MAX_ARR_SIZE);
+                Object obj = new long[chunkSize];
+                allocatedList.add(obj);
+                actuallyAllocated += chunkSize*8;
+                if (actuallyAllocated > maxThreadMemory) {
+                    // Allocated more then allowed to one thread
+                    // re-define allocatedList to allow GC to delete
+                    // created objects
+                    stressAllocatedBytes += actuallyAllocated;
+                    actuallyAllocated = 0;
+                    allocatedList = new ArrayList<Object>();
+                }
+            }
+        } catch (OutOfMemoryError e) {
+        } finally {
+            stressAllocatedBytes += actuallyAllocated;
+        }
+    }
+
+    /**
+     * Allocates memory once according test settings
+     */
+    protected void allocate() {
+        long actuallyAllocated = 0;
+        for (int i = 0; i < ThreadMXBeanTestBase.allocArr.length; i++) {
+            long size = ThreadMXBeanTestBase.allocArr[i];
+            if (actuallyAllocated + size > maxThreadMemory) {
+                break;
+            }
+            allocatedList.add(gp.create(size));
+            actuallyAllocated += size;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/BlockedThread/BlockedThread001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/BlockedThread/BlockedThread001.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=blocked
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/BlockedThread/BlockedThread002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/BlockedThread/BlockedThread002.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6, jdk_desktop]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=blocked
+ *      -testMode=server
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/BlockedThread/BlockedThread003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/BlockedThread/BlockedThread003.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6, jdk_desktop]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=blocked
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/BlockedThread/BlockedThread004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/BlockedThread/BlockedThread004.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6, jdk_desktop]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=blocked
+ *      -testMode=proxy
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/BlockedThread/BlockedThread005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/BlockedThread/BlockedThread005.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6, jdk_desktop]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=blocked
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/JavaDeadlock001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/JavaDeadlock001.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6, quarantine]
+ * VM Testbase comments: JDK-8060733
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm/native
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=javaDeadlock
+ *      -iterations=1
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/JavaDeadlock002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/JavaDeadlock002.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6, jdk_desktop]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm/native
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=javaDeadlock
+ *      -testMode=server
+ *      -iterations=1
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/JavaDeadlock003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/JavaDeadlock003.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6, jdk_desktop]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm/native
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=javaDeadlock
+ *      -testMode=server
+ *      -MBeanServer=custom
+ *      -iterations=1
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/JavaDeadlock004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/JavaDeadlock004.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6, jdk_desktop]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm/native
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=javaDeadlock
+ *      -testMode=proxy
+ *      -iterations=1
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/JavaDeadlock005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/JavaDeadlock005.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6, jdk_desktop]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm/native
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=javaDeadlock
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ *      -iterations=1
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/MixedDeadlock001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/MixedDeadlock001.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm/native
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=mixedDeadlock
+ *      -iterations=1
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/NativeDeadlock001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/NativeDeadlock001.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm/native
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=nativeDeadlock
+ *      -iterations=1
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/SynchronizedMethodDeadlock001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/SynchronizedMethodDeadlock001.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm/native
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=synchronizedMethodDeadlock
+ *      -iterations=1
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/SynchronizerDeadlock001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/SynchronizerDeadlock001.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm/native
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=synchronizerDeadlock
+ *      -iterations=1
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/FinishedThread/FinishedThread001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/FinishedThread/FinishedThread001.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=finished
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/FinishedThread/FinishedThread002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/FinishedThread/FinishedThread002.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=finished
+ *      -testMode=server
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/FinishedThread/FinishedThread003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/FinishedThread/FinishedThread003.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=finished
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/FinishedThread/FinishedThread004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/FinishedThread/FinishedThread004.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=finished
+ *      -testMode=proxy
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/FinishedThread/FinishedThread005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/FinishedThread/FinishedThread005.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=finished
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/LockingThreads/LockingThreads001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/LockingThreads/LockingThreads001.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm/native
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=lockingThreads
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/LockingThreads/LockingThreads002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/LockingThreads/LockingThreads002.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6, jdk_desktop]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm/native
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=lockingThreads
+ *      -testMode=server
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/LockingThreads/LockingThreads003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/LockingThreads/LockingThreads003.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6, jdk_desktop]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm/native
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=lockingThreads
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/LockingThreads/LockingThreads004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/LockingThreads/LockingThreads004.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6, jdk_desktop]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm/native
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=lockingThreads
+ *      -testMode=proxy
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/LockingThreads/LockingThreads005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/LockingThreads/LockingThreads005.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6, jdk_desktop]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm/native
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=lockingThreads
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Multi/Multi001/Multi001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/Multi/Multi001.
+ * VM Testbase keywords: [monitoring, stress, stressopt, feature_136, nonconcurrent, vm6, quarantine]
+ * VM Testbase comments: JDK-7187073
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.ThreadMXBean.ThreadInfo.Multi.Multi001.Multi001
+ */
+
+package nsk.monitoring.ThreadMXBean.ThreadInfo.Multi.Multi001;
+
+import java.lang.management.*;
+import nsk.share.runner.*;
+import nsk.monitoring.share.*;
+import nsk.monitoring.share.thread.*;
+import nsk.share.TestFailure;
+import nsk.share.test.Stresser;
+
+/**
+ * This test starts huge number of scenarios of different types. Each
+ * thread is then brought into pre-defined state and ThreadInfo
+ * information obtained from ThreadMXBean is verified. This is repeated
+ * several times.
+ */
+public class Multi001 extends MonitoringTestBase implements RunParamsAware {
+        private RunParams runParams;
+        private ThreadMXBean thread;
+        private int scenarioCount;
+        private ThreadMonitoringScenarioFactory scenarioFactory;
+        private int iterations = 3;
+        private int maxDepth = 200;
+
+        private void runOne() {
+                ThreadMonitoringScenario scenario = new MultiScenario(scenarioFactory, scenarioCount);
+                try {
+                        log.info("Starting: " + scenario);
+                        scenario.begin();
+                        scenario.waitState();
+                        log.info("State reached");
+                        log.info("Checking: " + scenario);
+                        scenario.check(thread);
+                } finally {
+                        log.info("Finishing: " + scenario);
+                        scenarioFactory.finish();
+                        scenario.finish();
+                        log.info("Ending: " + scenario);
+                        scenario.end();
+                }
+        }
+
+        public void run() {
+                scenarioFactory = new StandardThreadMonitoringScenarioFactory(log, maxDepth, runParams.getMediumLoadThreadsCount());
+                thread = monitoringFactory.getThreadMXBean();
+                //scenarioCount = runParams.getHighLoadThreadsCount();
+                scenarioCount = scenarioFactory.getScenarioCount(runParams.getBasicLoadThreadsCount());
+                log.info("Scenario count: " + scenarioCount);
+                Stresser stresser = new Stresser(runParams.getStressOptions());
+                try {
+                        stresser.start(iterations);
+                        while (stresser.iteration());
+                                runOne();
+                } finally {
+                        stresser.finish();
+                }
+                log.info("TEST PASSED");
+        }
+
+        public void setRunParams(RunParams runParams) {
+                this.runParams = runParams;
+        }
+
+        public static void main(String[] args) {
+                Monitoring.runTest(new Multi001(), args);
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Multi/Multi001/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Multi/Multi002/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Multi/Multi002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/Multi/Multi002.
+ * VM Testbase keywords: [monitoring, stress, stressopt, feature_136, nonconcurrent, vm6, quarantine]
+ * VM Testbase comments: JDK-7187073
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.ThreadMXBean.ThreadInfo.Multi.Multi001.Multi001 -testMode=server
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Multi/Multi003/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Multi/Multi003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/Multi/Multi003.
+ * VM Testbase keywords: [monitoring, stress, stressopt, feature_136, nonconcurrent, vm6, quarantine]
+ * VM Testbase comments: JDK-7187073
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.Multi.Multi001.Multi001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Multi/Multi004/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Multi/Multi004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/Multi/Multi004.
+ * VM Testbase keywords: [monitoring, stress, stressopt, feature_136, nonconcurrent, vm6, quarantine]
+ * VM Testbase comments: JDK-7187073
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.ThreadMXBean.ThreadInfo.Multi.Multi001.Multi001 -testMode=proxy
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Multi/Multi005/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Multi/Multi005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/Multi/Multi005.
+ * VM Testbase keywords: [monitoring, stress, stressopt, feature_136, nonconcurrent, vm6, quarantine]
+ * VM Testbase comments: JDK-7187073
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.Multi.Multi001.Multi001
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/NativeBlockedThread/NativeBlockedThread001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/NativeBlockedThread/NativeBlockedThread001.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm/native
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=nativeBlocked
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/NativeBlockedThread/NativeBlockedThread002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/NativeBlockedThread/NativeBlockedThread002.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6, jdk_desktop]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm/native
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=nativeBlocked
+ *      -testMode=server
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/NativeBlockedThread/NativeBlockedThread003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/NativeBlockedThread/NativeBlockedThread003.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6, jdk_desktop]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm/native
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=nativeBlocked
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/NativeBlockedThread/NativeBlockedThread004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/NativeBlockedThread/NativeBlockedThread004.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6, jdk_desktop]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm/native
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=nativeBlocked
+ *      -testMode=proxy
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/NativeBlockedThread/NativeBlockedThread005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/NativeBlockedThread/NativeBlockedThread005.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6, jdk_desktop]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm/native
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=nativeBlocked
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/NewThread/NewThread001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/NewThread/NewThread001.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=new
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/NewThread/NewThread002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/NewThread/NewThread002.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=new
+ *      -testMode=server
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/NewThread/NewThread003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/NewThread/NewThread003.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=new
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/NewThread/NewThread004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/NewThread/NewThread004.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=new
+ *      -testMode=proxy
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/NewThread/NewThread005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/NewThread/NewThread005.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=new
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/RunningThread/RunningThread001/RunningThread001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/RunningThread/RunningThread001.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=running
+ */
+
+package nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001;
+
+import java.lang.management.*;
+import nsk.share.runner.*;
+import nsk.monitoring.share.*;
+import nsk.monitoring.share.thread.*;
+import nsk.share.TestFailure;
+
+/**
+ * This test starts huge number of threads of different types. Each
+ * thread is then brought into pre-defined state and ThreadInfo
+ * information obtained from ThreadMXBean is verified. This is repeated
+ * several times.
+ */
+public class RunningThread001 extends MonitoringTestBase implements RunParamsAware, ScenarioTypeAware {
+        private RunParams runParams;
+        private ThreadMXBean thread;
+        private int threadCount;
+        private ThreadMonitoringScenarioFactory scenarioFactory;
+        private String scenarioType;
+        private int iterations;
+        private int maxDepth = 200;
+
+        private void runOne() {
+                ThreadMonitoringScenario scenario = scenarioFactory.createScenario(scenarioType);
+                try {
+                        log.info("Starting: " + scenario);
+                        scenario.begin();
+                        scenario.waitState();
+                        log.info("State reached");
+                        log.info("Checking: " + scenario);
+                        scenario.check(thread);
+                } finally {
+                        log.info("Finishing: " + scenario);
+                        scenarioFactory.finish();
+                        scenario.finish();
+                        log.info("Ending: " + scenario);
+                        scenario.end();
+                }
+
+        }
+
+        public void run() {
+                thread = monitoringFactory.getThreadMXBean();
+                scenarioFactory = new StandardThreadMonitoringScenarioFactory(log, maxDepth, runParams.getMediumLoadThreadsCount());
+                iterations = argHandler.getIterations();
+                for (int i = 0; i < iterations; ++i)
+                        runOne();
+                log.info("TEST PASSED");
+        }
+
+        public void setRunParams(RunParams runParams) {
+                this.runParams = runParams;
+        }
+
+        public void setScenarioType(String scenarioType) {
+                this.scenarioType = scenarioType;
+        }
+
+        public static void main(String[] args) {
+                Monitoring.runTest(new RunningThread001(), args);
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/RunningThread/RunningThread002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/RunningThread/RunningThread002.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6, jdk_desktop]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=running
+ *      -testMode=server
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/RunningThread/RunningThread003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/RunningThread/RunningThread003.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6, jdk_desktop]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=running
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/RunningThread/RunningThread004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/RunningThread/RunningThread004.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6, jdk_desktop]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=running
+ *      -testMode=proxy
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/RunningThread/RunningThread005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/RunningThread/RunningThread005.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6, jdk_desktop]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=running
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/SleepingThread/SleepingThread001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/SleepingThread/SleepingThread001.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=sleeping
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/SleepingThread/SleepingThread002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/SleepingThread/SleepingThread002.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6, jdk_desktop]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=sleeping
+ *      -testMode=server
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/SleepingThread/SleepingThread003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/SleepingThread/SleepingThread003.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6, jdk_desktop]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=sleeping
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/SleepingThread/SleepingThread004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/SleepingThread/SleepingThread004.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6, jdk_desktop]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=sleeping
+ *      -testMode=proxy
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/SleepingThread/SleepingThread005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/SleepingThread/SleepingThread005.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6, jdk_desktop]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=sleeping
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/SynchronizerLockingThreads/SynchronizerLockingThreads001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/SynchronizerLockingThreads/SynchronizerLockingThreads001.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=synchronizerLockingThreads
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/SynchronizerLockingThreads/SynchronizerLockingThreads002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/SynchronizerLockingThreads/SynchronizerLockingThreads002.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6, jdk_desktop]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=synchronizerLockingThreads
+ *      -testMode=server
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/SynchronizerLockingThreads/SynchronizerLockingThreads003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/SynchronizerLockingThreads/SynchronizerLockingThreads003.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6, jdk_desktop]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=synchronizerLockingThreads
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/SynchronizerLockingThreads/SynchronizerLockingThreads004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/SynchronizerLockingThreads/SynchronizerLockingThreads004.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6, jdk_desktop]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=synchronizerLockingThreads
+ *      -testMode=proxy
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/SynchronizerLockingThreads/SynchronizerLockingThreads005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/SynchronizerLockingThreads/SynchronizerLockingThreads005.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6, jdk_desktop]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=synchronizerLockingThreads
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/TimedWaitingThread/TimedWaitingThread001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/TimedWaitingThread/TimedWaitingThread001.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=timedWaiting
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/TimedWaitingThread/TimedWaitingThread002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/TimedWaitingThread/TimedWaitingThread002.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6, jdk_desktop]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=timedWaiting
+ *      -testMode=server
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/TimedWaitingThread/TimedWaitingThread003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/TimedWaitingThread/TimedWaitingThread003.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6, jdk_desktop]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=timedWaiting
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/TimedWaitingThread/TimedWaitingThread004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/TimedWaitingThread/TimedWaitingThread004.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6, jdk_desktop]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=timedWaiting
+ *      -testMode=proxy
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/TimedWaitingThread/TimedWaitingThread005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/TimedWaitingThread/TimedWaitingThread005.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6, jdk_desktop]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=timedWaiting
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/WaitingThread/WaitingThread001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/WaitingThread/WaitingThread001.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=waiting
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/WaitingThread/WaitingThread002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/WaitingThread/WaitingThread002.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6, jdk_desktop]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=waiting
+ *      -testMode=server
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/WaitingThread/WaitingThread003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/WaitingThread/WaitingThread003.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6, jdk_desktop]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=waiting
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/WaitingThread/WaitingThread004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/WaitingThread/WaitingThread004.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6, jdk_desktop]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=waiting
+ *      -testMode=proxy
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/WaitingThread/WaitingThread005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/ThreadInfo/WaitingThread/WaitingThread005.
+ * VM Testbase keywords: [quick, monitoring, feature_136, vm6, jdk_desktop]
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMXBean.ThreadInfo.RunningThread.RunningThread001.RunningThread001
+ *      -scenarioType=waiting
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/ThreadMXBeanTestBase.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,154 @@
+/*
+ * Copyright (c) 2011, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.ThreadMXBean;
+
+import java.util.*;
+import nsk.share.test.*;
+import nsk.monitoring.share.*;
+import nsk.share.gc.Memory;
+
+public abstract class ThreadMXBeanTestBase extends MonitoringTestBase
+        implements Initializable {
+
+    /**
+     * Maximum allocation object size. about 2 Mb
+     */
+    private static final int MAX_OBJECT_SIZE = 2*1024*1024;
+    /**
+     * Allocations count for each MXBeanTestThread
+     */
+    private static final int ALLOCATIONS = 100;
+    /**
+     * Minimum size of allocated objects for a single thread stressing GC: 1Mb
+     */
+    protected static final int MIN_STRESS_ALLOCATION_AMOUNT = 1024*1024;
+    /**
+     * Percent of maximum difference of actual result from expected one
+     */
+    protected static final int DELTA_PERCENT = 15;
+    /**
+     * java.util.Random instance for allocArr filling
+     */
+    private final java.util.Random random = new java.util.Random();
+
+    /**
+     * Instance of com.sun.management.ThreadMXBean used by all tests
+     * Obtained in initialize() method
+     */
+    protected com.sun.management.ThreadMXBean threadMXBean;
+    /**
+     * Stresser class instance used in StressTest
+     */
+    protected Stresser stresser;
+    /**
+     * String indicating the GarbageProducer type used in test
+     */
+    protected String garbageProducerId;
+    /**
+     * Defined array with allocation objects sizes
+     */
+    protected static int[] allocArr = new int[ALLOCATIONS];
+
+    /**
+     * Obtains instance of com.sun.management.ThreadMXBean
+     * and stores it in threadMXBean field
+     * If com.sun.management.ThreadMXBean API is not available,
+     * threadMXBean is set to null and appropriate message is
+     * prompted
+     */
+    public void initialize() {
+        if (monitoringFactory.hasThreadMXBeanNew()) {
+            threadMXBean =
+                    (com.sun.management.ThreadMXBean) monitoringFactory.getThreadMXBeanNew();
+            for (int i = 0; i < ALLOCATIONS; i++) {
+                allocArr[i] = Memory.getArrayExtraSize() + Memory.getIntSize()
+                        + Memory.getReferenceSize() // don't be zero-length
+                        + random.nextInt(MAX_OBJECT_SIZE);
+            }
+        } else {
+            log.info("com.sun.management.ThreadMXBean API is not available!");
+        }
+    }
+
+    /**
+     * Obtains instance of Stresser and stores it in stresser field
+     * @param args Stresser arguments
+     */
+    public void setStresser(String[] args) {
+        if (stresser == null)
+            stresser = new Stresser(args);
+    }
+
+    /**
+     * Parses input String arrays searching for GarbageProducer
+     * settings. If found, sets garbageProducerID filed.
+     * @param args input arguments
+     * @return input arguments without GarbageProducer options
+     */
+    public String[] setGarbageProducer(String[] args) {
+        if (garbageProducerId == null) {
+            ArrayList<String> list = new ArrayList<String>();
+            for (int i = 0; i < args.length; i++) {
+                if (args[i].equals("-gp")) {
+                    garbageProducerId = args[++i];
+                } else {
+                    list.add(args[i]);
+                }
+            }
+            return list.toArray(new String[] {});
+        } else {
+            return args;
+        }
+    }
+
+    /**
+     * Starts all specified TestThread threads
+     * @param threads threads to start
+     */
+    public BarrierHandler startThreads(MXBeanTestThread... threads) {
+        BarrierHandler handler = new BarrierHandler(threads);
+        for (MXBeanTestThread thread : threads) {
+            thread.setHandler(handler);
+            thread.start();
+        }
+        handler.start();
+        return handler;
+    }
+
+    /**
+     * Returns expected memory size allocated by MXBeanTestThreads during
+     * stress test (allocateStress() method execution)
+     *
+     * @param array of MXBeanTestThreads
+     * @return expected amount of memory allocated by each StressTestThread
+     */
+    public long[] getStressAllocatedBytes(MXBeanTestThread... threads) {
+        long[] result = new long[threads.length];
+        int counter = 0;
+        for (MXBeanTestThread thread : threads) {
+            result[counter++] = thread.getStressAllocatedBytes();
+        }
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/findMonitorDeadlockedThreads/find001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/findMonitorDeadlockedThreads/find001.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         ThreadMBean.findMonitorDeadlockedThreads()
+ *     does not return the id of the currect thread, since it is not deadlocked.
+ *     The test implements direct access to the metrics.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.ThreadMBean.findMonitorDeadlockedThreads.find001
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/findMonitorDeadlockedThreads/find002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/findMonitorDeadlockedThreads/find002.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         ThreadMBean.findMonitorDeadlockedThreads()
+ *     does not return the id of the currect thread, since it is not deadlocked.
+ *     The test implements access to the metrics via default MBean server.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMBean.findMonitorDeadlockedThreads.find001
+ *      -testMode=server
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/findMonitorDeadlockedThreads/find003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/findMonitorDeadlockedThreads/find003.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         ThreadMBean.findMonitorDeadlockedThreads()
+ *     does not return the id of the currect thread, since it is not deadlocked.
+ *     The test implements access to the metrics via custom MBean server.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMBean.findMonitorDeadlockedThreads.find001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/findMonitorDeadlockedThreads/find004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/findMonitorDeadlockedThreads/find004.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         ThreadMBean.findMonitorDeadlockedThreads()
+ *     does not return the id of the currect thread, since it is not deadlocked.
+ *     The test implements access to the metrics via default MBean server proxy.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.ThreadMBean.findMonitorDeadlockedThreads.find001 -testMode=proxy
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/findMonitorDeadlockedThreads/find005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/findMonitorDeadlockedThreads/find005.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         ThreadMBean.findMonitorDeadlockedThreads()
+ *     does not return the id of the currect thread, since it is not deadlocked.
+ *     The test implements access to the metrics via custom MBean server proxy.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMBean.findMonitorDeadlockedThreads.find001
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/findMonitorDeadlockedThreads/find006.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.ThreadMXBean.findMonitorDeadlockedThreads;
+
+import java.lang.management.*;
+import java.io.*;
+import nsk.share.*;
+import nsk.monitoring.share.*;
+
+public class find006 {
+    private static Wicket mainEntrance = new Wicket();
+    private static boolean testFailed = false;
+
+    public static void main(String[] argv) {
+        System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
+    }
+
+    public static int run(String[] argv, PrintStream out) {
+        ArgumentHandler argHandler = new ArgumentHandler(argv);
+        Log log = new Log(out, argHandler);
+        ThreadMonitor monitor = Monitor.getThreadMonitor(log, argHandler);
+        long id = Thread.currentThread().getId();
+        long[] ids = monitor.findMonitorDeadlockedThreads();
+
+        if (ids == null) {
+            log.display("findCircularBlockedThread() returned null");
+        } else if (ids.length == 0) {
+            log.display("findCircularBlockedThread() returned array of length "
+                      + "0");
+        } else {
+            for (int i = 0; i < ids.length; i++) {
+                if (ids[i] == id) {
+                    log.complain("TEST FAILED");
+                    log.complain("findCircularBlockedThread() returned current "
+                               + "thread (id = " + id + ")");
+                    testFailed = true;
+                    break;
+                }
+            }
+        }
+
+        ThreadMXBean mbean = ManagementFactory.getThreadMXBean();
+        MyThread thread = new MyThread(out);
+        thread.start();
+
+        // Wait for MyThread to start
+        mainEntrance.waitFor();
+        id = thread.getId();
+
+        thread.die = true;
+
+        int count = 0;
+        while (true) {
+            ids = monitor.findMonitorDeadlockedThreads();
+            count++;
+            ThreadInfo info = mbean.getThreadInfo(id, Integer.MAX_VALUE);
+            if (info == null) {
+                // the thread has exited
+                break;
+            }
+        }
+
+        out.println("INFO: made " + count + " late findMonitorDeadlockedThreads() calls.");
+
+        return (testFailed) ? Consts.TEST_FAILED : Consts.TEST_PASSED;
+    }
+
+    private static class MyThread extends Thread {
+        final static long WAIT_TIME = 500; // Milliseconds
+        Object object = new Object();
+        volatile boolean die = false;
+        PrintStream out;
+
+        MyThread(PrintStream out) {
+            this.out = out;
+        }
+
+        public void run() {
+
+            // Notify "main" thread that MyThread has started
+            mainEntrance.unlock();
+
+            while (!die) {
+                synchronized(object) {
+                    try {
+                        object.wait(WAIT_TIME);
+                    } catch (InterruptedException e) {
+                        out.println("Unexpected exception.");
+                        e.printStackTrace(out);
+                        testFailed = true;
+                    }
+                } // synchronized
+            }
+        } // run()
+    } // MyThread
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/findMonitorDeadlockedThreads/find006/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/findMonitorDeadlockedThreads/find006.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     Same test as find001 with additional calls to
+ *     findMonitorDeadlockedThreads() while a thread is exiting.
+ * COMMENT
+ *     Derived from nsk/monitoring/ThreadMXBean/findMonitorDeadlockedThreads/find001.
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -Xlog:thread+smr=debug
+ *      nsk.monitoring.ThreadMXBean.findMonitorDeadlockedThreads.find006
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/isCurrentThreadCpuTimeSupported/curthcputime001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/isCurrentThreadCpuTimeSupported/curthcputime001.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         ThreadMBean.isCurrentThreadCpuTimeSupported()
+ *     method returns true. The test performs directly access to management
+ *     metrics within the same JVM.
+ *     Note, that the test is correct ONLY against Sun's Hotspot VM. This
+ *     feature is optional and the method may return either true, or false.
+ *     However, Sun's implementation must always return true.
+ * COMMENTS
+ *     Fixed the bug:
+ *     4953476 TEST_BUG: The spec is updated accoring to 4944573 and 4947536
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.ThreadMBean.isCurrentThreadCpuTimeSupported.curthcputime001
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/isCurrentThreadCpuTimeSupported/curthcputime002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/isCurrentThreadCpuTimeSupported/curthcputime002.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         ThreadMBean.isCurrentThreadCpuTimeSupported()
+ *     method returns true. The test performs access to management metrics
+ *     through default MBeanServer.
+ *     Note, that the test is correct ONLY against Sun's Hotspot VM. This
+ *     feature is optional and the method may return either true, or false.
+ *     However, Sun's implementation must always return true.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMBean.isCurrentThreadCpuTimeSupported.curthcputime001
+ *      -testMode=server
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/isCurrentThreadCpuTimeSupported/curthcputime003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/isCurrentThreadCpuTimeSupported/curthcputime003.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         ThreadMBean.isCurrentThreadCpuTimeSupported()
+ *     method returns true. The test performs access to management metrics
+ *     through custom MBeanServer (developed and saved in
+ *     $TESTBASE/src/nsk/monitoring/share).
+ *     Note, that the test is correct ONLY against Sun's Hotspot VM. This
+ *     feature is optional and the method may return either true, or false.
+ *     However, Sun's implementation must always return true.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMBean.isCurrentThreadCpuTimeSupported.curthcputime001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/isCurrentThreadCpuTimeSupported/curthcputime004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/isCurrentThreadCpuTimeSupported/curthcputime004.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         ThreadMBean.isCurrentThreadCpuTimeSupported()
+ *     method returns true. The test performs access to management metrics
+ *     through default MBeanServer proxy.
+ *     Note, that the test is correct ONLY against Sun's Hotspot VM. This
+ *     feature is optional and the method may return either true, or false.
+ *     However, Sun's implementation must always return true.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMBean.isCurrentThreadCpuTimeSupported.curthcputime001
+ *      -testMode=proxy
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/isCurrentThreadCpuTimeSupported/curthcputime005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/isCurrentThreadCpuTimeSupported/curthcputime005.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         ThreadMBean.isCurrentThreadCpuTimeSupported()
+ *     method returns true. The test performs access to management metrics
+ *     through custom MBeanServer proxy (developed and saved in
+ *     $TESTBASE/src/nsk/monitoring/share).
+ *     Note, that the test is correct ONLY against Sun's Hotspot VM. This
+ *     feature is optional and the method may return either true, or false.
+ *     However, Sun's implementation must always return true.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMBean.isCurrentThreadCpuTimeSupported.curthcputime001
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/isThreadContentionMonitoringSupported/thcontmonitor001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/isThreadContentionMonitoringSupported/thcontmonitor001.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         ThreadMBean.isThreadContentionMonitoringSupported()
+ *     method returns true. The test performs directly access to management
+ *     metrics within the same JVM.
+ *     Note, that the test is correct ONLY against Sun's Hotspot VM. This
+ *     feature is optional and the method may return either true, or false.
+ *     However, Sun's implementation must always return true.
+ * COMMENTS
+ *     Fixed the bug:
+ *     4953476 TEST_BUG: The spec is updated accoring to 4944573 and 4947536
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMBean.isThreadContentionMonitoringSupported.thcontmonitor001
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/isThreadContentionMonitoringSupported/thcontmonitor002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/isThreadContentionMonitoringSupported/thcontmonitor002.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         ThreadMBean.isThreadContentionMonitoringSupported()
+ *     method returns true. The test performs access to management metrics
+ *     through default MBeanServer.
+ *     Note, that the test is correct ONLY against Sun's Hotspot VM. This
+ *     feature is optional and the method may return either true, or false.
+ *     However, Sun's implementation must always return true.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMBean.isThreadContentionMonitoringSupported.thcontmonitor001
+ *      -testMode=server
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/isThreadContentionMonitoringSupported/thcontmonitor003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/isThreadContentionMonitoringSupported/thcontmonitor003.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         ThreadMBean.isThreadContentionMonitoringSupported()
+ *     method returns true. The test performs access to management metrics
+ *     through custom MBeanServer (developed and saved in
+ *     $TESTBASE/src/nsk/monitoring/share).
+ *     Note, that the test is correct ONLY against Sun's Hotspot VM. This
+ *     feature is optional and the method may return either true, or false.
+ *     However, Sun's implementation must always return true.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMBean.isThreadContentionMonitoringSupported.thcontmonitor001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/isThreadContentionMonitoringSupported/thcontmonitor004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/isThreadContentionMonitoringSupported/thcontmonitor004.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         ThreadMBean.isThreadContentionMonitoringSupported()
+ *     method returns true. The test performs access to management metrics
+ *     through default MBeanServer proxy.
+ *     Note, that the test is correct ONLY against Sun's Hotspot VM. This
+ *     feature is optional and the method may return either true, or false.
+ *     However, Sun's implementation must always return true.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMBean.isThreadContentionMonitoringSupported.thcontmonitor001
+ *      -testMode=proxy
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/isThreadContentionMonitoringSupported/thcontmonitor005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/isThreadContentionMonitoringSupported/thcontmonitor005.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         ThreadMBean.isThreadContentionMonitoringSupported()
+ *     method returns true. The test performs access to management metrics
+ *     through custom MBeanServer proxy (developed and saved in
+ *     $TESTBASE/src/nsk/monitoring/share).
+ *     Note, that the test is correct ONLY against Sun's Hotspot VM. This
+ *     feature is optional and the method may return either true, or false.
+ *     However, Sun's implementation must always return true.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMBean.isThreadContentionMonitoringSupported.thcontmonitor001
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/isThreadCpuTimeSupported/thcputime001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/isThreadCpuTimeSupported/thcputime001.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         ThreadMBean.isThreadCpuTimeSupported()
+ *     method returns true. The test performs directly access to management
+ *     metrics within the same JVM.
+ *     Note, that the test is correct ONLY against Sun's Hotspot VM. This
+ *     feature is optional and the method may return either true, or false.
+ *     However, Sun's implementation must always return true.
+ * COMMENTS
+ *     Fixed the bug:
+ *     4953476 TEST_BUG: The spec is updated accoring to 4944573 and 4947536
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.ThreadMBean.isThreadCpuTimeSupported.thcputime001
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/isThreadCpuTimeSupported/thcputime002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/isThreadCpuTimeSupported/thcputime002.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         ThreadMBean.isThreadCpuTimeSupported()
+ *     method returns true. The test performs access to management metrics
+ *     through default MBeanServer.
+ *     Note, that the test is correct ONLY against Sun's Hotspot VM. This
+ *     feature is optional and the method may return either true, or false.
+ *     However, Sun's implementation must always return true.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMBean.isThreadCpuTimeSupported.thcputime001
+ *      -testMode=server
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/isThreadCpuTimeSupported/thcputime003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/isThreadCpuTimeSupported/thcputime003.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         ThreadMBean.isThreadCpuTimeSupported()
+ *     method returns true. The test performs access to management metrics
+ *     through custom MBeanServer (developed and saved in
+ *     $TESTBASE/src/nsk/monitoring/share).
+ *     Note, that the test is correct ONLY against Sun's Hotspot VM. This
+ *     feature is optional and the method may return either true, or false.
+ *     However, Sun's implementation must always return true.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMBean.isThreadCpuTimeSupported.thcputime001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/isThreadCpuTimeSupported/thcputime004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/isThreadCpuTimeSupported/thcputime004.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         ThreadMBean.isThreadCpuTimeSupported()
+ *     method returns true. The test performs access to management metrics
+ *     through default MBeanServer proxy.
+ *     Note, that the test is correct ONLY against Sun's Hotspot VM. This
+ *     feature is optional and the method may return either true, or false.
+ *     However, Sun's implementation must always return true.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMBean.isThreadCpuTimeSupported.thcputime001
+ *      -testMode=proxy
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/isThreadCpuTimeSupported/thcputime005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/isThreadCpuTimeSupported/thcputime005.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         ThreadMBean.isThreadCpuTimeSupported()
+ *     method returns true. The test performs access to management metrics
+ *     through custom MBeanServer proxy (developed and saved in
+ *     $TESTBASE/src/nsk/monitoring/share).
+ *     Note, that the test is correct ONLY against Sun's Hotspot VM. This
+ *     feature is optional and the method may return either true, or false.
+ *     However, Sun's implementation must always return true.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMBean.isThreadCpuTimeSupported.thcputime001
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/resetPeakThreadCount/reset001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/resetPeakThreadCount/reset001.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         ThreadMBean.resetPeakThreadCount()
+ *     returns correct result.
+ *     The test starts a couple of user threads and waits until they finish. After
+ *     that, resetPeakThreadCount() is invoked to reset the peak. Then
+ *     getPeakThreadCount() and getThreadCount() must return the same values. The
+ *     preposition is that no threads are appered/disappeared between
+ *     "getPeakThreadCount()" and getThreadCount()" calls.
+ *     The test implements direct access to the metrics.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.ThreadMBean.resetPeakThreadCount.reset001
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/resetPeakThreadCount/reset002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/resetPeakThreadCount/reset002.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         ThreadMBean.resetPeakThreadCount()
+ *     returns correct result.
+ *     The test starts a couple of user threads and waits until they finish. After
+ *     that, resetPeakThreadCount() is invoked to reset the peak. Then
+ *     getPeakThreadCount() and getThreadCount() must return the same values. The
+ *     preposition is that no threads are appered/disappeared between
+ *     "getPeakThreadCount()" and getThreadCount()" calls.
+ *     The test implements access to the metrics via default MBean server.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.ThreadMBean.resetPeakThreadCount.reset001 -testMode=server
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/resetPeakThreadCount/reset003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/resetPeakThreadCount/reset003.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         ThreadMBean.resetPeakThreadCount()
+ *     returns correct result.
+ *     The test starts a couple of user threads and waits until they finish. After
+ *     that, resetPeakThreadCount() is invoked to reset the peak. Then
+ *     getPeakThreadCount() and getThreadCount() must return the same values. The
+ *     preposition is that no threads are appered/disappeared between
+ *     "getPeakThreadCount()" and getThreadCount()" calls.
+ *     The test implements access to the metrics via custom MBean server.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMBean.resetPeakThreadCount.reset001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/resetPeakThreadCount/reset004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/resetPeakThreadCount/reset004.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         ThreadMBean.resetPeakThreadCount()
+ *     returns correct result.
+ *     The test starts a couple of user threads and waits until they finish. After
+ *     that, resetPeakThreadCount() is invoked to reset the peak. Then
+ *     getPeakThreadCount() and getThreadCount() must return the same values. The
+ *     preposition is that no threads are appered/disappeared between
+ *     "getPeakThreadCount()" and getThreadCount()" calls.
+ *     The test implements access to the metrics via default MBean server proxy.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.ThreadMBean.resetPeakThreadCount.reset001 -testMode=proxy
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/ThreadMXBean/resetPeakThreadCount/reset005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/monitoring/ThreadMXBean/resetPeakThreadCount/reset005.
+ * VM Testbase keywords: [quick, monitoring]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that
+ *         ThreadMBean.resetPeakThreadCount()
+ *     returns correct result.
+ *     The test starts a couple of user threads and waits until they finish. After
+ *     that, resetPeakThreadCount() is invoked to reset the peak. Then
+ *     getPeakThreadCount() and getThreadCount() must return the same values. The
+ *     preposition is that no threads are appered/disappeared between
+ *     "getPeakThreadCount()" and getThreadCount()" calls.
+ *     The test implements access to the metrics via custom MBean server proxy.
+ * COMMENT
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.ThreadMBean.resetPeakThreadCount.reset001
+ *      -testMode=proxy
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/ArgumentHandler.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,507 @@
+/*
+ * Copyright (c) 2003, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share;
+
+import nsk.share.log.Log;
+import nsk.share.TestBug;
+import nsk.share.ArgumentParser;
+import java.lang.management.*;
+
+/**
+ * Parser for JSR-174 test's arguments.
+ * <p>
+ * <code>ArgumentHandler</code> handles specific command line arguments
+ * related to way of execution of a test in addition to general arguments
+ * recognized by {@link ArgumentParser <code>ArgumentParser</code>}.
+ * <p>
+ * Following is the list of specific options for <code>ArgumentHandler</code>:
+ * <ul>
+ * <li><code>-testMode="<i>value</i>"</code>, where <i>value</i> may take
+ *      one of the following values: <code>directly</code> -- to call methods in
+ *      the MBean directly within the same JVM, <code>server</code> -- to call
+ *      methods through MBeanServer, <code>proxy</code> -- to call methods
+ *      through MBean proxy (not yet implemented).
+ * <li><code>-MBeanServer="<i>value</i>"</code>, where <i>value</i> may take
+ *      one of the following values: <code>default</code> -- to execute test for
+ *      default JMX implementation of MBeanServer or <code>custom</code> -- for
+ *      implementation provided by NSK J2SE SQE Team.
+ * <li><code>-loadableClassCount=<i>value</i></code>, where <i>value</i> defines
+ *      amount of loadable classes. Default values is <code>100</code>.
+ * <li><code>-loadersCount=<i>value</i></code>, where <i>value</i> defines
+ *      amount of class loaders. Default values is <code>100</code>.
+ * <li><code>-singleClassloaderClass</code> specifies whether class loaders are
+ *      instances of the same class.
+ * <li><code>-memory="<i>value</i>"</code>, where <i>value</i> may take
+ *      one of the following values: <code>heap</code> -- to test heap memory,
+ *      <code>nonheap</code> to test nonheap memory, <code>mixed</code> -- to
+ *      test both heap and nonheap memory.
+ * <li><code>-invocationType="<i>value</i>"</code>, where <i>value</i> may take
+ *      one of the following values: <code>java</code> -- to start java threads,
+ *      <code>native</code> -- to start native threads, <code>mixed</code> -- to
+ *      both java and native threads.
+ * <li><code>-monitoring="<i>value</i>"</code>, where <i>value</i> may take
+ *      one of the following values: <code>polling</code> -- to start polling
+ *      mechanism of monitoring, <code>notification</code> -- to start
+ *      notification mechanism of monitoring.
+ * <li><code>-threshold="<i>value</i>"</code>, where <i>value</i> may take
+ *      one of the following values: <code>usage</code> -- to test usage
+ *      thresholds, <code>collection</code> -- to test collection usage
+ *      thresholds.
+ * <li><code>-depth=<i>value</i></code>, where <i>value</i> defines
+ *      depth of recursion. Default values is <code>1</code>.
+ * <li><code>-threadCount=<i>value</i></code>, where <i>value</i> defines
+ *      number of threads to start. Default values is <code>1</code>.
+ * <li><code>-timeout=<i>value</i></code>, where <i>value</i> defines
+ *      number of minutes to run the test.
+ * </ul>
+ * <p>
+ * See also list of basic options recognized by <code>ArgumentParser</code>.
+ * <p>
+ * See also comments to <code>ArgumentParser</code> how to work with
+ * command line arguments and options.
+ *
+ * @see ArgumentParser
+ */
+public class ArgumentHandler extends ArgumentParser {
+    static final String TEST_MODE = "testMode";
+    static final String DIRECTLY_MODE = "directly";
+    static final String SERVER_MODE = "server";
+    static final String PROXY_MODE = "proxy";
+
+    static final String SERVER_TYPE = "MBeanServer";
+    static final String DEFAULT_TYPE = "default";
+    static final String CUSTOM_TYPE = "custom";
+
+    static final String LOADABLE_CLASSES_COUNT = "loadableClassCount";
+    static final String LOADERS_COUNT = "loadersCount";
+    static final String SINGLE_CLASSLOADER_CLASS = "singleClassloaderClass";
+
+    static final String MEMORY_TYPE = "memory";
+    static final String MT_HEAP = "heap";
+    static final String MT_NONHEAP = "nonheap";
+    static final String MT_MIXED = "mixed";
+
+    static final String INVOCATION_TYPE = "invocationType";
+    static final String JAVA_TYPE = "java";
+    static final String NATIVE_TYPE = "native";
+    static final String MIXED_TYPE = "mixed";
+
+    static final String MONITORING = "monitoring";
+    static final String MON_POLLING = "polling";
+    static final String MON_NOTIF = "notification";
+
+    static final String THRESHOLD = "threshold";
+    static final String TH_USAGE = "usage";
+    static final String TH_COLLECTION = "collection";
+
+    static final String THREAD_DEPTH = "depth";
+    static final String THREAD_COUNT = "threadCount";
+    static final String TIMEOUT = "timeout";
+
+    static final String SCENARIO_TYPE = "scenarioType";
+
+    static final String ITERATIONS = "iterations";
+
+    /**
+     * Keep a copy of raw command-line arguments and parse them;
+     * but throw an exception on parsing error.
+     *
+     * @param  args  Array of the raw command-line arguments.
+     *
+     * @throws  BadOption  If unknown option or illegal
+     *                     option value found
+     *
+     * @see ArgumentParser
+     */
+    public ArgumentHandler(String args[]) {
+        super(args);
+    }
+
+    /**
+     * Returns the test mode.
+     * <p>
+     * To access the metrics directly, <code>testMode</code> option should
+     * be defined in command line <code>-testMode="directly"</code>.
+     * To access the metrics via MBeanServer, <code>"server"</code> should be
+     * assigned to <code>-testMode="directly"</code>.
+     * <p>
+     * If <code>testMode</code> is not defined by command line, a test is
+     * executed in <code>directly</code> mode.
+     *
+     * @return name of test mode.
+     *
+     */
+    public String getTestMode() {
+        return options.getProperty(TEST_MODE, DIRECTLY_MODE);
+    }
+
+    /**
+     * Returns a type of MBean server if any.
+     * Two kinds of MBean servers are allowed: default and custom servers.
+     * Default server is an implementation of {@link
+     * javax.management.MBeanServer <tt>javax.management.MBeanServer</tt>}
+     * interface provided by JMX. Custom server is an implementation provided
+     * by NSK J2SE SQE Team. Server type is defined by <tt>MBeanServer</tt>
+     * key in command line <code>-MBeanServer="default"</code> or
+     * <code>-MBeanServer="custom"</code>
+     *
+     * @return <i>MBeanServer</i> server type.
+     *
+     */
+    public String getServerType() {
+        return options.getProperty(SERVER_TYPE, DEFAULT_TYPE);
+    }
+
+    /**
+     * Returns <i>true</i> if default implementation is used.
+     *
+     * @return <i>true</i> if default implementation is used.
+     *
+     * @see #getServerType()
+     */
+    public boolean isDefaultServer() {
+        return getServerType().equals(DEFAULT_TYPE);
+    }
+
+    /**
+     * Returns amount of class loaders.
+     *
+     * @return <i>loadersCount</i> as an integer value
+     */
+    public int getLoadersCount() {
+        String val = options.getProperty(LOADERS_COUNT, "100");
+        int number;
+        try {
+            number = Integer.parseInt(val);
+        } catch (NumberFormatException e) {
+            throw new TestBug("Not integer value of \"" + LOADERS_COUNT
+                                    + "\" argument: " + val);
+        }
+        return number;
+    }
+
+    /**
+     * Returns <i>true</i> if class loaders, which perform class loading, are
+     * instances of the same class. If <code>-singleClassloaderClass</code> key
+     * is not set in command line options, then <i>false</i> is returned.
+     *
+     * @return if class loaders are instances of the same class.
+     *
+     */
+    public boolean singleClassloaderClass() {
+        return options.getProperty(SINGLE_CLASSLOADER_CLASS) != null;
+    }
+
+    /**
+     * Returns amount of loadable classes. If <code>-loadableClassesCount</code>
+     * key is not set with command line, <code>100</code> is returned.
+     *
+     * @return <i>loadableClassesCount</i> as an integer value
+     *
+     * @throws TestBug <i>loadableClassesCount</i> is non-numeric value.
+     *
+     */
+    public int getLoadableClassesCount() {
+        String val = options.getProperty(LOADABLE_CLASSES_COUNT, "1");
+        int number;
+        try {
+            number = Integer.parseInt(val);
+        } catch (NumberFormatException e) {
+            throw new TestBug("Not integer value of \"" + LOADABLE_CLASSES_COUNT
+                                    + "\" argument: " + val);
+        }
+        return number;
+    }
+
+    /**
+     * Returns invocation type.
+     *
+     * @return <i>invocationType</i> value
+     *
+     */
+    public String getInvocationType() {
+        return options.getProperty(INVOCATION_TYPE, JAVA_TYPE);
+    }
+
+    /**
+     * Returns tested memory type.
+     *
+     * @return <i>memory</i> value
+     *
+     */
+    public String getTestedMemory() {
+        return options.getProperty(MEMORY_TYPE, MT_HEAP);
+    }
+
+    /**
+     * Returns timeout.
+     *
+     * @return <i>timeout</i> value
+     *
+     */
+    public int getTimeout() {
+        String value = options.getProperty(TIMEOUT, "30");
+
+        try {
+            return Integer.parseInt(value);
+        } catch (NumberFormatException e) {
+            throw new TestBug("Not integer value of \"" + TIMEOUT
+                            + "\" argument: " + value);
+        }
+    }
+
+    /**
+     * Returns recursion depth.
+     *
+     * @return <i>depth</i> value
+     *
+     */
+    public int getThreadDepth() {
+        String value = options.getProperty(THREAD_DEPTH, "1");
+
+        try {
+            return Integer.parseInt(value);
+        } catch (NumberFormatException e) {
+            throw new TestBug("Not integer value of \"" + THREAD_DEPTH
+                            + "\" argument: " + value);
+        }
+    }
+
+    /**
+     * Returns number of threads.
+     *
+     * @return <i>threadCount</i> value
+     *
+     */
+    public int getThreadCount() {
+        String value = options.getProperty(THREAD_COUNT, "1");
+
+        try {
+            return Integer.parseInt(value);
+        } catch (NumberFormatException e) {
+            throw new TestBug("Not integer value of \"" + THREAD_COUNT
+                            + "\" argument: " + value);
+        }
+    }
+
+    /**
+     * Returns type of monitoring.
+     *
+     * @return <i>monitoring</i> value
+     *
+     */
+    public String getMonitoring() {
+        return options.getProperty(MONITORING, MON_NOTIF);
+    }
+
+    /**
+     * Returns type of threshold.
+     *
+     * @return <i>threshold</i> value
+     *
+     */
+    public String getThreshold() {
+        return options.getProperty(THRESHOLD, TH_USAGE);
+    }
+
+    /**
+     * Returns thread type to create.
+     */
+    public String getScenarioType() {
+            return options.getProperty(SCENARIO_TYPE, "running");
+    }
+
+    public int getIterations() {
+            return Integer.parseInt(options.getProperty(ITERATIONS, "3"));
+    }
+
+    /**
+     * Checks if an option is allowed and has proper value.
+     * This method is invoked by <code>parseArguments()</code>
+     *
+     * @param option option name
+     * @param value string representation of value
+     *                      (could be an empty string too)
+     *              null if this option has no value
+     * @return <i>true</i> if option is allowed and has proper value
+     *         <i>false</i> if otion is not admissible
+     *
+     * @throws <i>BadOption</i> if option has an illegal value
+     *
+     * @see nsk.share.ArgumentParser#parseArguments
+     */
+    protected boolean checkOption(String option, String value) {
+
+        // defines directly, server or proxytest mode
+        if (option.equals(TEST_MODE)) {
+            if ( (!value.equals(DIRECTLY_MODE)) &&
+                 (!value.equals(SERVER_MODE)) &&
+                 (!value.equals(PROXY_MODE))
+               ) {
+                throw new BadOption(option + ": must be one of: "
+                                  + "\"" + DIRECTLY_MODE + "\", "
+                                  + "\"" + SERVER_MODE   + "\", "
+                                  + "\"" + PROXY_MODE    + "\"");
+            }
+            return true;
+        }
+
+        // defines invocation type for stack filling
+        if (option.equals(INVOCATION_TYPE)) {
+            if ( (!value.equals(JAVA_TYPE)) &&
+                 (!value.equals(NATIVE_TYPE)) &&
+                 (!value.equals(MIXED_TYPE))
+               ) {
+                throw new BadOption(option + ": must be one of: "
+                                  + "\"" + JAVA_TYPE + "\", "
+                                  + "\"" + NATIVE_TYPE + "\", "
+                                  + "\"" + MIXED_TYPE + "\"");
+            }
+            return true;
+        }
+
+        // defines default or custom MBean server
+        if (option.equals(SERVER_TYPE)) {
+            if ((!value.equals(DEFAULT_TYPE))
+                && (!value.equals(CUSTOM_TYPE))) {
+                throw new BadOption(option + ": must be one of: \""
+                                           + DEFAULT_TYPE + "\", \""
+                                           + CUSTOM_TYPE + "\"");
+            }
+
+            return true;
+        }
+
+        // defines loadable classes and loaders counts
+        if (option.equals(LOADABLE_CLASSES_COUNT) ||
+                option.equals(LOADERS_COUNT) ||
+                option.equals(THREAD_DEPTH) || option.equals(THREAD_COUNT)) {
+            try {
+                int number = Integer.parseInt(value);
+                if (number < 0) {
+                    throw new BadOption(option + ": value must be a positive "
+                                      + "integer");
+                }
+            } catch (NumberFormatException e) {
+                throw new BadOption(option + ": value must be an integer");
+            }
+            return true;
+        }
+
+        // defines timeout
+        if (option.equals(TIMEOUT)) {
+            try {
+                int number = Integer.parseInt(value);
+
+                if (number < 0)
+                    throw new BadOption(option + ": value must be a positive "
+                                      + "integer");
+            } catch (NumberFormatException e) {
+                throw new BadOption(option + ": value must be an integer");
+            }
+            return true;
+        }
+
+        // defines if classloader class is single
+        if (option.equals(SINGLE_CLASSLOADER_CLASS)) {
+            if (!(value == null || value.length() <= 0)) {
+                throw new BadOption(option + ": no value must be specified");
+            }
+            return true;
+        }
+
+        // defines memory types
+        if (option.equals(MEMORY_TYPE)) {
+            if ( (!value.equals(MT_HEAP)) &&
+                 (!value.equals(MT_NONHEAP)) &&
+                 (!value.equals(MT_MIXED))
+               )
+                throw new BadOption(option + ": must be one of: "
+                                  + "\"" + MT_HEAP + "\", "
+                                  + "\"" + MT_NONHEAP + "\", "
+                                  + "\"" + MT_MIXED + "\"");
+            return true;
+        }
+
+        // defines type of monitoring
+        if (option.equals(MONITORING)) {
+            if ( (!value.equals(MON_POLLING)) &&
+                 (!value.equals(MON_NOTIF))
+               )
+                throw new BadOption(option + ": must be one of: "
+                                  + "\"" + MON_POLLING + "\", "
+                                  + "\"" + MON_NOTIF + "\"");
+            return true;
+        }
+
+        // defines threshold
+        if (option.equals(THRESHOLD)) {
+            if ( (!value.equals(TH_USAGE)) &&
+                 (!value.equals(TH_COLLECTION))
+               )
+                throw new BadOption(option + ": must be one of: "
+                                  + "\"" + TH_USAGE + "\", "
+                                  + "\"" + TH_COLLECTION + "\"");
+            return true;
+        }
+
+        if (option.equals(SCENARIO_TYPE)) {
+                return true;
+        }
+        if (option.equals(ITERATIONS)) {
+            try {
+                int number = Integer.parseInt(value);
+
+                if (number < 0)
+                    throw new BadOption(option + ": value must be a positive "
+                                      + "integer");
+                return true;
+            } catch (NumberFormatException e) {
+                throw new BadOption(option + ": value must be an integer");
+            }
+
+        }
+        return super.checkOption(option, value);
+    }
+
+    /**
+     * Check if the values of all options are consistent.
+     * This method is invoked by <code>parseArguments()</code>
+     *
+     * @throws <i>BadOption</i> if options have inconsistent values
+     *
+     * @see nsk.share.ArgumentParser#parseArguments
+     */
+    protected void checkOptions() {
+        super.checkOptions();
+    }
+
+    public void dump(Log log) {
+            log.info("Test mode: " + getTestMode());
+            log.info("Server type: " + getServerType());
+            log.info("loadableClassesCount: " + getLoadableClassesCount());
+            log.info("loadersCount: " + getLoadersCount());
+            log.info("singleClassloaderClass: " + singleClassloaderClass());
+    }
+} // ArgumentHandler
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/ArgumentHandlerAware.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2005, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share;
+
+public interface ArgumentHandlerAware {
+        public void setArgumentHandler(ArgumentHandler argHandler);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/ClassLoadingController.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,291 @@
+/*
+ * Copyright (c) 2003, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share;
+
+import java.util.*;
+import nsk.share.log.Log;
+import nsk.share.ClassUnloader;
+import nsk.share.CustomClassLoader;
+import nsk.share.test.Stresser;
+
+/**
+ * The <code>ClassLoadingController</code> class allows to operate class
+ * loading/unloading process.
+ */
+public class ClassLoadingController extends StateControllerBase {
+        // Path and name of the classes to load
+        private static final String CLASSNAME_PATTERN = "nsk.monitoring.share.newclass.LoadableClass";
+
+        private int loadedClassCount = 100;
+        private int loaderCount = 1;
+        private boolean singleClass = true;
+        private String classDir;
+        private Hashtable<String, String[]> classesTable = new Hashtable<String, String[]>();
+        private ClassUnloader[] unloaders;
+
+        private Stresser stresser;
+
+        /**
+         * Constructs a new <code>ClassLoadingController</code> with defined
+         * arguments.
+         *
+         * @param log <code>Log</code> to print log info to.
+         * @param loadedClassCount number of classes to load.
+         * @param loaderCount number of loaders to use.
+         * @param singleClass if class loaders are instances of the same class.
+         * @param classDir directory to load classes from.
+         */
+        public ClassLoadingController(
+                Log log,
+                int loadedClassCount,
+                int loaderCount,
+                boolean singleClass,
+                String classDir,
+                Stresser stresser
+        ) {
+                super(log);
+                setLoadedClassCount(loadedClassCount);
+                setLoaderCount(loaderCount);
+                setClassDir(classDir);
+                singleClassLoaderClass(singleClass);
+                dump();
+                preloadAllClasses();
+                setStresser(stresser);
+        }
+
+    private void setStresser(Stresser stresser) {
+        this.stresser = stresser;
+    }
+
+    public ClassLoadingController(Log log, ArgumentHandler argHandler, Stresser stresser) {
+                this(
+                        log,
+                        argHandler.getLoadableClassesCount(),
+//                        argHandler.getLoadersCount(),
+                        (int)stresser.getMaxIterations(),
+                        argHandler.singleClassloaderClass(),
+                        argHandler.getRawArgument(0),
+                        stresser
+                );
+        }
+
+        public void dump() {
+                log.debug("classes to be loaded:\t" + loadedClassCount);
+                log.debug("classloader instances:\t" + loaderCount);
+                if (singleClass)
+                        log.debug("classloader class:\tsingle");
+                else
+                        log.debug("classloader class:\ttwo");
+                log.debug("Class dir" + classDir);
+
+        }
+
+        private void setLoadedClassCount(int loadedClassCount) {
+                this.loadedClassCount = loadedClassCount;
+        }
+
+        // Set loaderCount value
+        private void setLoaderCount(int loaderCount) {
+                this.loaderCount = loaderCount;
+        }
+
+        // Set singleClass value
+        private void singleClassLoaderClass(boolean singleClass) {
+                this.singleClass = singleClass;
+        }
+
+        // Set classDir value
+        private void setClassDir(String classDir) {
+                this.classDir = classDir;
+        }
+
+        // Load classes
+        private void preloadAllClasses() {
+                log.debug("preloading all classes...");
+                if (singleClass)
+                        createUnloaders(1);
+                else
+                        createUnloaders(2);
+
+                for (int i = 0; i < unloaders.length; i++) {
+                        loadClasses(unloaders[i], 1, false);
+                        unloaders[i].unloadClass();
+                }
+        }
+
+        // Load classes
+        private boolean loadClasses(ClassUnloader unloader, int classCount, boolean doKeep) {
+                String newClassName;
+                String[] classNames = new String[classCount + 1];
+                classNames[0] = unloader.getClassLoader().getClass().getName()
+                        + "@"
+                        + Integer.toHexString(
+                                        unloader.getClassLoader().hashCode()
+                                        );
+
+
+                for (int i = 1; i <= classCount; i++) {
+                        newClassName = CLASSNAME_PATTERN + int2Str(i);
+                        classNames[i] = newClassName;
+                        try {
+                                unloader.loadClass(newClassName);
+                        } catch (ClassNotFoundException e) {
+                                log.error(e.toString());
+                                e.printStackTrace();
+                                return false;
+                        }
+                }
+                if (doKeep)
+                        classesTable.put(String.valueOf(unloader.hashCode()), classNames);
+                return true;
+        } // loadClasses()
+
+        /**
+         * Loads all classes.
+         *
+         * @see ClassLoadingController#ClassLoadingController
+         */
+        public int loadClasses() {
+                CustomClassLoader loader;
+                boolean res = true;
+                String loaderName;
+
+                createUnloaders(loaderCount);
+
+                int count = 0;
+                for (int i = 0; i < unloaders.length; i++) {
+                        loaderName = unloaders[i].getClassLoader().getClass().getName()
+                                + "@"
+                                + Integer.toHexString(
+                                                unloaders[i].getClassLoader().hashCode()
+                                                );
+                        if (loadClasses(unloaders[i], loadedClassCount, true)) {
+                                String[] values = (String[])
+                                        classesTable.get(String.valueOf(unloaders[i].hashCode()));
+                                int length = values.length - 1;
+                                log.debug(loaderName + "(" + i + ")>>> " + length
+                                                + " classes have been loaded");
+                                count += length;
+                        }
+                }
+                log.info("Total: loading is performed " + count + " times");
+
+                return count;
+        }
+
+        // Unload classes
+        public int unloadClasses() {
+                String loaderName;
+                int count = 0;
+                long timeLeft = 0;
+
+                for (int i = 0; i < loaderCount && (timeLeft = stresser.getTimeLeft()/1000) > 0; i++) {
+                        loaderName = unloaders[i].getClassLoader().getClass().getName()
+                                + "@"
+                                + Integer.toHexString(
+                                                unloaders[i].getClassLoader().hashCode()
+                                                );
+                        String hashCode = String.valueOf(unloaders[i].hashCode());
+                        String[] values = (String[]) classesTable.get(hashCode);
+
+                        if (unloaders[i].unloadClass()) {
+                                int length = values.length - 1;
+                                count += length;
+                                log.debug(loaderName + "(" + i + ")>>> " + length
+                                                + " classes have been unloaded (time left: "+timeLeft+" s)");
+                                classesTable.remove(hashCode);
+                        } else {
+                                log.debug(loaderName + "(" + i + ")>>> "
+                                                + "classes couldn't be unloaded (time left: "+timeLeft+" s)");
+                        }
+                }
+
+                log.info("Total: unloading is performed " + count + " times");
+
+                return count;
+        }
+
+        private void createUnloaders(int count) {
+                CustomClassLoader loader;
+                unloaders = new ClassUnloader[count];
+
+                for (int i = 0; i < count; i++) {
+                        unloaders[i] = new ClassUnloader();
+                        if (singleClass) {
+                                loader = unloaders[i].createClassLoader();
+                        } else {
+                                if (i%2 == 0)
+                                        loader = new ClassLoaderA();
+                                else
+                                        loader = new ClassLoaderB();
+                                unloaders[i].setClassLoader(loader);
+                        }
+                        loader.setClassPath(classDir);
+                } // for
+        }
+
+        /**
+         * Brings out VM into defined state. The method loads all classes via
+         * {@link ClassLoadingController#loadClasses}.
+         *
+         * @see ClassLoadingController#loadClasses
+         */
+        public void run() {
+                loadClasses();
+        }
+
+        /**
+         * Tries to reclaim VM into initial state. The method tries to load all
+         * classes via {@link ClassLoadingController#unloadClasses}.
+         *
+         * @see ClassLoadingController#unloadClasses
+         */
+        public void reset() {
+                unloadClasses();
+        }
+
+        // The class extends CustomClassLoader with specific implementation of
+        // toString() method
+        class ClassLoaderA extends CustomClassLoader {
+                public ClassLoaderA() {
+                        super();
+                }
+
+                public String toString() {
+                        return "ClassLoaderA";
+                }
+        } // ClassLoaderA
+
+        // The class extends CustomClassLoader with specific implementation of
+        // toString() method
+        class ClassLoaderB extends CustomClassLoader {
+                public ClassLoaderB() {
+                        super();
+                }
+
+                public String toString() {
+                        return "ClassLoaderB";
+                }
+        } // ClassLoaderB
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/ClassLoadingMonitor.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,190 @@
+/*
+ * Copyright (c) 2003, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share;
+
+import java.lang.management.*;
+import javax.management.*;
+import java.util.*;
+import nsk.share.*;
+
+/**
+ * <code>ClassLoadingMonitor</code> class is a wrapper of
+ * <code>ClassLoadingMXBean</code>. Depending on command line arguments, an
+ * instance of this class redirects invocations to the
+ * <code>ClassLoadingMXBean</code> interface. If
+ * <code>-testMode="directly"</code> option is set, this instance directly
+ * invokes corresponding method of the <tt>ClassLoadingMXBean</tt> interface. If
+ * <code>-testMode="server"</code> option is set, it makes invokations via
+ * MBeanServer. If <code>-testMode="proxy"</code> option is set it will make
+ * invocations via MBeanServer proxy.
+ *
+ * @see ArgumentHandler
+ */
+public class ClassLoadingMonitor extends Monitor {
+
+    // Names of the attributes of ClassLoadingMXBean
+    private static final String LOADED_CLASSES = "LoadedClassCount";
+    private static final String TOTAL_CLASSES = "TotalLoadedClassCount";
+    private static final String UNLOADED_CLASSES = "UnloadedClassCount";
+
+    // Internal trace level
+    private static final int TRACE_LEVEL = 10;
+
+    // An instance of ClassLoadingMXBean
+    private static ClassLoadingMXBean mbean
+        = ManagementFactory.getClassLoadingMXBean();
+
+    private ClassLoadingMXBean proxyInstance;
+
+    static {
+        Monitor.logPrefix = "ClassLoadingMonitor> ";
+    }
+
+    /**
+     * Creates a new <code>ClassLoadingMonitor</code> object.
+     *
+     * @param log <code>Log</code> object to print info to.
+     * @param argumentHandler <code>ArgumentHandler</code> object that saves
+     *        all info about test's arguments.
+     *
+     */
+    public ClassLoadingMonitor(Log log, ArgumentHandler argumentHandler) {
+        super(log, argumentHandler);
+    }
+
+    /**
+     *
+     * Return a proxy instance for a platform
+     * {@link java.lang.management.ClassLoadingMXBean
+     * <code>ClassLoadingMXBean</code>} interface.
+     *
+     */
+    synchronized ClassLoadingMXBean getProxy() {
+        if (proxyInstance == null) {
+            // create proxy instance
+            try {
+                proxyInstance = (ClassLoadingMXBean)
+                ManagementFactory.newPlatformMXBeanProxy(
+                    getMBeanServer(),
+                    ManagementFactory.CLASS_LOADING_MXBEAN_NAME,
+                    ClassLoadingMXBean.class
+                );
+            } catch (java.io.IOException e) {
+                throw new Failure(e);
+            }
+        }
+        return proxyInstance;
+    }
+
+    /**
+     * Redirects the invocation to
+     * {@link java.lang.management.ClassLoadingMXBean#getLoadedClassCount()
+     * <code>ClassLoadingMXBean.getLoadedClassCount()</code>}.
+     *
+     * @return the number of currently loaded classes.
+     */
+    public int getLoadedClassCount() {
+        int mode = getTestMode();
+
+        switch (mode) {
+        case DIRECTLY_MODE:
+            logger.trace(TRACE_LEVEL,"[getLoadedClassCount] "
+                       + "getLoadedClassCount() directly invoked");
+            return mbean.getLoadedClassCount();
+
+        case SERVER_MODE:
+            logger.trace(TRACE_LEVEL,"[getLoadedClassCount] "
+                       + "getLoadedClassCount() invoked through MBeanServer");
+            return getIntAttribute(mbeanObjectName, LOADED_CLASSES);
+
+        case PROXY_MODE:
+            logger.trace(TRACE_LEVEL,"[getLoadedClassCount] "
+                       + "getLoadedClassCount() invoked through proxy");
+            return getProxy().getLoadedClassCount();
+        }
+
+        throw new TestBug("Unknown testMode " + mode);
+    }
+
+    /**
+     * Redirects the invocation to {@link
+     * java.lang.management.ClassLoadingMXBean#getTotalLoadedClassCount()
+     * <code>ClassLoadingMXBean.getTotalLoadedClassCount()</code>}.
+     *
+     * @return the total number of classes loaded.
+     */
+    public long getTotalLoadedClassCount() {
+        int mode = getTestMode();
+
+        switch (mode) {
+        case DIRECTLY_MODE:
+            logger.trace(TRACE_LEVEL,"[getTotalLoadedClassCount] "
+                       + "getTotalLoadedClassCount() directly invoked");
+            return mbean.getTotalLoadedClassCount();
+
+        case SERVER_MODE:
+            logger.trace(TRACE_LEVEL,"[getTotalLoadedClassCount] "
+                      + "getTotalLoadedClassCount() invoked through "
+                      + "MBeanServer");
+            return getLongAttribute(mbeanObjectName, TOTAL_CLASSES);
+
+        case PROXY_MODE:
+            logger.trace(TRACE_LEVEL,"[getTotalLoadedClassCount] "
+                       + "getTotalLoadedClassCount() invoked through proxy");
+            return getProxy().getTotalLoadedClassCount();
+        }
+        throw new TestBug("Unknown testMode " + mode);
+    }
+
+    /**
+     * Redirects the invocation to
+     * {@link java.lang.management.ClassLoadingMXBean#getUnloadedClassCount()
+     * <code>ClassLoadingMXBean.getUnloadedClassCount()</code>}.
+     *
+     * @return the number of unloaded classes.
+     */
+    public long getUnloadedClassCount() {
+        int mode = getTestMode();
+
+        switch (mode) {
+        case DIRECTLY_MODE:
+            logger.trace(TRACE_LEVEL,"[getUnloadedClassCount] "
+                       + "getUnloadedClassCount() directly invoked");
+            return mbean.getUnloadedClassCount();
+
+        case SERVER_MODE:
+            logger.trace(TRACE_LEVEL,"[getUnloadedClassCount] "
+                       + "getUnloadedClassCount() invoked through MBeanServer");
+            return getLongAttribute(mbeanObjectName, UNLOADED_CLASSES);
+
+        case PROXY_MODE:
+            logger.trace(TRACE_LEVEL,"[getUnloadedClassCount] "
+                       + "getUnloadedClassCount() invoked through proxy");
+            return getProxy().getUnloadedClassCount();
+
+        }
+
+        throw new TestBug("Unknown testMode " + mode);
+    }
+} // ClassLoadingMonitor
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/CompilationMonitor.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2003, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share;
+
+import java.lang.management.*;
+import javax.management.*;
+import nsk.share.*;
+
+/**
+ * <code>CompilationMonitor</code> class is a wrapper of
+ * <tt>CompilationMXBean</tt>. Depending on command line arguments, an instance
+ * of this class redirects invocations to the <tt>CompilationMXBean</tt>
+ * interface. If <code>-testMode="directly"</code> option is set, this instance
+ * directly invokes corresponding method of the <tt>CompilationMXBean</tt>
+ * interface. If <code>-testMode="server"</code> option is set it will make
+ * invocations via MBeanServer. If <code>-testMode="proxy"</code> option is set
+ * it will make invocations via MBeanServer proxy.
+ *
+ * @see ArgumentHandler
+ */
+public class CompilationMonitor extends Monitor {
+
+    // An instance of CompilationMXBean
+    private static CompilationMXBean mbean
+        = ManagementFactory.getCompilationMXBean();
+
+    private CompilationMXBean proxyInstance;
+
+    // An attribute of CompilationMXBean
+    private static final String IS_COMP = "CompilationTimeMonitoringSupported";
+
+    static {
+        Monitor.logPrefix = "CompilationMonitor> ";
+    }
+
+    /**
+     * Creates a new <code>CompilationMonitor</code> object.
+     *
+     * @param log <code>Log</code> object to print info to.
+     * @param argumentHandler <code>ArgumentHandler</code> object that saves
+     *        all info about test's arguments.
+     *
+     */
+    public CompilationMonitor(Log log, ArgumentHandler argumentHandler) {
+        super(log, argumentHandler);
+
+    }
+
+    /**
+     *
+     * Return a proxy instance for a platform
+     * {@link java.lang.management.CompilationMXBean
+     * <code>CompilationMXBean</code>} interface.
+     *
+     */
+    synchronized CompilationMXBean getProxy() {
+        if (proxyInstance == null) {
+            // create proxy instance
+            try {
+                proxyInstance = (CompilationMXBean)
+                ManagementFactory.newPlatformMXBeanProxy(
+                    getMBeanServer(),
+                    ManagementFactory.COMPILATION_MXBEAN_NAME,
+                    CompilationMXBean.class
+                );
+            } catch (java.io.IOException e) {
+                throw new Failure(e);
+            }
+        }
+        return proxyInstance;
+    }
+
+    /**
+     * Detects if the JVM has compilation system.
+     *
+     * @return <code>true</code>, if the JVM has compilation system,
+     *         <code>false</code> otherwise.
+     */
+    public boolean isCompilationSystem() {
+        int mode = getTestMode();
+
+        switch (mode) {
+        case DIRECTLY_MODE:
+            return (mbean != null);
+
+        case SERVER_MODE:
+        case PROXY_MODE:
+            try {
+                return getMBeanServer().isRegistered(mbeanObjectName);
+            } catch (RuntimeOperationsException e) {
+                complain("Unexpected exception");
+                e.printStackTrace(logger.getOutStream());
+                throw new Failure(e);
+            }
+        }
+
+        throw new TestBug("Unknown testMode " + mode);
+    } // isCompilationSystem()
+
+    /**
+     * Redirects the invocation to
+     * {@link CompilationMXBean#isCompilationTimeMonitoringSupported()
+     * <code>CompilationMXBean.isCompilationTimeMonitoringSupported()</code>}.
+     *
+     * @return <code>true</code>, if the monitoring of compilation time is
+     *         supported, <code>false</code> otherwise.
+     */
+    public boolean isCompilationTimeMonitoringSupported() {
+        int mode = getTestMode();
+
+        switch (mode) {
+        case DIRECTLY_MODE:
+            return mbean.isCompilationTimeMonitoringSupported();
+
+        case SERVER_MODE:
+            return getBooleanAttribute(mbeanObjectName, IS_COMP);
+
+        case PROXY_MODE:
+            return getProxy().isCompilationTimeMonitoringSupported();
+        }
+
+        throw new TestBug("Unknown testMode " + mode);
+    } // isCompilationTimeMonitoringSupported()
+} // CompilationMonitor
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/CustomMBeanRegistration.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2003, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share;
+
+import javax.management.*;
+
+/**
+ * <code>CustomMBeanRegistration</code> class is a dummy implementation of
+ * <code>MBeanRegistration</code> interface.
+ *
+ * @see javax.management.MBeanRegistration
+ */
+class CustomMBeanRegistration implements MBeanRegistration {
+    public void postDeregister() {}
+
+    public void postRegister(Boolean registrationDone) {}
+
+    public void preDeregister() {}
+
+    public ObjectName preRegister(MBeanServer server, ObjectName name) {
+        return name;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/CustomMBeanServer.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,843 @@
+/*
+ * Copyright (c) 2003, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share;
+
+import java.util.*;
+import java.io.*;
+import java.lang.reflect.*;
+import java.lang.management.*;
+import javax.management.*;
+import javax.management.loading.*;
+import nsk.share.*;
+
+/**
+ * The <code>CustomMBeanServer</code> implemenets the
+ * {@link javax.management.MBeanServer MBeanServer} interface to provide
+ * minimal funcionality for JSR-174 testing.
+ * <p>Insignificant methods that are not used just throw {@link TestBug TestBug}
+ * with "not implemented" message. If this exception is caught during test
+ * execution, the corresponding method must be implemented.
+ */
+
+public class CustomMBeanServer implements MBeanServer {
+
+        // Name of the system property, which specifies class name of MBean server
+        final static String SERVER_BUILDER_PROPERTY
+                = "javax.management.builder.initial";
+
+        // Class name of MBeanServer builder that creates CustomMBeanServer
+        final static String CUSTOM_SERVER_BUILDER
+                = CustomMBeanServerBuilder.class.getCanonicalName();
+
+        // Default MBeanServer builder
+        final static String DEFAULT_SERVER_BUILDER = "";
+
+        // Internal trace level
+        private final static int TRACE_ALL = 10;
+
+        // Prefix to print while logging
+        private final static String LOG_PREFIX = "CustomMBeanServer> ";
+
+        private final static String BROADCASTER_ITNF_NAME =
+                "javax.management.NotificationBroadcaster";
+
+        private final static String DYNAMICMBEAN_ITNF_NAME =
+                "javax.management.DynamicMBean";
+
+        // Private variables
+        private String defaultDomain;
+        private CustomMBeanRegistration register = new CustomMBeanRegistration();
+        private Log.Logger log;
+        private Hashtable<ObjectName, ObjectKeeper> registeredMBeans = new Hashtable<ObjectName, ObjectKeeper>();
+        // StandardMBean view of registered MBeans
+        private Map<ObjectName, DynamicMBean> registeredMBeansStd = new HashMap<ObjectName, DynamicMBean>();
+
+        // Inner class to connect ObjectInstance and Object
+        class ObjectKeeper {
+                ObjectInstance instance;
+                Object object;
+
+                ObjectKeeper(ObjectInstance instance, Object object) {
+                        this.instance = instance;
+                        this.object = object;
+                }
+        }
+
+        /**
+         * Creates a new <code>CustomMBeanServer</code> object.
+         *
+         * @param defaultDomain default domain of the new MBeanServer
+         */
+        public CustomMBeanServer(String defaultDomain) {
+                this.defaultDomain = defaultDomain;
+        }
+
+        /**
+         * Instantiates and registers an MBean in the MBean server.
+         *
+         * @see javax.management.MBeanServer#createMBean(String, ObjectName)
+         */
+        public ObjectInstance createMBean(String className, ObjectName name)
+                throws ReflectionException,
+                       InstanceAlreadyExistsException,
+                       MBeanRegistrationException,
+                       MBeanException,
+                       NotCompliantMBeanException {
+                               throw new TestBug("not implemented");
+                       }
+
+        /**
+         * Instantiates and registers an MBean in the MBean server.
+         *
+         * @see javax.management.MBeanServer#createMBean(String, ObjectName,
+         *      Object[], String[])
+         */
+        public ObjectInstance createMBean(String className, ObjectName name,
+                        Object[] params, String[] signature)
+                throws ReflectionException,
+                       InstanceAlreadyExistsException,
+                       MBeanRegistrationException,
+                       MBeanException,
+                       NotCompliantMBeanException {
+                               throw new TestBug("not implemented");
+                       }
+
+        /**
+         * Instantiates and registers an MBean in the MBean server.
+         *
+         * @see javax.management.MBeanServer#createMBean(String, ObjectName,
+         *      ObjectName)
+         */
+        public ObjectInstance createMBean(String className, ObjectName name,
+                        ObjectName loaderName)
+                throws ReflectionException,
+                       InstanceAlreadyExistsException,
+                       MBeanRegistrationException,
+                       MBeanException,
+                       NotCompliantMBeanException,
+                       InstanceNotFoundException {
+                               throw new TestBug("not implemented");
+                       }
+
+        /**
+         * Instantiates and registers an MBean in the MBean server.
+         *
+         * @see javax.management.MBeanServer#createMBean(String, ObjectName,
+         *      ObjectName, Object[], String[])
+         */
+        public ObjectInstance createMBean(String className, ObjectName name,
+                        ObjectName loaderName, Object[] params,
+                        String[] signature)
+                throws ReflectionException,
+                       InstanceAlreadyExistsException,
+                       MBeanRegistrationException,
+                       MBeanException,
+                       NotCompliantMBeanException,
+                       InstanceNotFoundException {
+                               throw new TestBug("not implemented");
+                       }
+
+        /**
+         * Registers a pre-existing object as an MBean with the MBean server
+         *
+         * @see javax.management.MBeanServer#registerMBean(Object, ObjectName)
+         */
+        public ObjectInstance registerMBean(Object object, ObjectName name)
+                throws InstanceAlreadyExistsException,
+                       MBeanRegistrationException,
+                       NotCompliantMBeanException {
+                               ObjectName newName = null;
+
+                               try {
+                                       newName = register.preRegister(this, name);
+                               } catch (Exception e) {
+                                       register.postRegister(new Boolean(false));
+                                       throw new MBeanRegistrationException(e);
+                               }
+
+                               // The log object may not be initialized by that time, so try
+                               // to check it
+                               if (log != null)
+                                       log.trace(TRACE_ALL, "[registerMBean] " + newName);
+
+                               if  (isRegistered(newName)) {
+                                       register.postRegister(new Boolean(false));
+                                       throw new InstanceAlreadyExistsException("already registered");
+                               }
+
+                               ObjectInstance instance = null;
+                               try {
+                                       instance = new ObjectInstance(newName, object.getClass().getName());
+                               } catch (IllegalArgumentException e) {
+                                       throw new RuntimeOperationsException(e);
+                               }
+                               registeredMBeans.put(newName, new ObjectKeeper(instance, object));
+                               register.postRegister(new Boolean(true));
+                               return instance;
+                       }
+
+        /**
+         * Unregisters an MBean from the MBean server.
+         *
+         * @see javax.management.MBeanServer#unregisterMBean(ObjectName)
+         */
+        public void unregisterMBean(ObjectName name)
+                throws InstanceNotFoundException,
+                       MBeanRegistrationException {
+                               throw new TestBug("not implemented");
+                       }
+
+        /**
+         * Gets the <code>ObjectInstance</code> for a given MBean registered with
+         * the MBean server.
+         *
+         * @see javax.management.MBeanServer#getObjectInstance(ObjectName)
+         */
+        public ObjectInstance getObjectInstance(ObjectName name)
+                throws InstanceNotFoundException {
+                        throw new TestBug("not implemented");
+                }
+
+        /**
+         * Gets MBeans controlled by the MBean server.
+         *
+         * @see javax.management.MBeanServer#queryMBeans(ObjectName, QueryExp)
+         */
+        public Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp query) {
+                if ( (name != null) || (query != null) )
+                        throw new TestBug("not implemented");
+
+                HashSet<ObjectInstance> result = new HashSet<ObjectInstance>();
+                Enumeration enumeration = registeredMBeans.elements();
+                while (enumeration.hasMoreElements()) {
+                        ObjectKeeper keeper = (ObjectKeeper) enumeration.nextElement();
+                        result.add(keeper.instance);
+                }
+                return result;
+        }
+
+        /**
+         * Gets the names of MBeans controlled by the MBean server.
+         *
+         * @see javax.management.MBeanServer#queryNames(ObjectName, QueryExp)
+         */
+        public Set<ObjectName> queryNames(ObjectName name, QueryExp query) {
+                if (query != null)
+                        throw new TestBug("not implemented");
+
+                HashSet<ObjectName> result = new HashSet<ObjectName>();
+                Enumeration enumeration = registeredMBeans.elements();
+                while (enumeration.hasMoreElements()) {
+                        ObjectKeeper keeper = (ObjectKeeper) enumeration.nextElement();
+                        ObjectName obj = keeper.instance.getObjectName();
+                        if ((name == null) || (name.apply(obj))) {
+                            result.add(obj);
+                        }
+                }
+                return result;
+        }
+
+        /**
+         * Checks whether an MBean, identified by its object name, is
+         * already registered with the MBean server.
+         *
+         * @see javax.management.MBeanServer#isRegistered(ObjectName)
+         */
+        public boolean isRegistered(ObjectName name) {
+                return registeredMBeans.containsKey(name);
+        }
+
+        /**
+         * Returns the number of MBeans registered in the MBean server.
+         *
+         * @see javax.management.MBeanServer#getMBeanCount()
+         */
+        public Integer getMBeanCount() {
+                throw new TestBug("not implemented");
+        }
+
+        /**
+         * Gets the value of a specific attribute of a named MBean.
+         *
+         * @see javax.management.MBeanServer#getAttribute(ObjectName, String)
+         */
+        public Object getAttribute(ObjectName name, String attribute)
+                throws MBeanException,
+                       AttributeNotFoundException,
+                       InstanceNotFoundException,
+                       ReflectionException {
+
+                               if (log != null)
+                                       log.trace(TRACE_ALL, "[getAttribute] " + name + "> " + attribute);
+
+                               DynamicMBean mbean = getObject(name);
+                               Object result = mbean.getAttribute(attribute);
+                               if (result instanceof List) {
+                                       List list = (List) result;
+                                       Object[] arr = new Object[list.size()];
+                                       int i = 0;
+                                       for (Object o : list)
+                                               arr[i++] = o;
+                                       return arr;
+                               }
+                               return result;
+                       }
+
+        /**
+         * Gets the values of several attributes of a named MBean.
+         *
+         * @see javax.management.MBeanServer#getAttributes(ObjectName, String[])
+         */
+        public AttributeList getAttributes(ObjectName name, String[] attributes)
+                throws InstanceNotFoundException,
+                       ReflectionException {
+                               throw new TestBug("not implemented");
+                       }
+
+        /**
+         * Sets the value of a specific attribute of a named MBean.
+         *
+         * @see javax.management.MBeanServer#setAttribute(ObjectName, Attribute)
+         */
+        public void setAttribute(ObjectName name, Attribute attribute)
+                throws InstanceNotFoundException,
+                       AttributeNotFoundException,
+                       InvalidAttributeValueException,
+                       MBeanException,
+                       ReflectionException {
+
+                               if (log != null)
+                                       log.trace(TRACE_ALL, "[setAttribute] " + name + "> " + attribute);
+
+                               DynamicMBean mbean = getObject(name);
+                               mbean.setAttribute(attribute);
+                       }
+
+        /**
+         * Sets the values of several attributes of a named MBean.
+         *
+         * @see javax.management.MBeanServer#setAttributes(ObjectName,
+         *      AttributeList)
+         */
+        public AttributeList setAttributes(ObjectName name,
+                        AttributeList attributes)
+                throws InstanceNotFoundException,
+                       ReflectionException {
+                               throw new TestBug("not implemented");
+                       }
+
+        /**
+         * Invokes an operation on an MBean.
+         *
+         * @see javax.management.MBeanServer#invoke(ObjectName, String,
+         *      Object[], String[])
+         */
+        public Object invoke(ObjectName name, String operationName,
+                        Object[] params, String[] signature)
+                throws InstanceNotFoundException,
+                       MBeanException,
+                       ReflectionException {
+
+                               if (log != null)
+                                       log.trace(TRACE_ALL, "[invoke] " + name + "> "
+                                                       + operationName);
+                               return invokeObjectMethod(name, operationName, params, signature);
+                       }
+
+        /**
+         * Returns the default domain used for naming the MBean.
+         *
+         * @see javax.management.MBeanServer#getDefaultDomain()
+         */
+        public String getDefaultDomain() {
+                throw new TestBug("not implemented");
+        }
+
+        /**
+         * Returns the list of domains in which any MBean is currently
+         * registered.
+         *
+         * @see javax.management.MBeanServer#getDomains()
+         */
+        public String[] getDomains() {
+                throw new TestBug("not implemented");
+        }
+
+        /**
+         * Adds a listener to a registered MBean.
+         *
+         * @see javax.management.MBeanServer#addNotificationListener(ObjectName,
+         *      NotificationListener, NotificationFilter, Object)
+         */
+        public void addNotificationListener(ObjectName name,
+                        NotificationListener listener,
+                        NotificationFilter filter,
+                        Object handback) throws InstanceNotFoundException {
+                getNotificationBroadcaster(name).addNotificationListener(listener, filter, handback);
+        }
+
+        /**
+         * Adds a listener to a registered MBean.
+         *
+         * @see javax.management.MBeanServer#addNotificationListener(ObjectName,
+         *      ObjectName, NotificationFilter, Object)
+         */
+        public void addNotificationListener(ObjectName name, ObjectName listener,
+                        NotificationFilter filter,
+                        Object handback)
+                throws InstanceNotFoundException {
+                        throw new TestBug("not implemented");
+                }
+
+        /**
+         * Removes a listener from a registered MBean.
+         *
+         * @see javax.management.MBeanServer#removeNotificationListener(ObjectName,
+         *      ObjectName)
+         */
+        public void removeNotificationListener(ObjectName name, ObjectName listener)
+                throws InstanceNotFoundException, ListenerNotFoundException {
+                        throw new TestBug("not implemented");
+                }
+
+        /**
+         * Removes a listener from a registered MBean.
+         *
+         * @see javax.management.MBeanServer#removeNotificationListener(ObjectName,
+         *      ObjectName, NotificationFilter, Object)
+         */
+        public void removeNotificationListener(ObjectName name,
+                        ObjectName listener,
+                        NotificationFilter filter,
+                        Object handback)
+                throws InstanceNotFoundException,
+                       ListenerNotFoundException {
+                               throw new TestBug("not implemented");
+                       }
+
+        /**
+         * Removes a listener from a registered MBean.
+         *
+         * @see javax.management.MBeanServer#removeNotificationListener(ObjectName,
+         *      NotificationListener)
+         */
+        public void removeNotificationListener(ObjectName name,
+                        NotificationListener listener)
+                throws InstanceNotFoundException,
+                       ListenerNotFoundException {
+                               throw new TestBug("not implemented");
+                       }
+
+        /**
+         * Removes a listener from a registered MBean.
+         *
+         * @see javax.management.MBeanServer#removeNotificationListener(ObjectName,
+         *      NotificationListener, NotificationFilter, Object)
+         */
+        public void removeNotificationListener(ObjectName name,
+                        NotificationListener listener,
+                        NotificationFilter filter,
+                        Object handback)
+                throws InstanceNotFoundException,
+                       ListenerNotFoundException {
+                       }
+
+        /**
+         * This method discovers the attributes and operations that an
+         * MBean exposes for management.
+         *
+         * @see javax.management.MBeanServer#getMBeanInfo(ObjectName)
+         */
+        public MBeanInfo getMBeanInfo(ObjectName name)
+                throws InstanceNotFoundException,
+                       IntrospectionException,
+                       ReflectionException {
+                               throw new TestBug("not implemented");
+                       }
+
+        /**
+         * Returns true if the MBean specified is an instance of the
+         * specified class, false otherwise.
+         *
+         * @see javax.management.MBeanServer#isInstanceOf(ObjectName, String)
+         */
+        public boolean isInstanceOf(ObjectName name, String className)
+                throws InstanceNotFoundException {
+                        //        DynamicMBean mbean = getObject(name);
+                        //        MBeanInfo info = mbean.getMBeanInfo();
+                        //        return info.getClassName().compareTo(className) == 0;
+
+                        DynamicMBean mbean = getObject(name);
+                        MBeanInfo info = mbean.getMBeanInfo();
+                        String infoClassName = info.getClassName();
+
+                        if (log != null) {
+                                log.trace(TRACE_ALL, "[isInstanceOf] name=" + name);
+                                log.trace(TRACE_ALL, "[isInstanceOf] className=" + className);
+                        }
+
+                        if (infoClassName.equals(className)) {
+                                if (log != null)
+                                        log.trace(TRACE_ALL, "[isInstanceOf] infoClassName is equal className. return true");
+                                return true;
+                        }
+
+                        try {
+                                ClassLoader cl = mbean.getClass().getClassLoader();
+                                Class<?> classNameClass = loadClass(className,cl);
+                                if (classNameClass == null) {
+                                        if (log != null)
+                                                log.trace(TRACE_ALL, "[isInstanceOf] classNameClass is null. return false");
+                                        return false;
+                                }
+
+                                if (classNameClass.isInstance(mbean)) {
+                                        if (log != null)
+                                                log.trace(TRACE_ALL, "[isInstanceOf] mbean is instance of classNameClass. return true");
+                                        return true;
+                                }
+
+                                Class<?> instanceClass = loadClass(infoClassName,cl);
+                                if (instanceClass == null) {
+                                        if (log != null)
+                                                log.trace(TRACE_ALL, "[isInstanceOf] instanceClass is null. return false");
+                                        return false;
+                                }
+
+                                boolean isAssignable = classNameClass.isAssignableFrom(instanceClass);
+                                if (log != null)
+                                        log.trace(TRACE_ALL, "[isInstanceOf] classNameClass is assignable="+isAssignable);
+                                return isAssignable;
+                        } catch (ReflectionException e) {
+                                if (log != null) {
+                                        log.trace(TRACE_ALL, "[isInstanceOf] "+e.getMessage());
+                                        e.printStackTrace(log.getOutStream());
+                                }
+                                return false;
+                        } catch (Exception e) {
+                                /* Could be SecurityException or ClassNotFoundException */
+                                if (log != null) {
+                                        log.trace(TRACE_ALL, "[isInstanceOf] "+e.getMessage());
+                                        e.printStackTrace(log.getOutStream());
+                                }
+                                return false;
+                        }
+
+                }
+
+        /**
+         * Load a class with the specified loader, or with this object
+         * class loader if the specified loader is null.
+         **/
+        static Class loadClass(String className, ClassLoader loader)
+                throws ReflectionException {
+
+                        Class theClass = null;
+                        if (className == null) {
+                                throw new RuntimeOperationsException(new
+                                                IllegalArgumentException("The class name cannot be null"),
+                                                "Exception occured during object instantiation");
+                        }
+                        try {
+                                if (loader == null)
+                                        loader = CustomMBeanServer.class.getClassLoader();
+                                if (loader != null) {
+                                        theClass = Class.forName(className, false, loader);
+                                } else {
+                                        theClass = Class.forName(className);
+                                }
+                        } catch (ClassNotFoundException e) {
+                                throw new ReflectionException(e,
+                                                "The MBean class could not be loaded by the context classloader");
+                        }
+                        return theClass;
+                }
+
+
+        /**
+         * Instantiates an object using the list of all class loaders
+         * registered in the MBean server's.
+         *
+         * @see javax.management.MBeanServer#instantiate(String)
+         */
+        public Object instantiate(String className)
+                throws ReflectionException,
+                       MBeanException {
+                               throw new TestBug("not implemented");
+                       }
+
+        /**
+         * Instantiates an object using the list of all class loaders
+         * registered in the MBean server's.
+         *
+         * @see javax.management.MBeanServer#instantiate(String, ObjectName)
+         */
+        public Object instantiate(String className, ObjectName loaderName)
+                throws ReflectionException,
+                       MBeanException,
+                       InstanceNotFoundException {
+                               throw new TestBug("not implemented");
+                       }
+
+        /**
+         * Instantiates an object using the list of all class loaders
+         * registered in the MBean server's.
+         *
+         * @see javax.management.MBeanServer#instantiate(String, Object[],
+         *      String[])
+         */
+        public Object instantiate(String className, Object[] params,
+                        String[] signature)
+                throws ReflectionException,
+                       MBeanException {
+                               throw new TestBug("not implemented");
+                       }
+
+        /**
+         * Instantiates an object using the list of all class loaders
+         * registered in the MBean server's.
+         *
+         * @see javax.management.MBeanServer#instantiate(String, ObjectName,
+         *      Object[], String[])
+         */
+        public Object instantiate(String className, ObjectName loaderName,
+                        Object[] params, String[] signature)
+                throws ReflectionException,
+                       MBeanException,
+                       InstanceNotFoundException {
+                               throw new TestBug("not implemented");
+                       }
+
+        /**
+         * De-serializes a byte array in the context of the class loader
+         * of an MBean.
+         *
+         * @see javax.management.MBeanServer#deserialize(ObjectName, byte[])
+         */
+        public ObjectInputStream deserialize(ObjectName name, byte[] data)
+                throws InstanceNotFoundException,
+                       OperationsException {
+                               throw new TestBug("not implemented");
+                       }
+
+        /**
+         * De-serializes a byte array in the context of the class loader
+         * of an MBean.
+         *
+         * @see javax.management.MBeanServer#deserialize(String, byte[])
+         */
+        public ObjectInputStream deserialize(String className, byte[] data)
+                throws OperationsException,
+                       ReflectionException {
+                               throw new TestBug("not implemented");
+                       }
+
+        /**
+         * De-serializes a byte array in the context of the class loader
+         * of an MBean.
+         *
+         * @see javax.management.MBeanServer#deserialize(String, ObjectName, byte[])
+         */
+        public ObjectInputStream deserialize(String className,
+                        ObjectName loaderName,
+                        byte[] data)
+                throws InstanceNotFoundException,
+                       OperationsException,
+                       ReflectionException {
+                               throw new TestBug("not implemented");
+                       }
+
+        /**
+         * Return the {@link java.lang.ClassLoader} that was used for
+         * loading the class of the named MBean.
+         *
+         * @see javax.management.MBeanServer#getClassLoaderFor(ObjectName)
+         */
+        public ClassLoader getClassLoaderFor(ObjectName mbeanName)
+                throws InstanceNotFoundException {
+                        throw new TestBug("not implemented");
+                }
+
+        /**
+         * Return the named {@link java.lang.ClassLoader}.
+         *
+         * @see javax.management.MBeanServer#getClassLoader(ObjectName)
+         */
+        public ClassLoader getClassLoader(ObjectName loaderName)
+                throws InstanceNotFoundException {
+                        throw new TestBug("not implemented");
+                }
+
+        /**
+         * Return the named {@link java.lang.ClassLoader}.
+         *
+         * @see javax.management.MBeanServer#getClassLoader(ObjectName)
+         */
+        public ClassLoaderRepository getClassLoaderRepository() {
+                throw new TestBug("not implemented");
+        }
+
+        /**
+         * Initializes {@link Log <code>Log</code>} object.
+         *
+         * @param log a new <code>Log</code> object.
+         */
+        public void setLog(Log log) {
+                this.log = new Log.Logger(log, LOG_PREFIX + "> ");
+        }
+
+        // **********************************************************************
+        //
+        // Private methods
+        //
+        // **********************************************************************
+
+        /**
+         * Gets the object reference for a given MBean registered with the MBean
+         * server.
+         *
+         * @param name The object name of the MBean.
+         *
+         * @return The MBean object, specified by <code>name</code>.
+         *
+         * @throws InstanceNotFoundException The MBean specified is not registered
+         *         in the MBean server.
+         */
+        private DynamicMBean getObject(ObjectName name) throws InstanceNotFoundException {
+                DynamicMBean mbean = registeredMBeansStd.get(name);
+                if (mbean == null) {
+                        ObjectKeeper objKeeper = registeredMBeans.get(name);
+                        if (objKeeper == null)
+                                throw new InstanceNotFoundException();
+                        Object object = objKeeper.object;
+                        if (object instanceof DynamicMBean)
+                                mbean = (DynamicMBean) object;
+                        else
+                                mbean = new StandardMBean(object, getMBeanInterface(object), true);
+                        registeredMBeansStd.put(name, mbean);
+                }
+                return mbean;
+                /*
+                   ObjectKeeper objKeeper = (ObjectKeeper) registeredMBeans.get(name);
+
+                   if (objKeeper == null)
+                   throw new InstanceNotFoundException();
+
+                   Class superOfMBeans = null;
+                   try {
+                   superOfMBeans = Class.forName(DYNAMICMBEAN_ITNF_NAME);
+                   } catch (ClassNotFoundException e) {
+                   throw new InstanceNotFoundException();
+                   }
+
+                   if (superOfMBeans.isAssignableFrom(objKeeper.object.getClass())) {
+                   return (DynamicMBean )objKeeper.object;
+                   }
+
+                   return null;
+                   */
+        }
+
+        /**
+         * Obtain NotificationBroadcaster for given MBean registered with the MBean
+         * server.
+         *
+         * @param name The object name of the MBean.
+         *
+         * @return The MBean object, specified by <code>name</code>.
+         *
+         * @throws InstanceNotFoundException if MBean specified is not registered
+         *         in the MBean server.
+         */
+        private NotificationBroadcaster getNotificationBroadcaster(ObjectName name) throws InstanceNotFoundException {
+                ObjectKeeper objKeeper = (ObjectKeeper) registeredMBeans.get(name);
+                if (objKeeper == null)
+                        throw new InstanceNotFoundException();
+                Object mbean = objKeeper.object;
+                if (mbean instanceof NotificationBroadcaster)
+                        return (NotificationBroadcaster) mbean;
+                throw new InstanceNotFoundException();
+        }
+
+        /**
+         * Invoke the method
+         */
+        private Object invokeObjectMethod(ObjectName name, String methodName,
+                        Object[] params, String[] signature) throws InstanceNotFoundException,
+                MBeanException,
+                ReflectionException {
+
+                        if (log != null)
+                                log.trace(TRACE_ALL, "[invokeObjectMethod] " + name + "> "
+                                                + methodName);
+
+                        DynamicMBean mbean = getObject(name);
+                        return mbean.invoke(methodName, params, signature);
+                }
+
+        private Class getInterface(Class cl, String prefix) {
+                Class[] interfaces = cl.getInterfaces();
+                if (interfaces == null || interfaces.length == 0)
+                        return null;
+                for (Class c : interfaces) {
+                        if (c.getName().startsWith(prefix))
+                                return c;
+                        c = getInterface(c, prefix);
+                        if (c != null)
+                                return c;
+                }
+                return null;
+        }
+
+        /**
+         * Discover MBean interface of the bean.
+         *
+         * Note: this is very specialized for java.lang.management
+         * and java.util.logging tests.
+         * It is generally not correct for any MBean.
+         *
+         * @param object the bean
+         * @return interface class
+         */
+        private Class getMBeanInterface(Object object) throws InstanceNotFoundException {
+                String className = object.getClass().getName();
+                Class<?> iface = null;
+                if (className.startsWith("java.lang.management"))
+                        iface = getInterface(object.getClass(), "java.lang.management");
+                else if (className.startsWith("java.util.logging"))
+                        iface = getInterface(object.getClass(), "java.util.logging");
+                else if (className.startsWith("sun.management"))
+                        iface = getInterface(object.getClass(), "java.lang.management");
+                if (iface != null)
+                        return iface;
+                Class<?>[] interfaces = object.getClass().getInterfaces();
+                System.out.println(object);
+                System.out.println(object.getClass());
+                System.out.println(interfaces.length);
+                for (Class<?> c : interfaces) {
+                        System.out.println(c.getName());
+                }
+                throw new TestBug("No suitable implemented interface found for: " + object + " class: " + object.getClass());
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/CustomMBeanServerBuilder.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2003, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share;
+
+import javax.management.*;
+
+/**
+ * The <code>CustomMBeanServerBuilder</code> class represents a builder that
+ * creates {@link CustomMBeanServer <tt>CustomMBeanServer</tt>} which is
+ * implemeted by NSK J2SE SQE Team to test Monitoring and Management API
+ * (JSR-174).
+ *
+ * <p>To instantiate <tt>CustomMBeanServer</tt>, the
+ * <b>javax.management.builder.initial</b> system property must contain
+ * <code>"nsk.monitoring.share.CustomMBeanServerBuilder"</code> string.
+ */
+public class CustomMBeanServerBuilder extends MBeanServerBuilder {
+
+    // NSK default domain
+    private static final String DEFAULT_DOMAIN = "nsk.defaultDomain";
+
+    /**
+     * Public default constructor.
+     */
+    public CustomMBeanServerBuilder() {
+        super();
+    }
+
+    /**
+     * Creates a new <code>CustomMBeanServer</code> object.
+     *
+     * @param defaultDomain Default domain of the new MBean server.
+     * @param outer A pointer to the MBean server object that must be passed
+     *        to the MBeans when invoking their
+     *        {@link javax.management.MBeanRegistration
+     *        <code>MBeanRegistration</code>} interface.
+     * @param delegate A pointer to the MBeanServerDelegate associated with
+     *        the new MBeanServer. The new MBeanServer must register this
+     *        MBean in its MBean repository.
+     *
+     * @return A new <code>CustomMBeanServer</code> instance.
+     *
+     * @see javax.management.MBeanServerBuilder#newMBeanServer
+     */
+    public MBeanServer newMBeanServer(String defaultDomain,
+                                  MBeanServer outer,
+                                  MBeanServerDelegate delegate) {
+        if (defaultDomain == null || defaultDomain.length() == 0)
+            return new CustomMBeanServer(DEFAULT_DOMAIN);
+        else
+            return new CustomMBeanServer(defaultDomain);
+    }
+
+    /**
+     * Creates an instance of the {@link javax.management.MBeanServerDelegate
+     * <code>MBeanServerDelegate</code>} class.
+     *
+     * @return A new <code>MBeanServerDelegate</code> object.
+     *
+     * @see javax.management.MBeanServerBuilder#newMBeanServerDelegate
+     */
+    public MBeanServerDelegate newMBeanServerDelegate() {
+        return new MBeanServerDelegate();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/GarbageCollectorMonitor.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,199 @@
+/*
+ * Copyright (c) 2004, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share;
+
+import java.lang.management.*;
+import javax.management.*;
+import java.io.IOException;
+import java.util.*;
+
+import nsk.share.*;
+
+/**
+ * <code>GarbageCollectorMonitor</code> class is a wrapper of
+ * <code>GarbageCollectorMXBean</code>.
+ * Depending on command line arguments, an instance of this class redirects
+ * invocations to the <code>GarbageCollectorMXBean</code> interface. If
+ * <code>-testMode="directly"</code> option is set, this instance directly
+ * invokes corresponding method of the <code>GarbageCollectorMXBean</code>
+ * interface. If <code>-testMode="server"</code> option is set it will make
+ * invocations via MBeanServer. If <code>-testMode="proxy"</code> option
+ * is set it will make invocations via MBeanServer proxy.
+ *
+ * @see ArgumentHandler
+ */
+
+public class GarbageCollectorMonitor extends Monitor {
+
+    public static final String GARBAGECOLLECTOR_MXBEAN_NAME =
+        ManagementFactory.GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE;
+
+    private static List<GarbageCollectorMXBean> mbeans
+        = ManagementFactory.getGarbageCollectorMXBeans();
+
+    // Internal trace level
+    private static final int TRACE_LEVEL = 10;
+
+    // Names of the attributes of ClassLoadingMXBean
+    private static final String COLLECTION_COUNT = "CollectionCount";
+    private static final String COLLECTION_TIME = "CollectionTime";
+
+    static {
+        Monitor.logPrefix = "GarbageCollectorMonitor> ";
+    }
+
+    /**
+     * Creates a new <code>GarbageCollectorMonitor</code> object.
+     *
+     * @param log <code>Log</code> object to print info to.
+     * @param argumentHandler <code>ArgumentHandler</code> object that saves
+     *        all info about test's arguments.
+     *
+     */
+    public GarbageCollectorMonitor(Log log, ArgumentHandler argumentHandler) {
+
+        super(log, argumentHandler);
+    }
+
+    public ObjectName getMBeanObjectName() {
+
+        return mbeanObjectName;
+    }
+
+    public Object[] getGarbageCollectorMXBeans() {
+
+        List<Object> list = new ArrayList<Object>();
+        int mode = getTestMode();
+
+        switch (mode) {
+            case DIRECTLY_MODE:
+                list.addAll(mbeans);
+                break;
+            case SERVER_MODE:
+                try {
+                    Set query = getMBeanServer().queryNames(null, null);
+                    Iterator it = query.iterator();
+                    while (it.hasNext()) {
+                        ObjectName oname = (ObjectName)it.next();
+                        if (oname.toString().startsWith(
+                            GARBAGECOLLECTOR_MXBEAN_NAME + ",")) {
+                            list.add(oname);
+                        }
+                    }
+                } catch (Exception e) {
+                    throw new Failure(e);
+                }
+                break;
+            case PROXY_MODE:
+                try {
+                    Set query = getMBeanServer().queryNames(null, null);
+                    Iterator it = query.iterator();
+                    while (it.hasNext()) {
+                        ObjectName oname = (ObjectName)it.next();
+                        if (oname.toString().startsWith(
+                            GARBAGECOLLECTOR_MXBEAN_NAME + ",")) {
+                            list.add(getProxy(oname));
+                        }
+                    }
+                } catch (Exception e) {
+                    throw new Failure(e);
+                }
+                break;
+            default:
+                throw new TestBug("Unknown testMode " + mode);
+        }
+
+        return list.toArray();
+    }
+
+    private GarbageCollectorMXBean getProxy(ObjectName gcMXBean) {
+
+        try {
+            GarbageCollectorMXBean proxy = (GarbageCollectorMXBean)
+            ManagementFactory.newPlatformMXBeanProxy(
+                getMBeanServer(),
+                gcMXBean.toString(),
+                GarbageCollectorMXBean.class
+            );
+
+            return proxy;
+        } catch (Exception e) {
+            throw new Failure(e);
+        }
+    }
+
+    /**
+     * Redirects the invocation to
+     * {@link java.lang.management.GarbageCollectorMXBean#getCollectionCount()
+     * <code>GarbageCollectorMXBean.getCollectionCount()</code>}.
+     *
+     * @return the total number of collections that have occurred.
+     *
+     * @see java.lang.management.GarbageCollectorMXBean#getCollectionCount()
+     */
+    public long getCollectionCount(Object gcMXBean) {
+
+        int mode = getTestMode();
+
+        switch (mode) {
+            case DIRECTLY_MODE:
+                return ((GarbageCollectorMXBean)gcMXBean).getCollectionCount();
+            case SERVER_MODE:
+                return getLongAttribute((ObjectName)gcMXBean,
+                    COLLECTION_COUNT);
+            case PROXY_MODE:
+                return ((GarbageCollectorMXBean)gcMXBean).getCollectionCount();
+            default:
+                throw new TestBug("Unknown testMode " + mode);
+        }
+    }
+
+    /**
+     * Redirects the invocation to
+     * {@link java.lang.management.GarbageCollectorMXBean#getCollectionTime()
+     * <code>GarbageCollectorMXBean.getCollectionTime()</code>}.
+     *
+     * @return the approximate accumulated collection elapsed time
+     * in milliseconds.
+     *
+     * @see java.lang.management.GarbageCollectorMXBean#getCollectionTime()
+     */
+    public long getCollectionTime(Object gcMXBean) {
+
+        int mode = getTestMode();
+
+        switch (mode) {
+            case DIRECTLY_MODE:
+                return ((GarbageCollectorMXBean)gcMXBean).getCollectionTime();
+            case SERVER_MODE:
+                return getLongAttribute(((ObjectName)gcMXBean),
+                    COLLECTION_TIME);
+            case PROXY_MODE:
+                return ((GarbageCollectorMXBean)gcMXBean).getCollectionTime();
+            default:
+                throw new TestBug("Unknown testMode " + mode);
+        }
+    }
+
+} // GarbageCollectorMonitor
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/Generator.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2005, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share;
+
+import java.util.*;
+import java.io.*;
+import java.util.ArrayList;
+
+public class Generator {
+        private String patternFileName;
+        private String outDir;
+        private List<String> lines = new ArrayList<>();
+        private String prefix = "LoadableClass";
+
+        public Generator(String patternFileName, String outDir) {
+                this.patternFileName = patternFileName;
+                this.outDir = outDir;
+        }
+
+        private void load() throws IOException {
+                BufferedReader rd = null;
+                try {
+                        rd = new BufferedReader(new FileReader(patternFileName));
+                        String s = rd.readLine();
+                        while (s != null) {
+                                lines.add(s);
+                                s = rd.readLine();
+                        }
+                } finally {
+                        if (rd != null) {
+                                rd.close();
+                        }
+                }
+        }
+
+        private void generate(int n) throws IOException {
+                PrintStream out = null;
+                String tokens = Integer.toString(n);
+                if (tokens.length() == 1)
+                        tokens = "00" + tokens;
+                else if (tokens.length() == 2)
+                        tokens = "0" + tokens;
+                try {
+                        out = new PrintStream(new FileOutputStream(new File(outDir, prefix + tokens + ".java")));
+                        for (int i = 0; i < lines.size(); ++i) {
+                                String line = lines.get(i);
+                                out.println(line.replaceAll("XYZ", tokens));
+                        }
+                } finally {
+                        if (out != null) {
+                                out.close();
+                        }
+                }
+        }
+
+        public void run() throws IOException {
+                load();
+                for (int i = 1; i < 101; ++i)
+                        generate(i);
+        }
+
+        private static void usage() {
+                System.out.println("Usage: nsk.monitoring.share.Generator <pattern file> <output directory>");
+        }
+
+        public static void main(String[] args) throws Exception {
+                if (args.length != 2) {
+                        usage();
+                        throw new IllegalArgumentException("Need exactly two arguments.");
+                }
+                new Generator(args[0], args[1]).run();
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/LoadableClass.pattern	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2003, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share.newclass;
+
+public class LoadableClassXYZ {
+    public Object dummyField;
+
+    public void dummyMethod() {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/LoggingMonitor.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,331 @@
+/*
+ * Copyright (c) 2004, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share;
+
+import java.lang.management.*;
+import java.util.logging.*;
+import javax.management.*;
+import java.io.IOException;
+import java.util.List;
+
+import nsk.share.*;
+
+/**
+ * <code>LoggingMonitor</code> class is a wrapper of <code>LoggingMXBean</code>.
+ * Depending on command line arguments, an instance of this class redirects
+ * invocations to the <code>LoggingMXBean</code> interface. If
+ * <code>-testMode="directly"</code> option is set, this instance directly
+ * invokes corresponding method of the <code>LoggingMXBean</code> interface. If
+ * <code>-testMode="server"</code> option is set it will make invocations via
+ * MBeanServer. If <code>-testMode="proxy"</code> option is set it will make
+ * invocations via MBeanServer proxy.
+ *
+ * @see ArgumentHandler
+ */
+
+public class LoggingMonitor extends Monitor {
+
+    public static final String LOGGING_MXBEAN_NAME =
+        LogManager.LOGGING_MXBEAN_NAME;
+
+    private static LoggingMXBean mbean = LogManager.getLoggingMXBean();
+    private LoggingMXBean proxyInstance = null;
+
+    // Internal trace level
+    private static final int TRACE_LEVEL = 10;
+
+    // Names of the attributes of ClassLoadingMXBean
+    private static final String GET_LOGGER_LEVEL = "getLoggerLevel";
+    private static final String SET_LOGGER_LEVEL = "setLoggerLevel";
+    private static final String GET_PARENT_LOGGER_NAME = "getParentLoggerName";
+    private static final String LOGGER_NAMES = "LoggerNames";
+
+    static {
+        Monitor.logPrefix = "LoggingMonitor> ";
+    }
+
+    /**
+     * Creates a new <code>LoggingMonitor</code> object.
+     *
+     * @param log <code>Log</code> object to print info to.
+     * @param argumentHandler <code>ArgumentHandler</code> object that saves
+     *        all info about test's arguments.
+     *
+     */
+    public LoggingMonitor(Log log, ArgumentHandler argumentHandler) {
+
+        super(log, argumentHandler);
+    }
+
+    public ObjectName getMBeanObjectName() {
+
+        return mbeanObjectName;
+    }
+
+    /**
+     *
+     * Return a proxy instance for a platform
+     * {@link java.lang.management.LoggingMXBean
+     * <code>LoggingMXBean</code>} interface.
+     *
+     */
+    LoggingMXBean getProxy() {
+        if (proxyInstance == null) {
+            // create proxy instance
+            try {
+                proxyInstance = (LoggingMXBean)
+                ManagementFactory.newPlatformMXBeanProxy(
+                    getMBeanServer(),
+                    LOGGING_MXBEAN_NAME,
+                    LoggingMXBean.class
+                );
+            } catch (Exception e) {
+                throw new Failure(e);
+            }
+        }
+        return proxyInstance;
+    }
+
+    /**
+     * Redirects the invocation to
+     * {@link java.util.logging.LoggingMXBean#getLoggerLevel(String)
+     * <code>LoggingMXBean.getLoggerLevel(String loggerName)</code>}.
+     *
+     * @param loggerName The name of the <tt>Logger</tt> to be retrieved.
+     *
+     * @return The name of the log level of the specified logger; or
+     *         an empty string if the log level of the specified logger
+     *         is <tt>null</tt>.  If the specified logger does not
+     *         exist, <tt>null</tt> is returned.
+     *
+     * @see java.util.logging.LoggingMXBean#getLoggerLevel(String)
+     */
+     public String getLoggerLevel(String loggerName) {
+
+        int mode = getTestMode();
+
+        switch (mode) {
+        case DIRECTLY_MODE:
+            logger.trace(TRACE_LEVEL,"[getLoggerLevel] "
+                       + "getLoggerLevel() directly invoked");
+            return mbean.getLoggerLevel(loggerName);
+
+        case SERVER_MODE:
+            logger.trace(TRACE_LEVEL,"[getLoggerLevel] "
+                       + "getLoggerLevel() invoked through MBeanServer");
+
+            try {
+
+                Object[] params = { loggerName };
+                String[] signature = { String.class.getName() };
+
+                String res = (String) getMBeanServer().invoke(
+                    mbeanObjectName,
+                    GET_LOGGER_LEVEL,
+                    params,
+                    signature );
+                return res;
+
+            } catch (Exception e) {
+
+                throw new Failure(e);
+            }
+        case PROXY_MODE:
+            logger.trace(TRACE_LEVEL,"[getLoggerLevel] "
+                       + "getLoggerLevel() invoked through MBeanServer proxy");
+            return getProxy().getLoggerLevel(loggerName);
+        }
+
+        throw new TestBug("Unknown testMode " + mode);
+    }
+
+
+    /**
+     * Redirects the invocation to
+     * {@link java.util.logging.LoggingMXBean#getLoggerNames()
+     * <code>LoggingMXBean.getLoggerNames()</code>}.
+     *
+     * @return A list of <tt>String</tt> each of which is a
+     *         currently registered <tt>Logger</tt> name.
+     *
+     * @see java.util.logging.LoggingMXBean#getLoggerNames()
+     */
+    public List<String> getLoggerNames() {
+
+        int mode = getTestMode();
+
+        switch (mode) {
+        case DIRECTLY_MODE:
+            logger.trace(TRACE_LEVEL,"[getLoggerNames] "
+                       + "getLoggerNames() directly invoked");
+            return mbean.getLoggerNames();
+
+        case SERVER_MODE:
+            logger.trace(TRACE_LEVEL,"[getLoggerNames] "
+                       + "getLoggerNames() invoked through MBeanServer");
+
+            try {
+
+                    Object value = getMBeanServer().getAttribute(
+                        mbeanObjectName, LOGGER_NAMES);
+                    if (value instanceof List)
+                            return (List<String>) value;
+                    else if (value instanceof Object[]) {
+                            Object[] names = (Object[]) value;
+                            List<String> res = new java.util.ArrayList<String>(names.length);
+                            for (int i=0; i < names.length; i++)
+                                    res.add(names[i].toString());
+
+                            return res;
+                    } else {
+                            String[] names = (String[]) getMBeanServer().getAttribute(
+                                            mbeanObjectName, LOGGER_NAMES);
+
+                            List<String> res = new java.util.ArrayList<String>(names.length);
+                            for (int i=0; i<names.length; i++)
+                                    res.add(names[i]);
+
+                            return res;
+                    }
+                    } catch (Exception e) {
+                            throw new Failure(e);
+                    }
+        case PROXY_MODE:
+            logger.trace(TRACE_LEVEL,"[getLoggerNames] "
+                       + "getLoggerNames() invoked through MBeanServer proxy");
+            return getProxy().getLoggerNames();
+        }
+
+        throw new TestBug("Unknown testMode " + mode);
+    }
+
+
+    /**
+     * Redirects the invocation to
+     * {@link java.util.logging.LoggingMXBean#getParentLoggerName(String)
+     * <code>LoggingMXBean.getParentLoggerName(String loggerName)</code>}.
+     *
+     * @param loggerName The name of a <tt>Logger</tt>.
+     *
+     * @return the name of the nearest existing parent logger;
+     *         an empty string if the specified logger is the root logger.
+     *         If the specified logger does not exist, <tt>null</tt>
+     *         is returned.
+     *
+     * @see java.util.logging.LoggingMXBean#getParentLoggerName(String)
+     */
+    public String getParentLoggerName(String loggerName) {
+
+        int mode = getTestMode();
+
+        switch (mode) {
+        case DIRECTLY_MODE:
+            logger.trace(TRACE_LEVEL,"[getParentLoggerName] "
+                       + "getParentLoggerName() directly invoked");
+            return mbean.getParentLoggerName(loggerName);
+
+        case SERVER_MODE:
+            logger.trace(TRACE_LEVEL,"[getParentLoggerName] "
+                       + "getParentLoggerName() invoked through MBeanServer");
+
+            try {
+
+                Object[] params = { loggerName };
+                String[] signature = { String.class.getName() };
+
+                String res = (String) getMBeanServer().invoke(
+                    mbeanObjectName,
+                    GET_PARENT_LOGGER_NAME,
+                    params,
+                    signature );
+                return res;
+
+            } catch (Exception e) {
+
+                throw new Failure(e);
+            }
+        case PROXY_MODE:
+            logger.trace(TRACE_LEVEL,"[getParentLoggerName] "
+                       + "getParentLoggerName() invoked through MBeanServer proxy");
+            return getProxy().getParentLoggerName(loggerName);
+        }
+
+        throw new TestBug("Unknown testMode " + mode);
+    }
+
+
+    /**
+     * Redirects the invocation to
+     * {@link java.util.logging.LoggingMXBean#setLoggerLevel(String,String)
+     * <code>LoggingMXBean.setLoggerLevel(String loggerName, String levelName)</code>}.
+     *
+     * @param loggerName The name of the <tt>Logger</tt> to be set.
+     *                   Must be non-null.
+     * @param levelName The name of the level to set the specified logger to,
+     *                 or <tt>null</tt> if to set the level to inherit
+     *                 from its nearest ancestor.
+     *
+     * @see java.util.logging.LoggingMXBean#setLoggerLevel(String,String)
+     */
+    public void setLoggerLevel(String loggerName, String levelName) {
+
+        int mode = getTestMode();
+
+        switch (mode) {
+        case DIRECTLY_MODE:
+            logger.trace(TRACE_LEVEL,"[setLoggerLevel] "
+                       + "setLoggerLevel() directly invoked");
+            mbean.setLoggerLevel(loggerName, levelName);
+            break;
+        case SERVER_MODE:
+            logger.trace(TRACE_LEVEL,"[setLoggerLevel] "
+                       + "setLoggerLevel() invoked through MBeanServer");
+
+            try {
+
+                Object[] params = { loggerName, levelName };
+                String[] signature = { String.class.getName(), String.class.getName() };
+
+                getMBeanServer().invoke(
+                    mbeanObjectName,
+                    SET_LOGGER_LEVEL,
+                    params,
+                    signature );
+
+            } catch (Exception e) {
+
+                throw new Failure(e);
+            }
+            break;
+        case PROXY_MODE:
+            logger.trace(TRACE_LEVEL,"[setLoggerLevel] "
+                       + "setLoggerLevel() invoked through MBeanServer proxy");
+            getProxy().setLoggerLevel(loggerName, levelName);
+            break;
+        }
+
+        throw new TestBug("Unknown testMode " + mode);
+    }
+
+} // LoggingMonitor
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/MemoryMonitor.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,1611 @@
+/*
+ * Copyright (c) 2003, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package nsk.monitoring.share;
+
+import java.lang.management.*;
+import javax.management.*;
+import javax.management.openmbean.*;
+import java.util.*;
+
+import nsk.share.*;
+
+/**
+ * <code>MemoryMonitor</code> class is a wrapper of <code>MemoryMXBean</code> and
+ * <code>MemoryPoolMXBean</code> interfaces. Depending on command line arguments,
+ * an instance of this class redirects invocations to the
+ * <code>MemoryMXBean</code> (or <code>MemoryPoolMXBean</code>) interface. If
+ * <code>-testMode="directly"</code> option is set, this instance directly
+ * invokes corresponding method of the <code>MemoryMXBean</code> (or
+ * <code>MemoryPoolMXBean</code>) interface. If <code>-testMode="server"</code>
+ * option is set it will make invocations via MBeanServer.
+ *
+ * @see ArgumentHandler
+ */
+public class MemoryMonitor extends Monitor implements NotificationListener,
+        NotificationFilter {
+
+    // Constants to define type of memory that will be allocated in
+    // MemoryMonitor. For heap memory objects will be allocated; for nonheap
+    // type classes will be loaded; for mixed type -- both (objects will be
+    // allocated and classes will be loaded).
+    public final static String HEAP_TYPE = "heap";
+    public final static String NONHEAP_TYPE = "nonheap";
+    public final static String MIXED_TYPE = "mixed";
+    // Names of the attributes of MemoryMXBean
+    private final static String POOL_TYPE = "Type";
+    private final static String POOL_RESET_PEAK = "resetPeakUsage";
+    private final static String POOL_PEAK = "PeakUsage";
+    private final static String POOL_VALID = "Valid";
+    private final static String POOL_U = "Usage";
+    private final static String UT = "UsageThreshold";
+    private final static String UT_COUNT = "UsageThresholdCount";
+    private final static String UT_SUPPORT = "UsageThresholdSupported";
+    private final static String UT_EXCEEDED = "UsageThresholdExceeded";
+    private final static String POOL_CU = "CollectionUsage";
+    private final static String CT = "CollectionUsageThreshold";
+    private final static String CT_COUNT = "CollectionUsageThresholdCount";
+    private final static String CT_SUPPORT = "CollectionUsageThresholdSupported";
+    private final static String CT_EXCEEDED = "CollectionUsageThresholdExceeded";
+    // Varibales to store options that are passed to the test
+    private static String memory;
+    private static int mode;
+    private static boolean isNotification;
+    private static boolean isUsageThreshold;
+    private static volatile boolean passed = true;
+    private Polling polling = new Polling();
+
+    static {
+        Monitor.logPrefix = "MemoryMonitor   > ";
+    }
+
+    /**
+     * Creates a new <code>MemoryMonitor</code> object.
+     *
+     * @param log <code>Log</code> object to print info to.
+     * @param handler <code>ArgumentHandler</code> object that saves
+     *        all info about test's arguments.
+     *
+     */
+    public MemoryMonitor(Log log, ArgumentHandler handler) {
+        super(log, handler);
+
+        memory = handler.getTestedMemory();
+        mode = getTestMode();
+        isNotification = (handler.MON_NOTIF.equals(handler.getMonitoring()));
+        isUsageThreshold = (handler.TH_USAGE.equals(handler.getThreshold()));
+
+        String s = "\t(This setting is used in lowmem* tests only)";
+
+        display("Memory:\t" + handler.getTestedMemory() + s);
+        display("Monitoring:\t" + handler.getMonitoring() + s);
+        display("Threshold:\t" + handler.getThreshold() + s);
+        display("Timeout:\t" + handler.getTimeout() + s);
+    }
+
+    /**
+     * Returns <code>true</code> if no failures were revealed during the test,
+     * <code>false</code> otherwise.
+     *
+     * @return <code>true</code> if no failures were revealed during the test,
+     * <code>false</code> otherwise.
+     *
+     */
+    public boolean getPassedStatus() {
+        return passed;
+    }
+
+    /**
+     * Enables memory monitoring.
+     * <p>
+     * If notification type of monitoring is chosen, the method adds {@link
+     * javax.management.NotificationListener
+     * <code>javax.management.NotificationListener</code>} to enables low
+     * memory detection support. If monitoring type is polling, a new thread
+     * that manages the low memory detection is started.
+     *
+     * @throws InstanceNotFoundException The MemoryMXBean is not registered on
+     *                                   the server.
+     */
+    public void enableMonitoring() throws InstanceNotFoundException {
+        if (isNotification) {
+            switch (mode) {
+                case DIRECTLY_MODE:
+                    MemoryMXBean mbean = ManagementFactory.getMemoryMXBean();
+                    NotificationEmitter emitter = (NotificationEmitter) mbean;
+                    emitter.addNotificationListener(this, this, null);
+                    break;
+
+                case SERVER_MODE:
+                case PROXY_MODE:
+                    getMBeanServer().addNotificationListener(mbeanObjectName,
+                            this, this, null);
+                    break;
+
+                default:
+                    throw new TestBug("Unknown testMode " + mode);
+            }
+        } else {
+
+            // Polling
+            // Start a thread that will manage all test modes
+            polling.start();
+
+        }
+    } // enableMonitoring()
+
+    /**
+     * Disables memory monitoring.
+     * <p>
+     * If monitoring type is polling, the thread that manages the low memory
+     * detection is stopped.
+     */
+    public void disableMonitoring() {
+        if (!isNotification) {
+
+            // Stop polling thread
+            polling.goOn = false;
+        }
+    } // disableMonitoring()
+
+    /**
+     * Updates thresholds. Thresholds values for all pools will be greater
+     * than <code>used</code> value.
+     * <p>
+     * If <code>usage</code> thresholds are chosen, the method updates just
+     * pools that support usage thresholds. If <code>collection</code>
+     * thresholds are chosen, the method updates memory pools that support
+     * collection usage thresholds.
+     *
+     * This method is synchronized because it may be invoked from
+     * <code>handleNotification</code> which is potentially done from
+     * multiple threads.
+     */
+    public synchronized void updateThresholds() {
+        if (isUsageThreshold) {
+            updateUsageThresholds();
+        } else {
+            updateCollectionThresholds();
+        }
+    }
+
+    /**
+     * Reset thresholds. Thresholds values for all pools will be 1.
+     * If <code>usage</code> thresholds are chosen, the method updates just
+     * pools that support usage thresholds. If <code>collection</code>
+     * thresholds are chosen, the method updates memory pools that support
+     * collection usage thresholds.
+     *
+     * This method is synchronized because it may be invoked from
+     * multiple threads.
+     */
+    public synchronized void resetThresholds(MemoryType type) {
+        List pools = getMemoryPoolMBeans();
+        for (int i = 0; i < pools.size(); i++) {
+            Object pool = pools.get(i);
+            if (isUsageThresholdSupported(pool)) {
+                if (getType(pool).equals(type)) {
+                    setUsageThreshold(pool, 1);
+                }
+            }
+        }
+    }
+
+    /**
+     * The method is invoked before sending the notification to the listener.
+     *
+     * @param notification The notification to be sent.
+     * @return <i>true</i> if the notification has to be sent to the listener;
+     *         <i>false</i> otherwise.
+     *
+     * @see javax.management.NotificationFilter
+     */
+    public boolean isNotificationEnabled(Notification notification) {
+        String type = notification.getType();
+        String usage = MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED;
+        String collection = MemoryNotificationInfo.MEMORY_COLLECTION_THRESHOLD_EXCEEDED;
+
+        if (isUsageThreshold) {
+            return type.equals(usage);
+        } else {
+            return type.equals(collection);
+        }
+    } // isNotificationEnabled()
+
+    /**
+     * The method is invoked when a JMX notification occurs.
+     *
+     * @param notification The notification to be sent.
+     * @param handback An opaque object which helps the listener to associate
+     *        information regarding the MBean emitter.
+     * @see javax.management.NotificationListener
+     */
+    public void handleNotification(Notification notification, Object handback) {
+        CompositeData data = (CompositeData) notification.getUserData();
+        MemoryNotificationInfo mn = MemoryNotificationInfo.from(data);
+
+        display(mn.getCount() + " notification \"" + notification.getMessage()
+                + "\" is caught on " + (new Date(notification.getTimeStamp()))
+                + " by " + mn.getPoolName() + " (" + mn.getUsage() + ")");
+        updateThresholds();
+    } // handleNotification()
+
+    /**
+     * Redirects the invocation to {@link
+     * java.lang.management.MemoryPoolMXBean#resetPeakUsage
+     * <code>MemoryPoolMXBean.resetPeakUsage()</code>}.
+     *
+     * @param poolObject reference to the pool. The pool may be specified
+     *        either by <code>ObjectName</code>, or
+     *        <code>MemoryPoolMXBean</code>.
+     */
+    public void resetPeakUsage(Object poolObject) {
+        switch (mode) {
+            case DIRECTLY_MODE:
+                MemoryPoolMXBean directPool = (MemoryPoolMXBean) poolObject;
+                directPool.resetPeakUsage();
+                break;
+
+            case SERVER_MODE:
+                ObjectName serverPool = (ObjectName) poolObject;
+
+                try {
+                    getMBeanServer().invoke(serverPool, POOL_RESET_PEAK,
+                            null, null);
+                } catch (Exception e) {
+                    e.printStackTrace(logger.getOutStream());
+                    throw new Failure(e);
+                }
+                break;
+
+            case PROXY_MODE:
+                MemoryPoolMXBean proxyPool = (MemoryPoolMXBean) poolObject;
+                proxyPool.resetPeakUsage();
+                break;
+
+            default:
+                throw new TestBug("Unknown testMode " + mode);
+        }
+    } // resetPeakUsage()
+
+    /**
+     * Redirects the invocation to {@link
+     * java.lang.management.MemoryPoolMXBean#getPeakUsage
+     * <code>MemoryPoolMXBean.getPeakUsage()</code>}.
+     *
+     * @param poolObject reference to the pool. The pool may be specified
+     *        either by <code>ObjectName</code>, or
+     *        <code>MemoryPoolMXBean</code>.
+     * @return a <code>MemoryUsage</code> object representing the peak memory
+     *         usage; <code>null</code> otherwise.
+     */
+    public MemoryUsage getPeakUsage(Object poolObject) {
+        switch (mode) {
+            case DIRECTLY_MODE:
+                MemoryPoolMXBean directPool = (MemoryPoolMXBean) poolObject;
+                return directPool.getPeakUsage();
+
+            case SERVER_MODE:
+                ObjectName serverPool = (ObjectName) poolObject;
+                return getMemoryUsageAttribute(serverPool, POOL_PEAK);
+
+            case PROXY_MODE:
+                MemoryPoolMXBean proxyPool = (MemoryPoolMXBean) poolObject;
+                return proxyPool.getPeakUsage();
+
+            default:
+                throw new TestBug("Unknown testMode " + mode);
+        }
+    } // getPeakUsage()
+
+    /**
+     * Redirects the invocation to {@link
+     * java.lang.management.MemoryPoolMXBean#getUsage
+     * <code>MemoryPoolMXBean.getUsage()</code>}.
+     *
+     * @param poolObject reference to the pool. The pool may be specified
+     *        either by <code>ObjectName</code>, or
+     *        <code>MemoryPoolMXBean</code>.
+     * @return a <code>MemoryUsage</code> object; or <code>null</code> if this
+     *         pool not valid.
+     */
+    public MemoryUsage getUsage(Object poolObject) {
+        switch (mode) {
+            case DIRECTLY_MODE:
+                MemoryPoolMXBean directPool = (MemoryPoolMXBean) poolObject;
+                return directPool.getUsage();
+
+            case SERVER_MODE:
+                ObjectName serverPool = (ObjectName) poolObject;
+                return getUsageOnServer(serverPool);
+
+            case PROXY_MODE:
+                MemoryPoolMXBean proxyPool = (MemoryPoolMXBean) poolObject;
+                return proxyPool.getUsage();
+
+            default:
+                throw new TestBug("Unknown testMode " + mode);
+        }
+    } // getUsage()
+
+    /**
+     * Redirects the invocation to {@link
+     * java.lang.management.MemoryPoolMXBean#getCollectionUsage
+     * <code>MemoryPoolMXBean.getCollectionUsage()</code>}.
+     *
+     * @param poolObject reference to the pool. The pool may be specified
+     *        either by <code>ObjectName</code>, or
+     *        <code>MemoryPoolMXBean</code>.
+     * @return a <code>MemoryUsage</code> object; or <code>null</code> if this
+     *         method is not supported.
+     */
+    public MemoryUsage getCollectionUsage(Object poolObject) {
+        switch (mode) {
+            case DIRECTLY_MODE:
+                MemoryPoolMXBean directPool = (MemoryPoolMXBean) poolObject;
+                return directPool.getCollectionUsage();
+
+            case SERVER_MODE:
+                ObjectName serverPool = (ObjectName) poolObject;
+                return getCollectionUsageOnServer(serverPool);
+
+            case PROXY_MODE:
+                MemoryPoolMXBean proxyPool = (MemoryPoolMXBean) poolObject;
+                return proxyPool.getCollectionUsage();
+
+            default:
+                throw new TestBug("Unknown testMode " + mode);
+        }
+    } // getCollectionUsage()
+
+    /**
+     * Redirects the invocation to {@link
+     * java.lang.management.MemoryPoolMXBean#isValid
+     * <code>MemoryPoolMXBean.isValid()</code>}.
+     *
+     * @param poolObject reference to the pool. The pool may be specified
+     *        either by <code>ObjectName</code>, or
+     *        <code>MemoryPoolMXBean</code>.
+     * @return a <code>true</code> if the memory pool is valid in the running
+     *         JVM; <code>null</code> otherwise.
+     */
+    public boolean isValid(Object poolObject) {
+        switch (mode) {
+            case DIRECTLY_MODE:
+                MemoryPoolMXBean directPool = (MemoryPoolMXBean) poolObject;
+                return directPool.isValid();
+
+            case SERVER_MODE:
+                ObjectName serverPool = (ObjectName) poolObject;
+                return getBooleanAttribute(serverPool, POOL_VALID);
+
+            case PROXY_MODE:
+                MemoryPoolMXBean proxyPool = (MemoryPoolMXBean) poolObject;
+                return proxyPool.isValid();
+
+            default:
+                throw new TestBug("Unknown testMode " + mode);
+        }
+    } // isValid()
+
+    /**
+     * Redirects the invocation to {@link
+     * java.lang.management.MemoryPoolMXBean#isUsageThresholdSupported
+     * <code>MemoryPoolMXBean.isUsageThresholdSupported()</code>}.
+     *
+     * @param poolObject reference to the pool. The pool may be specified
+     *        either by <code>ObjectName</code>, or
+     *        <code>MemoryPoolMXBean</code>.
+     * @return a <code>true</code> if the memory pool supports usage threshold;
+     *         <code>null</code> otherwise.
+     */
+    public boolean isUsageThresholdSupported(Object poolObject) {
+        switch (mode) {
+            case DIRECTLY_MODE:
+                MemoryPoolMXBean directPool = (MemoryPoolMXBean) poolObject;
+                return directPool.isUsageThresholdSupported();
+
+            case SERVER_MODE:
+                ObjectName serverPool = (ObjectName) poolObject;
+                return isUsageThresholdSupportedOnServer(serverPool);
+
+            case PROXY_MODE:
+                MemoryPoolMXBean proxyPool = (MemoryPoolMXBean) poolObject;
+                return proxyPool.isUsageThresholdSupported();
+
+            default:
+                throw new TestBug("Unknown testMode " + mode);
+        }
+    } // isUsageThresholdSupported()
+
+    /**
+     * Redirects the invocation to {@link
+     * java.lang.management.MemoryPoolMXBean#isCollectionUsageThresholdSupported
+     * <code>MemoryPoolMXBean.isCollectionUsageThresholdSupported()</code>}.
+     *
+     * @param poolObject reference to the pool. The pool may be specified
+     *        either by <code>ObjectName</code>, or
+     *        <code>MemoryPoolMXBean</code>.
+     * @return a <code>true</code> if the memory pool supports collection
+     *         usage threshold; <code>null</code> otherwise.
+     */
+    public boolean isCollectionThresholdSupported(Object poolObject) {
+        switch (mode) {
+            case DIRECTLY_MODE:
+                MemoryPoolMXBean directPool = (MemoryPoolMXBean) poolObject;
+                return directPool.isCollectionUsageThresholdSupported();
+
+            case SERVER_MODE:
+                ObjectName serverPool = (ObjectName) poolObject;
+                return isCollectionThresholdSupportedOnServer(serverPool);
+
+            case PROXY_MODE:
+                MemoryPoolMXBean proxyPool = (MemoryPoolMXBean) poolObject;
+                return proxyPool.isCollectionUsageThresholdSupported();
+
+            default:
+                throw new TestBug("Unknown testMode " + mode);
+        }
+    } // isCollectionThresholdSupported()
+
+    /**
+     * Redirects the invocation to {@link
+     * java.lang.management.MemoryPoolMXBean#isUsageThresholdExceeded
+     * <code>MemoryPoolMXBean.isUsageThresholdExceeded()</code>}.
+     *
+     * @param poolObject reference to the pool. The pool may be specified
+     *        either by <code>ObjectName</code>, or
+     *        <code>MemoryPoolMXBean</code>.
+     * @return a <code>true</code> if the memory usage of this pool reaches or
+     *         exceeds the threshold value; <code>null</code> otherwise.
+     */
+    public boolean isUsageThresholdExceeded(Object poolObject) {
+        switch (mode) {
+            case DIRECTLY_MODE:
+                MemoryPoolMXBean directPool = (MemoryPoolMXBean) poolObject;
+                return directPool.isUsageThresholdExceeded();
+
+            case SERVER_MODE:
+                ObjectName serverPool = (ObjectName) poolObject;
+                return isUsageThresholdExceededOnServer(serverPool);
+
+            case PROXY_MODE:
+                MemoryPoolMXBean proxyPool = (MemoryPoolMXBean) poolObject;
+                return proxyPool.isUsageThresholdExceeded();
+
+            default:
+                throw new TestBug("Unknown testMode " + mode);
+        }
+    } // isUsageThresholdExceeded()
+
+    /**
+     * Redirects the invocation to {@link
+     * java.lang.management.MemoryPoolMXBean#isCollectionUsageThresholdExceeded
+     * <code>MemoryPoolMXBean.isCollectionUsageThresholdExceeded()</code>}.
+     *
+     * @param poolObject reference to the pool. The pool may be specified
+     *        either by <code>ObjectName</code>, or
+     *        <code>MemoryPoolMXBean</code>.
+     * @return a <code>true</code> if the memory usage of this pool reaches or
+     *         exceeds the collection usage threshold value in the most recent
+     *         collection; <code>null</code> otherwise.
+     */
+    public boolean isCollectionThresholdExceeded(Object poolObject) {
+        switch (mode) {
+            case DIRECTLY_MODE:
+                MemoryPoolMXBean directPool = (MemoryPoolMXBean) poolObject;
+                return directPool.isCollectionUsageThresholdExceeded();
+
+            case SERVER_MODE:
+                ObjectName serverPool = (ObjectName) poolObject;
+                return isCollectionThresholdExceededOnServer(serverPool);
+
+            case PROXY_MODE:
+                MemoryPoolMXBean proxyPool = (MemoryPoolMXBean) poolObject;
+                return proxyPool.isCollectionUsageThresholdExceeded();
+
+            default:
+                throw new TestBug("Unknown testMode " + mode);
+        }
+    } // isCollectionThresholdExceeded()
+
+    /**
+     * Redirects the invocation to {@link
+     * java.lang.management.MemoryPoolMXBean#getUsageThreshold
+     * <code>MemoryPoolMXBean.getUsageThreshold()</code>}.
+     *
+     * @param poolObject reference to the pool. The pool may be specified
+     *        either by <code>ObjectName</code>, or
+     *        <code>MemoryPoolMXBean</code>.
+     * @return the usage threshold value of this memory pool in bytes.
+     */
+    public long getUsageThreshold(Object poolObject) {
+        switch (mode) {
+            case DIRECTLY_MODE:
+                MemoryPoolMXBean directPool = (MemoryPoolMXBean) poolObject;
+                return directPool.getUsageThreshold();
+
+            case SERVER_MODE:
+                ObjectName serverPool = (ObjectName) poolObject;
+                return getUsageThresholdOnServer(serverPool);
+
+            case PROXY_MODE:
+                MemoryPoolMXBean proxyPool = (MemoryPoolMXBean) poolObject;
+                return proxyPool.getUsageThreshold();
+
+            default:
+                throw new TestBug("Unknown testMode " + mode);
+        }
+    } // getUsageThreshold()
+
+    /**
+     * Redirects the invocation to {@link
+     * java.lang.management.MemoryPoolMXBean#getCollectionUsageThreshold
+     * <code>MemoryPoolMXBean.getCollectionUsageThreshold()</code>}.
+     *
+     * @param poolObject reference to the pool. The pool may be specified
+     *        either by <code>ObjectName</code>, or
+     *        <code>MemoryPoolMXBean</code>.
+     * @return the collection usage threshold value of this memory pool in
+     *         bytes.
+     */
+    public long getCollectionThreshold(Object poolObject) {
+        switch (mode) {
+            case DIRECTLY_MODE:
+                MemoryPoolMXBean directPool = (MemoryPoolMXBean) poolObject;
+                return directPool.getCollectionUsageThreshold();
+
+            case SERVER_MODE:
+                ObjectName serverPool = (ObjectName) poolObject;
+                return getCollectionThresholdOnServer(serverPool);
+
+            case PROXY_MODE:
+                MemoryPoolMXBean proxyPool = (MemoryPoolMXBean) poolObject;
+                return proxyPool.getCollectionUsageThreshold();
+
+            default:
+                throw new TestBug("Unknown testMode " + mode);
+        }
+    } // getCollectionThreshold()
+
+    /**
+     * Redirects the invocation to {@link
+     * java.lang.management.MemoryPoolMXBean#getUsageThresholdCount
+     * <code>MemoryPoolMXBean.getUsageThresholdCount()</code>}.
+     *
+     * @param poolObject reference to the pool. The pool may be specified
+     *        either by <code>ObjectName</code>, or
+     *        <code>MemoryPoolMXBean</code>.
+     * @return number of times that the memory usage has crossed its usage
+     *         threshold value.
+     */
+    public long getUsageThresholdCount(Object poolObject) {
+        switch (mode) {
+            case DIRECTLY_MODE:
+                MemoryPoolMXBean directPool = (MemoryPoolMXBean) poolObject;
+                return directPool.getUsageThresholdCount();
+
+            case SERVER_MODE:
+                ObjectName serverPool = (ObjectName) poolObject;
+                return getUsageThresholdCountOnServer(serverPool);
+
+            case PROXY_MODE:
+                MemoryPoolMXBean proxyPool = (MemoryPoolMXBean) poolObject;
+                return proxyPool.getUsageThresholdCount();
+
+            default:
+                throw new TestBug("Unknown testMode " + mode);
+        }
+    } // getUsageThresholdCount()
+
+    /**
+     * Redirects the invocation to {@link
+     * java.lang.management.MemoryPoolMXBean#getCollectionUsageThresholdCount
+     * <code>MemoryPoolMXBean.getCollectionUsageThresholdCount()</code>}.
+     *
+     * @param poolObject reference to the pool. The pool may be specified
+     *        either by <code>ObjectName</code>, or
+     *        <code>MemoryPoolMXBean</code>.
+     * @return number of times that the memory usage has crossed its collection
+     *         usage threshold value.
+     */
+    public long getCollectionThresholdCount(Object poolObject) {
+        switch (mode) {
+            case DIRECTLY_MODE:
+                MemoryPoolMXBean directPool = (MemoryPoolMXBean) poolObject;
+                return directPool.getCollectionUsageThresholdCount();
+
+            case SERVER_MODE:
+                ObjectName serverPool = (ObjectName) poolObject;
+                return getCollectionThresholdCountOnServer(serverPool);
+
+            case PROXY_MODE:
+                MemoryPoolMXBean proxyPool = (MemoryPoolMXBean) poolObject;
+                return proxyPool.getCollectionUsageThresholdCount();
+
+            default:
+                throw new TestBug("Unknown testMode " + mode);
+        }
+    } // getCollectionThresholdCount()
+
+    /**
+     * Redirects the invocation to {@link
+     * java.lang.management.MemoryPoolMXBean#setUsageThreshold
+     * <code>MemoryPoolMXBean.setUsageThreshold()</code>}.
+     *
+     * @param poolObject reference to the pool. The pool may be specified
+     *        either by <code>ObjectName</code>, or
+     *        <code>MemoryPoolMXBean</code>.
+     * @param threshold the new threshold value.
+     */
+    public void setUsageThreshold(Object poolObject, long threshold) {
+        switch (mode) {
+            case DIRECTLY_MODE:
+                MemoryPoolMXBean directPool = (MemoryPoolMXBean) poolObject;
+                directPool.setUsageThreshold(threshold);
+                break;
+
+            case SERVER_MODE:
+                ObjectName serverPool = (ObjectName) poolObject;
+                setUsageThresholdOnServer(serverPool, threshold);
+                break;
+
+            case PROXY_MODE:
+                MemoryPoolMXBean proxyPool = (MemoryPoolMXBean) poolObject;
+                proxyPool.setUsageThreshold(threshold);
+                break;
+
+            default:
+                throw new TestBug("Unknown testMode " + mode);
+        }
+    } // setUsageThreshold()
+
+    /**
+     * Redirects the invocation to {@link
+     * java.lang.management.MemoryPoolMXBean#setCollectionUsageThreshold
+     * <code>MemoryPoolMXBean.setCollectionUsageThreshold()</code>}.
+     *
+     * @param poolObject reference to the pool. The pool may be specified
+     *        either by <code>ObjectName</code>, or
+     *        <code>MemoryPoolMXBean</code>.
+     * @param threshold the new collection usage threshold value.
+     */
+    public void setCollectionThreshold(Object poolObject, long threshold) {
+        switch (mode) {
+            case DIRECTLY_MODE:
+                MemoryPoolMXBean directPool = (MemoryPoolMXBean) poolObject;
+                directPool.setCollectionUsageThreshold(threshold);
+                break;
+
+            case SERVER_MODE:
+                ObjectName serverPool = (ObjectName) poolObject;
+                setCollectionThresholdOnServer(serverPool, threshold);
+                break;
+
+            case PROXY_MODE:
+                MemoryPoolMXBean proxyPool = (MemoryPoolMXBean) poolObject;
+                proxyPool.setCollectionUsageThreshold(threshold);
+                break;
+
+            default:
+                throw new TestBug("Unknown testMode " + mode);
+        }
+    } // setCollectionThreshold()
+
+    /**
+     * Redirects the invocation to {@link
+     * java.lang.management.MemoryPoolMXBean#getName
+     * <code>MemoryPoolMXBean.getName()</code>}.
+     *
+     * @param poolObject reference to the pool. The pool may be specified
+     *        either by <code>ObjectName</code>, or
+     *        <code>MemoryPoolMXBean</code>.
+     * @return the name of the memory pool.
+     */
+    public String getName(Object poolObject) {
+        switch (mode) {
+            case DIRECTLY_MODE:
+                MemoryPoolMXBean directPool = (MemoryPoolMXBean) poolObject;
+                return directPool.getName();
+
+            case SERVER_MODE:
+                ObjectName serverPool = (ObjectName) poolObject;
+                return serverPool.toString();
+
+            case PROXY_MODE:
+                MemoryPoolMXBean proxyPool = (MemoryPoolMXBean) poolObject;
+                return proxyPool.getName();
+
+            default:
+                throw new TestBug("Unknown testMode " + mode);
+        }
+    } // getName()
+
+    /**
+     * Redirects the invocation to {@link
+     * java.lang.management.MemoryPoolMXBean#getType
+     * <code>MemoryPoolMXBean.getType()</code>}.
+     *
+     * @param poolObject reference to the pool. The pool may be specified
+     *        either by <code>ObjectName</code>, or
+     *        <code>MemoryPoolMXBean</code>.
+     * @return the name of the memory pool.
+     */
+    public MemoryType getType(Object poolObject) {
+        switch (mode) {
+            case DIRECTLY_MODE:
+                MemoryPoolMXBean directPool = (MemoryPoolMXBean) poolObject;
+                return directPool.getType();
+
+            case SERVER_MODE:
+                ObjectName serverPool = (ObjectName) poolObject;
+                return getType(serverPool);
+
+            case PROXY_MODE:
+                MemoryPoolMXBean proxyPool = (MemoryPoolMXBean) poolObject;
+                return proxyPool.getType();
+
+            default:
+                throw new TestBug("Unknown testMode " + mode);
+        }
+    }
+
+    /**
+     * Redirects the invocation to {@link
+     * java.lang.management.ManagementFactory#getMemoryPoolMXBeans
+     * <code>ManagementFactory.getMemoryPoolMXBeans()</code>}.
+     *
+     * @return a list of <code>MemoryPoolMXBean</code> objects.
+     */
+    public List<? extends Object> getMemoryPoolMBeans() {
+        switch (mode) {
+            case DIRECTLY_MODE:
+                return ManagementFactory.getMemoryPoolMXBeans();
+
+            case SERVER_MODE: {
+                ObjectName[] names = getMemoryPoolMXBeansOnServer();
+                ArrayList<ObjectName> list = new ArrayList<ObjectName>();
+
+                for (int i = 0; i < names.length; i++) {
+                    list.add(names[i]);
+                }
+                return list;
+            }
+
+            case PROXY_MODE: {
+                ObjectName[] names = getMemoryPoolMXBeansOnServer();
+                ArrayList<MemoryPoolMXBean> list = new ArrayList<MemoryPoolMXBean>();
+
+                for (int i = 0; i < names.length; i++) {
+                    list.add(getProxy(names[i]));
+                }
+                return list;
+            }
+
+            default:
+                throw new TestBug("Unknown testMode " + mode);
+        }
+    } // getMemoryPoolMXBeans()
+
+    // **********************************************************************
+    //
+    // Private methods
+    //
+    // **********************************************************************
+    private MemoryPoolMXBean getProxy(ObjectName objectName) {
+        try {
+            MemoryPoolMXBean proxy = (MemoryPoolMXBean) ManagementFactory.newPlatformMXBeanProxy(
+                    getMBeanServer(),
+                    objectName.toString(),
+                    MemoryPoolMXBean.class);
+            return proxy;
+        } catch (Exception e) {
+            throw new Failure(e);
+        }
+    }
+
+    // Sets new usage threasholds in all pools that match the tested memory and
+    // support low memory detetion. A new value will be greater than used value
+    // for the pool.
+    private void updateUsageThresholds() {
+        switch (mode) {
+            case DIRECTLY_MODE:
+            // we can use the same code here for direct and proxy modes
+            case PROXY_MODE:
+                List poolsMBean = ManagementFactory.getMemoryPoolMXBeans();
+
+                for (int i = 0; i < poolsMBean.size(); i++) {
+                    MemoryPoolMXBean pool = (MemoryPoolMXBean) poolsMBean.get(i);
+                    if (!pool.isUsageThresholdSupported()) {
+                        continue;
+                    }
+
+                    MemoryType mt = pool.getType();
+                    if ((!mt.equals(MemoryType.HEAP)
+                            || !memory.equals(HEAP_TYPE))
+                            && (!mt.equals(MemoryType.NON_HEAP)
+                            || !memory.equals(NONHEAP_TYPE))
+                            && !memory.equals(MIXED_TYPE)) {
+                        continue;
+                    }
+
+                    // Yes! We got the pool that
+                    // 1. supports usage threshold
+                    // 2. has type that match tested type
+                    // So, update the pool with new threshold
+                    long oldT = pool.getUsageThreshold();
+                    MemoryUsage usage = pool.getUsage();
+                    long newT = newThreshold(usage, oldT, pool.getName());
+
+                    try {
+                        pool.setUsageThreshold(newT);
+                    } catch (IllegalArgumentException e) {
+                        /*
+                         * Max value might have changed since the call to newThreshold()
+                         * above. If it has fallen below the value of newT, which is certainly
+                         * possible, an exception like this one will be thrown from
+                         * sun.management.MemoryPoolImpl.setUsageThreshold():
+                         *
+                         * java.lang.IllegalArgumentException: Invalid threshold: 48332800 > max (47251456).
+                         *
+                         * We don't know the max value at the time of the failed call, and it
+                         * might have changed since the call once more. So there is no point
+                         * trying to detect whether the IllegalArgumentException had been
+                         * justified, we cannot know it at this point.
+                         *
+                         * The best we can do is log the fact and continue.
+                         */
+                        displayInfo("setUsageThreshold() failed with " + e + ", ignoring... ",
+                                pool,
+                                "current usage after the call to setUsageThreshold(): ", getUsage(pool),
+                                "threshold: ", newT);
+                        continue;
+                    }
+                    displayInfo("Usage threshold is set", pool, "usage: ", pool.getUsage(), "threshold: ", pool.getUsageThreshold());
+                    if (pool.getUsageThreshold() != newT) {
+                        complain("Cannot reset usage threshold from " + oldT
+                                + " to " + newT + " in pool " + pool.getName() + " "
+                                + pool.getUsageThreshold());
+                        passed = false;
+                    }
+                } // for i
+                break;
+
+            case SERVER_MODE:
+                ObjectName[] pools = getMemoryPoolMXBeansOnServer();
+
+                for (int i = 0; i < pools.length; i++) {
+                    if (!isUsageThresholdSupportedOnServer(pools[i])) {
+                        continue;
+                    }
+
+                    MemoryType mt = getType(pools[i]);
+                    if ((!mt.equals(MemoryType.HEAP)
+                            || !memory.equals(HEAP_TYPE))
+                            && (!mt.equals(MemoryType.NON_HEAP)
+                            || !memory.equals(NONHEAP_TYPE))
+                            && !memory.equals(MIXED_TYPE)) {
+                        continue;
+                    }
+
+                    // Yes! We got the pool that
+                    // 1. supports usage threshold
+                    // 2. has type that match tested type
+                    // So, update the pool with new threshold
+                    long oldT = getUsageThreshold(pools[i]);
+                    long newT = newThreshold(getUsageOnServer(pools[i]), oldT,
+                            pools[i].toString());
+                    try {
+                        setUsageThresholdOnServer(pools[i], newT);
+                    } catch (Failure e) {
+                        /*
+                         * Max value might have changed since the call to newThreshold()
+                         * above. If it has fallen below the value of newT, which is certainly
+                         * possible, an exception like this one will be thrown from
+                         * sun.management.MemoryPoolImpl.setUsageThreshold():
+                         *
+                         * java.lang.IllegalArgumentException: Invalid threshold: 48332800 > max (47251456).
+                         *
+                         * and we'll catch Failure here as a result (it'll be thrown by
+                         * Monitor.setLongAttribute).
+                         *
+                         * We don't know the max value at the time of the failed call, and it
+                         * might have changed since the call once more. So there is no point
+                         * trying to detect whether the IllegalArgumentException had been
+                         * justified, we cannot know it at this point.
+                         *
+                         * The best we can do is log the fact and continue.
+                         */
+                        displayInfo("setUsageThresholdOnServer() failed with " + e + ", ignoring... ",
+                                pools[i],
+                                "current usage after the call to setUsageThresholdOnServer(): ", getUsageOnServer(pools[i]),
+                                "threshold: ", newT);
+                        continue;
+                    }
+                    displayInfo("Usage threshold is set", null, "pool: ", pools[i], "usage:", getUsageOnServer(pools[i]));
+                    if (getUsageThreshold(pools[i]) != newT) {
+                        complain("Cannot reset usage threshold from " + oldT + " to "
+                                + newT + " in pool " + pools[i].toString());
+                        passed = false;
+                    }
+                } // for i
+                break;
+
+            default:
+                throw new TestBug("Unknown testMode " + mode);
+        }
+    } // updateUsageThresholds()
+
+    // Sets new collection usage threasholds in all pools that match the tested
+    // memory and support low memory detetion. A new value will be greater than
+    // used value for the pool.
+    private void updateCollectionThresholds() {
+        switch (mode) {
+            case DIRECTLY_MODE:
+            // we can use the same code here for direct and proxy modes
+            case PROXY_MODE:
+                List poolsMBean = ManagementFactory.getMemoryPoolMXBeans();
+
+                for (int i = 0; i < poolsMBean.size(); i++) {
+                    MemoryPoolMXBean pool = (MemoryPoolMXBean) poolsMBean.get(i);
+                    if (!pool.isCollectionUsageThresholdSupported()) {
+                        continue;
+                    }
+
+                    MemoryType mt = pool.getType();
+                    if ((!mt.equals(MemoryType.HEAP)
+                            || !memory.equals(HEAP_TYPE))
+                            && (!mt.equals(MemoryType.NON_HEAP)
+                            || !memory.equals(NONHEAP_TYPE))
+                            && !memory.equals(MIXED_TYPE)) {
+                        continue;
+                    }
+
+                    // Yes! We got the pool that
+                    // 1. supports collection threshold
+                    // 2. has type that match tested type
+                    // So, update the pool with new threshold
+                    long oldT = pool.getCollectionUsageThreshold();
+                    MemoryUsage usage = pool.getUsage();
+                    long newT = newThreshold(usage, oldT, pool.getName());
+
+                    try {
+                        pool.setCollectionUsageThreshold(newT);
+                    } catch (IllegalArgumentException e) {
+
+                        /*
+                         * Max value might have changed since the call to newThreshold()
+                         * above. If it has fallen below the value of newT, which is certainly
+                         * possible, an exception like this one will be thrown from
+                         * sun.management.MemoryPoolImpl.setCollectionUsageThreshold():
+                         *
+                         * java.lang.IllegalArgumentException: Invalid threshold: 48332800 > max (47251456).
+                         *
+                         * We don't know the max value at the time of the failed call, and it
+                         * might have changed since the call once more. So there is no point
+                         * trying to detect whether the IllegalArgumentException had been
+                         * justified, we cannot know it at this point.
+                         *
+                         * The best we can do is log the fact and continue.
+                         */
+                        displayInfo("setCollectionUsageThreshold() failed with " + e + ", ignoring... ",
+                                pool,
+                                "current usage after the call to setCollectionUsageThreshold(): ", getUsage(pool),
+                                "threshold: ", newT);
+                        continue;
+                    }
+                    displayInfo("Collection threshold is set", pool, "usage: ", getUsage(pool), "threshold: ", newT);
+                    if (pool.getCollectionUsageThreshold() != newT) {
+                        complain("Cannot reset collection threshold from " + oldT
+                                + " to " + newT + " in pool " + pool.getName() + " "
+                                + pool.getCollectionUsageThreshold());
+                        passed = false;
+                    }
+                } // for i
+                break;
+
+            case SERVER_MODE:
+                ObjectName[] pools = getMemoryPoolMXBeansOnServer();
+
+                for (int i = 0; i < pools.length; i++) {
+                    if (!isCollectionThresholdSupportedOnServer(pools[i])) {
+                        continue;
+                    }
+
+                    MemoryType mt = getType(pools[i]);
+                    if ((!mt.equals(MemoryType.HEAP)
+                            || !memory.equals(HEAP_TYPE))
+                            && (!mt.equals(MemoryType.NON_HEAP)
+                            || !memory.equals(NONHEAP_TYPE))
+                            && !memory.equals(MIXED_TYPE)) {
+                        continue;
+                    }
+
+                    // Yes! We got the pool that
+                    // 1. supports usage threshold
+                    // 2. has type that match tested type
+                    // So, update the pool with new threshold
+                    long oldT = getCollectionThresholdOnServer(pools[i]);
+                    long newT = newThreshold(getUsageOnServer(pools[i]), oldT,
+                            pools[i].toString());
+                    try {
+                        setCollectionThresholdOnServer(pools[i], newT);
+                    } catch (Failure e) {
+                        /*
+                         * Max value might have changed since the call to newThreshold()
+                         * above. If it has fallen below the value of newT, which is certainly
+                         * possible, an exception like this one will be thrown from
+                         * sun.management.MemoryPoolImpl.setCollectionUsageThreshold():
+                         *
+                         * java.lang.IllegalArgumentException: Invalid threshold: 48332800 > max (47251456).
+                         *
+                         * and we'll catch Failure here as a result (it'll be thrown by
+                         * Monitor.setLongAttribute).
+                         *
+                         * We don't know the max value at the time of the failed call, and it
+                         * might have changed since the call once more. So there is no point
+                         * trying to detect whether the IllegalArgumentException had been
+                         * justified, we cannot know it at this point.
+                         *
+                         * The best we can do is log the fact and continue.
+                         */
+                        displayInfo("setCollectionThresholdOnServer() failed with " + e + ", ignoring... ",
+                                pools[i],
+                                "current usage after the call to setCollectionThresholdOnServer(): ", getUsageOnServer(pools[i]),
+                                "threshold: ", newT);
+                        continue;
+                    }
+                    displayInfo("Collection threshold is set", pools[i], "usage: ", getUsageOnServer(pools[i]), "threshold: ", newT);
+                    if (getCollectionThresholdOnServer(pools[i]) != newT) {
+                        complain("Cannot reset collaction threshold from " + oldT
+                                + " to " + newT + " in pool " + pools[i].toString());
+                        passed = false;
+                    }
+                } // for i
+                break;
+
+            default:
+                throw new TestBug("Unknown testMode " + mode);
+        }
+    } // updateCollectionThresholds()
+
+    // Calculates a new value of threshold based on MemoryUsage and old value of
+    // the threshold. New one will be not less than previous one.
+    private long newThreshold(MemoryUsage mu, long oldT, String poolName) {
+        long newT = mu.getCommitted() / 2 + mu.getUsed() / 2;
+        long max = mu.getMax();
+
+        if (newT < oldT) {
+            newT = mu.getCommitted() / 2 + oldT / 2;
+        }
+        if ((max > -1) && (newT > max)) {
+            newT = max;
+        }
+        displayInfo("Changing threshold", poolName, null, null, "new threshold: ", newT);
+        return newT;
+    }
+
+    // **********************************************************************
+    //
+    // Methods to work with MBean server in SERVER_MODE
+    //
+    // **********************************************************************
+    // Returns usage threshold value of the pool MBean that is accessed via
+    // MBeanServer
+    private long getUsageThresholdOnServer(ObjectName pool) {
+        return getLongAttribute(pool, UT);
+    }
+
+    // Returns collection threshold value of the pool MBean that is accessed via
+    // MBeanServer
+    private long getCollectionThresholdOnServer(ObjectName pool) {
+        return getLongAttribute(pool, CT);
+    }
+
+    // Sets new usage threshold value for the pool MBean that is accessed via
+    // MBeanServer
+    private void setUsageThresholdOnServer(ObjectName pool, long value) {
+        setLongAttribute(pool, UT, value);
+    }
+
+    // Sets new collection threshold value for the pool MBean that is accessed
+    // via MBeanServer
+    private void setCollectionThresholdOnServer(ObjectName pool, long value) {
+        setLongAttribute(pool, CT, value);
+    }
+
+    // Returns MemoryType of the pool MBean that is accessed via MBeanServer.
+    private MemoryType getType(ObjectName pool) {
+        try {
+            Object value = getMBeanServer().getAttribute(pool, POOL_TYPE);
+            if (value instanceof MemoryType) {
+                return (MemoryType) value;
+            } else if (value instanceof String) {
+                String name = (String) value;
+                return MemoryType.valueOf(name);
+            } else {
+                return null;
+            }
+        } catch (Exception e) {
+            e.printStackTrace(logger.getOutStream());
+            throw new Failure(e);
+        }
+    }
+
+    // Returns MemoryUsage of the pool MBean that is accessed via MBeanServer
+    private MemoryUsage getUsageOnServer(ObjectName pool) {
+        return getMemoryUsageAttribute(pool, POOL_U);
+    }
+
+    // Returns collection usage of the pool MBean that is accessed via
+    // MBeanServer
+    private MemoryUsage getCollectionUsageOnServer(ObjectName pool) {
+        return getMemoryUsageAttribute(pool, POOL_CU);
+    }
+
+    // Returns if usage threshold is supported in the pool
+    private boolean isUsageThresholdSupportedOnServer(ObjectName pool) {
+        return getBooleanAttribute(pool, UT_SUPPORT);
+    }
+
+    // Returns if collection threshold is supported in the pool
+    private boolean isCollectionThresholdSupportedOnServer(ObjectName pool) {
+        return getBooleanAttribute(pool, CT_SUPPORT);
+    }
+
+    // Returns if usage threshold is exceeded in the pool
+    private boolean isUsageThresholdExceededOnServer(ObjectName pool) {
+        return getBooleanAttribute(pool, UT_EXCEEDED);
+    }
+
+    // Returns if collection threshold is exceeded in the pool
+    private boolean isCollectionThresholdExceededOnServer(ObjectName pool) {
+        return getBooleanAttribute(pool, CT_EXCEEDED);
+    }
+
+    // Returns the usage threshold count of the pool
+    private long getUsageThresholdCountOnServer(ObjectName pool) {
+        return getLongAttribute(pool, UT_COUNT);
+    }
+
+    // Returns the collection threshold count of the pool.
+    private long getCollectionThresholdCountOnServer(ObjectName pool) {
+        return getLongAttribute(pool, CT_COUNT);
+    }
+    private final StringBuffer buffer = new StringBuffer(1000);
+
+    /**
+     * Display information about execution ignoring OOM.
+     */
+    private void displayInfo(String message, Object pool, String message1, Object n1, String message2, long n2) {
+        try {
+            buffer.delete(0, buffer.length());
+            buffer.append(message);
+            if (pool != null) {
+                buffer.append(", pool: ");
+                buffer.append(pool.toString());
+            }
+            buffer.append(", ");
+            buffer.append(message1);
+            buffer.append(n1);
+            if (message2 != null) {
+                buffer.append(", ");
+                buffer.append(message2);
+                buffer.append(n2);
+            }
+            display(buffer.toString());
+        } catch (OutOfMemoryError e) {
+            // Ignore.
+        }
+    }
+
+    /**
+     * Display information about execution ignoring OOM.
+     */
+    private void displayInfo(String message, MemoryPoolMXBean pool, String message1, Object n1, String message2, Object n2) {
+        try {
+            buffer.delete(0, buffer.length());
+            buffer.append(message);
+            if (pool != null) {
+                buffer.append(", pool: ");
+                buffer.append(pool.getName());
+            }
+            buffer.append(", ");
+            buffer.append(message1);
+            buffer.append(n1);
+            if (message2 != null) {
+                buffer.append(", ");
+                buffer.append(message2);
+                buffer.append(n2);
+            }
+            display(buffer.toString());
+        } catch (OutOfMemoryError e) {
+            // Ignore.
+        }
+    }
+
+    // Returns all MemoryPoolMXBeans that are registered on the MBeanServer
+    private ObjectName[] getMemoryPoolMXBeansOnServer() {
+
+        // Get all registered MBeans on the server
+        ObjectName filterName = null;
+        try {
+            filterName = new ObjectName(
+                 ManagementFactory.MEMORY_POOL_MXBEAN_DOMAIN_TYPE + ",*");
+
+            Set<ObjectName> filteredSet = getMBeanServer().queryNames(filterName, null);
+            return filteredSet.toArray(new ObjectName[0]);
+        } catch(Exception e) {
+            return new ObjectName[0];
+        }
+
+    } // getMemoryPoolMXBeansOnServer()
+
+    // **********************************************************************
+    //
+    // Class to implement polling mechanism of monitoring
+    //
+    // **********************************************************************
+    class Polling extends Thread {
+
+        final static long WAIT_TIME = 100; // Milliseconds
+        Object object = new Object();
+        long[] thresholdCounts;
+        boolean goOn = true;
+
+        public void run() {
+            try {
+                if (isUsageThreshold) {
+                    pollUsageThresholds();
+                } else {
+                    pollCollectionThresholds();
+                }
+            } catch (Failure e) {
+                complain("Unexpected " + e + " in Polling thread");
+                e.printStackTrace(logger.getOutStream());
+                passed = false;
+            }
+        } // run()
+
+        private void pollUsageThresholds() {
+            switch (mode) {
+                case DIRECTLY_MODE:
+                // we can use the same code here for direct and proxy modes
+                case PROXY_MODE:
+                    List poolsMBean = ManagementFactory.getMemoryPoolMXBeans();
+
+                    // Create an array to store all threshold values
+                    thresholdCounts = new long[poolsMBean.size()];
+                    for (int i = 0; i < thresholdCounts.length; i++) {
+                        thresholdCounts[i] = 0;
+                    }
+
+                    while (goOn) {
+                        synchronized (object) {
+                            try {
+                                object.wait(WAIT_TIME);
+                            } catch (InterruptedException e) {
+
+                                // Stop the thread
+                                return;
+                            }
+                        } // synchronized
+
+                        for (int i = 0; i < poolsMBean.size(); i++) {
+                            MemoryPoolMXBean pool = (MemoryPoolMXBean) poolsMBean.get(i);
+                            MemoryType mt = pool.getType();
+
+                            if (!pool.isUsageThresholdSupported()) {
+                                continue;
+                            }
+
+                            if ((!mt.equals(MemoryType.HEAP)
+                                    || !memory.equals(HEAP_TYPE))
+                                    && (!mt.equals(MemoryType.NON_HEAP)
+                                    || !memory.equals(NONHEAP_TYPE))
+                                    && !memory.equals(MIXED_TYPE)) {
+                                continue;
+                            }
+
+                            boolean exceeded;
+
+                            // The exception is not documented, but it may be
+                            // erroneously thrown
+                            try {
+                                exceeded = pool.isUsageThresholdExceeded();
+                            } catch (IllegalArgumentException e) {
+                                complain("Unexpected exception while retrieving "
+                                        + "isUsageThresholdExceeded() for pool "
+                                        + pool.getName());
+                                e.printStackTrace(logger.getOutStream());
+                                passed = false;
+                                continue;
+                            }
+
+                            if (!exceeded
+                                    || pool.getUsageThresholdCount() == thresholdCounts[i]) {
+                                continue;
+                            }
+
+                            // Yes! We got the pool that
+                            // 1. supports usage threshold
+                            // 2. has type that match tested type
+                            // 3. its threshold is exceeded
+                            // So, update all thresholds
+                            long c = pool.getUsageThresholdCount();
+                            if (c <= thresholdCounts[i]) {
+                                complain("Usage threshold count is not greater "
+                                        + "than previous one: " + c + " < "
+                                        + thresholdCounts[i] + " in pool "
+                                        + pool.getName());
+                                passed = false;
+                            }
+                            thresholdCounts[i] = c;
+                            displayInfo("Crossing is noticed", pool, "usage: ", pool.getUsage(), "count: ", c);
+                            updateThresholds();
+                        } // for i
+                    } // while
+                    break;
+
+                case SERVER_MODE:
+                    ObjectName[] pools = getMemoryPoolMXBeansOnServer();
+
+                    // Create an array to store all threshold values
+                    thresholdCounts = new long[pools.length];
+                    for (int i = 0; i < thresholdCounts.length; i++) {
+                        thresholdCounts[i] = 0;
+                    }
+
+                    while (goOn) {
+                        synchronized (object) {
+                            try {
+                                object.wait(WAIT_TIME);
+                            } catch (InterruptedException e) {
+
+                                // Stop the thread
+                                return;
+                            }
+                        } // synchronized
+
+                        for (int i = 0; i < pools.length; i++) {
+                            MemoryType mt = getType(pools[i]);
+
+                            if (!isUsageThresholdSupportedOnServer(pools[i])) {
+                                continue;
+                            }
+
+                            if ((!mt.equals(MemoryType.HEAP)
+                                    || !memory.equals(HEAP_TYPE))
+                                    && (!mt.equals(MemoryType.NON_HEAP)
+                                    || !memory.equals(NONHEAP_TYPE))
+                                    && !memory.equals(MIXED_TYPE)) {
+                                continue;
+                            }
+
+                            boolean exceeded;
+
+                            // The exception is not documented, but it may be
+                            // erroneously thrown
+                            try {
+                                exceeded = isUsageThresholdExceededOnServer(pools[i]);
+                            } catch (Failure e) {
+                                complain("Unexpected exception while retrieving "
+                                        + "isUsageThresholdExceeded() for pool "
+                                        + pools[i].toString());
+                                e.printStackTrace(logger.getOutStream());
+                                passed = false;
+                                continue;
+                            }
+
+                            if (!exceeded
+                                    || getUsageThresholdCount(pools[i]) == thresholdCounts[i]) {
+                                continue;
+                            }
+
+                            // Yes! We got the pool that
+                            // 1. supports usage threshold
+                            // 2. has type that match tested type
+                            // 3. its threshold is exceeded
+                            // So, update all thresholds
+                            long c = getUsageThresholdCount(pools[i]);
+                            if (c <= thresholdCounts[i]) {
+                                complain("Usage threshold count is not greater "
+                                        + "than previous one: " + c + " < "
+                                        + thresholdCounts[i] + " in pool "
+                                        + pools[i].toString());
+                                passed = false;
+                            }
+                            thresholdCounts[i] = c;
+                            displayInfo("Crossing is noticed", null, "pool: ", pools[i], "usage: ", getUsageOnServer(pools[i]));
+                            updateThresholds();
+                        } // for i
+                    } // while
+                    break;
+
+                default:
+                    throw new TestBug("Unknown testMode " + mode);
+            } // switch
+        } // pollUsageThresholds()
+
+        private void pollCollectionThresholds() {
+            switch (mode) {
+                case DIRECTLY_MODE:
+                // we can use the same code here for direct and proxy modes
+                case PROXY_MODE:
+                    List poolsMBean = ManagementFactory.getMemoryPoolMXBeans();
+
+                    // Create an array to store all threshold values
+                    thresholdCounts = new long[poolsMBean.size()];
+                    for (int i = 0; i < thresholdCounts.length; i++) {
+                        thresholdCounts[i] = 0;
+                    }
+
+                    while (goOn) {
+                        synchronized (object) {
+                            try {
+                                object.wait(WAIT_TIME);
+                            } catch (InterruptedException e) {
+
+                                // Stop the thread
+                                return;
+                            }
+                        } // synchronized
+
+                        for (int i = 0; i < poolsMBean.size(); i++) {
+                            MemoryPoolMXBean pool = (MemoryPoolMXBean) poolsMBean.get(i);
+                            MemoryType mt = pool.getType();
+
+                            if (!pool.isCollectionUsageThresholdSupported()) {
+                                continue;
+                            }
+
+                            if ((!mt.equals(MemoryType.HEAP)
+                                    || !memory.equals(HEAP_TYPE))
+                                    && (!mt.equals(MemoryType.NON_HEAP)
+                                    || !memory.equals(NONHEAP_TYPE))
+                                    && !memory.equals(MIXED_TYPE)) {
+                                continue;
+                            }
+
+                            boolean exceeded;
+
+                            // The exception is not documented, but it may be
+                            // erroneously thrown
+                            try {
+                                exceeded = pool.isCollectionUsageThresholdExceeded();
+                            } catch (IllegalArgumentException e) {
+                                complain("Unexpected exception while retrieving "
+                                        + "isCollectionUsageThresholdExceeded()"
+                                        + " for pool " + pool.getName());
+                                e.printStackTrace(logger.getOutStream());
+                                passed = false;
+                                continue;
+                            }
+
+                            if (!exceeded
+                                    || pool.getCollectionUsageThresholdCount()
+                                    == thresholdCounts[i]) {
+                                continue;
+                            }
+
+                            // Yes! We got thet pool that
+                            // 1. supports collection usage threshold
+                            // 2. has type that match tested type
+                            // 3. its threshold is exceeded
+                            // So, update all thresholds
+                            long c = pool.getCollectionUsageThresholdCount();
+                            if (c <= thresholdCounts[i]) {
+                                complain("Collection usage threshold count is "
+                                        + "not greater than previous one: " + c
+                                        + " < " + thresholdCounts[i] + " in pool "
+                                        + pool.getName());
+                                passed = false;
+                            }
+                            thresholdCounts[i] = c;
+                            displayInfo("Crossing is noticed", pool, "usage: ", pool.getUsage(), "count: ", c);
+                            updateThresholds();
+                        } // for i
+                    } // while
+                    break;
+
+                case SERVER_MODE:
+                    ObjectName[] pools = getMemoryPoolMXBeansOnServer();
+
+                    // Create an array to store all threshold values
+                    thresholdCounts = new long[pools.length];
+                    for (int i = 0; i < thresholdCounts.length; i++) {
+                        thresholdCounts[i] = 0;
+                    }
+
+                    while (goOn) {
+                        synchronized (object) {
+                            try {
+                                object.wait(WAIT_TIME);
+                            } catch (InterruptedException e) {
+
+                                // Stop the thread
+                                return;
+                            }
+                        } // synchronized
+
+                        for (int i = 0; i < pools.length; i++) {
+                            MemoryType mt = getType(pools[i]);
+
+                            if (!isCollectionThresholdSupportedOnServer(pools[i])) {
+                                continue;
+                            }
+
+                            if ((!mt.equals(MemoryType.HEAP)
+                                    || !memory.equals(HEAP_TYPE))
+                                    && (!mt.equals(MemoryType.NON_HEAP)
+                                    || !memory.equals(NONHEAP_TYPE))
+                                    && !memory.equals(MIXED_TYPE)) {
+                                continue;
+                            }
+
+                            boolean exceeded;
+
+                            // The exception is not documented, but it may be
+                            // erroneously thrown
+                            try {
+                                exceeded = isCollectionThresholdExceededOnServer(pools[i]);
+                            } catch (Failure e) {
+                                complain("Unexpected exception while retrieving "
+                                        + "isCollectionUsageThresholdExceeded() "
+                                        + "for pool " + pools[i].toString());
+                                e.printStackTrace(logger.getOutStream());
+                                passed = false;
+                                continue;
+                            }
+
+                            if (!exceeded
+                                    || getCollectionThresholdCountOnServer(pools[i])
+                                    == thresholdCounts[i]) {
+                                continue;
+                            }
+
+                            // Yes! We got thet pool that
+                            // 1. supports collection usage threshold
+                            // 2. has type that match tested type
+                            // 3. its threshold is exceeded
+                            // So, update all thresholds
+                            long c = getCollectionThresholdCountOnServer(pools[i]);
+                            if (c <= thresholdCounts[i]) {
+                                complain("Collection usage threshold count is "
+                                        + "not greater than previous one: " + c
+                                        + " < " + thresholdCounts[i] + " in pool "
+                                        + pools[i].toString());
+                                passed = false;
+                            }
+                            thresholdCounts[i] = c;
+                            displayInfo("Crossing is noticed", pools[i], "usage: ", getUsageOnServer(pools[i]), "count: ", c);
+                            updateThresholds();
+                        } // for i
+                    } // while
+                    break;
+
+                default:
+                    throw new TestBug("Unknown testMode " + mode);
+            } // switch
+        } // pollCollectionThresholds()
+    } // class Polling
+} // MemoryMonitor
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/Monitor.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,465 @@
+/*
+ * Copyright (c) 2003, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share;
+
+import java.lang.management.*;
+import javax.management.*;
+import javax.management.openmbean.*;
+import nsk.share.*;
+
+/**
+ * <code>Monitor</code> is a factory class for getting wrappers for monitoring
+ * interfaces.
+ * <p>This class consists of static methods that return an instance of a
+ * wapper. Depending on command line arguments, a wrapper redirects invocations
+ * interfaces directly, or accesses MBeans through MBeanServer</p>
+ *
+ * <p>At the same time <code>Monitor</code> is a base class for such wrappers.
+ * Each wrapper must override {@link #Monitor
+ * <code>Monitor(Log, ArgumentHandler)</code>} constructor, that receives
+ * command line options and creates a proper MBean server based on that options.
+ */
+public class Monitor {
+
+    /**
+     * <code>Directly</code> mode -- the MBeans' methods are accessed directly
+     * within the same JVM.
+     */
+    public static final int DIRECTLY_MODE = 0;
+
+    /**
+     * <code>Server</code> mode -- the MBeans' methods are accessed through
+     * default MBeanServer.
+     */
+    public static final int SERVER_MODE = 1;
+
+    /**
+     * <code>Server</code> mode -- the MBeans' methods are accessed through
+     * MBean proxy.
+     */
+    public static final int PROXY_MODE = 2;
+
+    /**
+     * Prefix string to print while logging.
+     */
+    protected static String logPrefix;
+
+    /**
+     * <code>Logger</code> object to print info in.
+     */
+    protected Log.Logger logger;
+
+    /**
+     * An <code>ObjectName</code> object to represent somespecific MBean.
+     */
+    protected ObjectName mbeanObjectName;
+
+    // Some private variables
+    private static int testMode;
+    private static MBeanServer mbeanServer = null;
+
+    /**
+     * Creates a new <code>Monitor</code> object. The arguments that are passed
+     * to the test are parsed.
+     *
+     * @param log <code>Log</code> object to print info to.
+     * @param argumentHandler <code>ArgumentHandler</code> object that saves
+     *        all info about test's arguments.
+     */
+    protected Monitor(Log log, ArgumentHandler argumentHandler) {
+        if (log != null)
+            logger = new Log.Logger(log, logPrefix);
+        readArguments(argumentHandler);
+    }
+
+    /**
+     * Returns the test mode code.
+     *
+     * @return the test mode code.
+     *
+     * @see Monitor#DIRECTLY_MODE
+     * @see Monitor#SERVER_MODE
+     * @see Monitor#PROXY_MODE
+     *
+     */
+    public static int getTestMode() {
+        return testMode;
+    }
+
+    /**
+     * Returns MBean server if <code>"server"</code> is assigned to
+     * <code>-testMode</code>, i.e. the metrics are accessed through default
+     * or custom MBeanServer.
+     *
+     * @return MBean server
+     */
+    public static MBeanServer getMBeanServer() {
+        return mbeanServer;
+    }
+
+    // Parse the arguments passed to the test
+    private void readArguments(ArgumentHandler argumentHandler) {
+        String tmp = argumentHandler.getTestMode();
+        String tmp1 = "Test mode:\t";
+
+        if (tmp.equals(ArgumentHandler.DIRECTLY_MODE)) {
+            testMode = DIRECTLY_MODE;
+            display(tmp1 + "DIRECTLY access to MBean");
+        } else if (tmp.equals(ArgumentHandler.SERVER_MODE)) {
+            testMode = SERVER_MODE;
+            display(tmp1 + "access to MBean through MBeanServer");
+        } else if (tmp.equals(ArgumentHandler.PROXY_MODE)) {
+            testMode = PROXY_MODE;
+            display(tmp1 + "access to MBean through proxy");
+        } else {
+            throw new Failure("UNKNOWN test mode.");
+        }
+
+        if (testMode == SERVER_MODE || testMode == PROXY_MODE)
+            createMBeanServer(argumentHandler.isDefaultServer());
+    }
+
+    // Create a new either default, or custom MBeanServer
+    private void createMBeanServer(boolean defaultServer) {
+        String tmp = "MBeanServer:\t";
+        if (defaultServer) {
+            System.setProperty(CustomMBeanServer.SERVER_BUILDER_PROPERTY,
+                               CustomMBeanServer.DEFAULT_SERVER_BUILDER);
+            display(tmp + "DEFAULT");
+        } else {
+            System.setProperty(CustomMBeanServer.SERVER_BUILDER_PROPERTY,
+                               CustomMBeanServer.CUSTOM_SERVER_BUILDER);
+            display(tmp + "CUSTOM");
+        }
+
+        mbeanServer = ManagementFactory.getPlatformMBeanServer();
+        if (!defaultServer)
+            ((CustomMBeanServer) mbeanServer).setLog(logger.getLog());
+    }
+
+    /**
+     * Creates an instance of the <code>ClassLoadingMonitor</code> class to
+     * provide class loading/unloading monitoring.
+     *
+     * @param log <code>Log</code> object to print info to.
+     * @param argumentHandler <code>ArgumentHandler</code> object that saves
+     *        all info about test's arguments.
+     *
+     * @return New <code>ClassLoadingMonitor</code> instance.
+     *
+     * @see ArgumentHandler
+     */
+    public static ClassLoadingMonitor getClassLoadingMonitor(Log log,
+                                              ArgumentHandler argumentHandler) {
+
+        ClassLoadingMonitor monitor
+            = new ClassLoadingMonitor(log, argumentHandler);
+        createMBean(monitor, ManagementFactory.CLASS_LOADING_MXBEAN_NAME);
+        return monitor;
+    }
+
+    /**
+     * Creates an instance of the <code>MemoryMonitor</code> class to
+     * provide control on heap and non-heap memory.
+     *
+     * @param log <code>Log</code> object to print info to.
+     * @param argumentHandler <code>ArgumentHandler</code> object that saves
+     *        all info about test's arguments.
+     *
+     * @return New <code>MemoryMonitor</code> instance.
+     *
+     * @see ArgumentHandler
+     */
+    public static MemoryMonitor getMemoryMonitor(Log log,
+                                              ArgumentHandler argumentHandler) {
+
+        MemoryMonitor monitor = new MemoryMonitor(log, argumentHandler);
+        createMBean(monitor, ManagementFactory.MEMORY_MXBEAN_NAME);
+        return monitor;
+    }
+
+    /**
+     * Creates an instance of the <code>ThreadMonitor</code> class to
+     * provide control on threads.
+     *
+     * @param log <code>Log</code> object to print info to.
+     * @param argumentHandler <code>ArgumentHandler</code> object that saves
+     *        all info about test's arguments.
+     *
+     * @return New <code>ThreadMonitor</code> instance.
+     *
+     * @see ArgumentHandler
+     */
+    public static ThreadMonitor getThreadMonitor(Log log,
+                                              ArgumentHandler argumentHandler) {
+
+        ThreadMonitor monitor = new ThreadMonitor(log, argumentHandler);
+        createMBean(monitor, ManagementFactory.THREAD_MXBEAN_NAME);
+        return monitor;
+    }
+
+    /**
+     * Creates an instance of the <code>RuntimeMonitor</code> class to
+     * provide control on runtime enviroment.
+     *
+     * @param log <code>Log</code> object to print info to.
+     * @param argumentHandler <code>ArgumentHandler</code> object that saves
+     *        all info about test's arguments.
+     *
+     * @return New <code>RuntimeMonitor</code> instance.
+     *
+     * @see ArgumentHandler
+     */
+    public static RuntimeMonitor getRuntimeMonitor(Log log,
+                                              ArgumentHandler argumentHandler) {
+
+        RuntimeMonitor monitor = new RuntimeMonitor(log, argumentHandler);
+        createMBean(monitor, ManagementFactory.RUNTIME_MXBEAN_NAME);
+        return monitor;
+    }
+
+    /**
+     * Creates an instance of the <code>CompilationMonitor</code> class to
+     * provide control on compilation system.
+     *
+     * @param log <code>Log</code> object to print info to.
+     * @param argumentHandler <code>ArgumentHandler</code> object that saves
+     *        all info about test's arguments.
+     *
+     * @return New <code>CompilationMonitor</code> instance.
+     *
+     * @see ArgumentHandler
+     */
+    public static CompilationMonitor getCompilationMonitor(Log log,
+                                              ArgumentHandler argumentHandler) {
+
+        CompilationMonitor monitor
+            = new CompilationMonitor(log, argumentHandler);
+        createMBean(monitor, ManagementFactory.COMPILATION_MXBEAN_NAME);
+        return monitor;
+    }
+
+    /**
+     * Creates an instance of the <code>LoggingMonitor</code> class to
+     * provide control on logging system.
+     *
+     * @param log <code>Log</code> object to print info to.
+     * @param argumentHandler <code>ArgumentHandler</code> object that saves
+     *        all info about test's arguments.
+     *
+     * @return New <code>LoggingMonitor</code> instance.
+     *
+     * @see ArgumentHandler
+     */
+    public static LoggingMonitor getLoggingMonitor(Log log,
+                                              ArgumentHandler argumentHandler) {
+
+        LoggingMonitor monitor
+            = new LoggingMonitor(log, argumentHandler);
+        createMBean(monitor, LoggingMonitor.LOGGING_MXBEAN_NAME);
+        return monitor;
+    }
+
+    /**
+     * Creates an instance of the <code>GarbageCollectorMonitor</code> class to
+     * provide control on logging system.
+     *
+     * @param log <code>Log</code> object to print info to.
+     * @param argumentHandler <code>ArgumentHandler</code> object that saves
+     *        all info about test's arguments.
+     *
+     * @return New <code>GarbageCollectorMonitor</code> instance.
+     *
+     * @see ArgumentHandler
+     */
+    public static GarbageCollectorMonitor getGarbageCollectorMonitor(Log log,
+                                              ArgumentHandler argumentHandler) {
+
+        GarbageCollectorMonitor monitor
+            = new GarbageCollectorMonitor(log, argumentHandler);
+        createMBean(monitor,
+            GarbageCollectorMonitor.GARBAGECOLLECTOR_MXBEAN_NAME);
+        return monitor;
+    }
+
+    /**
+     * Displays <code>message</code> using <code>Log.Logger</code> object.
+     */
+    protected void display(String message) {
+        if (logger != null)
+            logger.display(message);
+    }
+
+    /**
+     * Displays an error <code>message</code> using <code>Log.Logger</code>
+     * object.
+     */
+    protected void complain(String message) {
+        if (logger != null)
+            logger.complain(message);
+    }
+
+    /**
+     * Retrieves the <code>boolean</code> value of the specified attribute
+     * from MBeanServer.
+     *
+     * @param object MBean's <code>ObjectName</code>
+     * @param name name of the attribute.
+     *
+     * @return value of the attribute.
+     */
+    protected boolean getBooleanAttribute(ObjectName object, String name) {
+        try {
+            Boolean b = (Boolean) getMBeanServer().getAttribute(object, name);
+            return b.booleanValue();
+        } catch (Exception e) {
+            throw new Failure(e);
+        }
+    } // getBooleanAttribute()
+
+    /**
+     * Retrieves the <code>int</code> value of the specified attribute
+     * from MBeanServer.
+     *
+     * @param object MBean's <code>ObjectName</code>
+     * @param name name of the attribute.
+     *
+     * @return value of the attribute.
+     */
+    protected int getIntAttribute(ObjectName object, String name) {
+        try {
+            Integer i = (Integer) getMBeanServer().getAttribute(object, name);
+            return i.intValue();
+        } catch (Exception e) {
+            throw new Failure(e);
+        }
+    } // getIntAttribute()
+
+    /**
+     * Retrieves the <code>long</code> value of the specified attribute
+     * from MBeanServer.
+     *
+     * @param object MBean's <code>ObjectName</code>
+     * @param name name of the attribute.
+     *
+     * @return value of the attribute.
+     */
+    protected long getLongAttribute(ObjectName object, String name) {
+        try {
+            Long l = (Long) getMBeanServer().getAttribute(object, name);
+            return l.longValue();
+        } catch (Exception e) {
+            throw new Failure(e);
+        }
+    } // getLongAttribute()
+
+    /**
+     * Retrieves the array of <code>long</code> -- value of the specified
+     * attribute from MBeanServer.
+     *
+     * @param object MBean's <code>ObjectName</code>
+     * @param name name of the attribute.
+     *
+     * @return value of the attribute.
+     */
+    protected long[] getLongArrayAttribute(ObjectName object, String name) {
+        try {
+            Object o = (Object) getMBeanServer().getAttribute(object, name);
+            return (long[]) o;
+        } catch (Exception e) {
+            throw new Failure(e);
+        }
+    } // getLongArrayAttribute()
+
+    /**
+     * Retrieves the <code>MemoryUsage</code> value of the specified attribute
+     * from MBeanServer.
+     *
+     * @param object MBean's <code>ObjectName</code>
+     * @param name name of the attribute.
+     *
+     * @return value of the attribute.
+     */
+    protected MemoryUsage getMemoryUsageAttribute(ObjectName object,
+                                                                   String name) {
+        try {
+                Object data = getMBeanServer().getAttribute(object, name);
+                if (data instanceof MemoryUsage)
+                        return (MemoryUsage) data;
+                return MemoryUsage.from((CompositeData) data);
+        } catch (Exception e) {
+            throw new Failure(e);
+        }
+    } // getMemoryUsageAttribute()
+
+    /**
+     * Sets the <code>long</code> value to the specified attribute from
+     * MBeanServer.
+     *
+     * @param object MBean's <code>ObjectName</code>
+     * @param name name of the attribute.
+     * @param value value of the attribute.
+     */
+    protected void setLongAttribute(ObjectName object, String name,
+                                                                   long value) {
+        Attribute attribute = new Attribute(name, new Long(value));
+
+        try {
+            getMBeanServer().setAttribute(object, attribute);
+        } catch (Exception e) {
+            throw new Failure(e);
+        }
+    } // setLongAttribute()
+
+    /**
+     * Sets the <code>boolean</code> value to the specified attribute from
+     * MBeanServer.
+     *
+     * @param object MBean's <code>ObjectName</code>
+     * @param name name of the attribute.
+     * @param value value of the attribute.
+     */
+    protected void setBooleanAttribute(ObjectName object, String name,
+                                                                boolean value) {
+        Attribute attribute = new Attribute(name, new Boolean(value));
+
+        try {
+            getMBeanServer().setAttribute(object, attribute);
+        } catch (Exception e) {
+            throw new Failure(e);
+        }
+    } // setBooleanAttribute()
+
+    // Create a new MBean with specified object name
+    private static void createMBean(Monitor monitor, String name) {
+
+        if (testMode == SERVER_MODE || testMode == PROXY_MODE) {
+            try {
+                monitor.mbeanObjectName = new ObjectName(name);
+            } catch (MalformedObjectNameException e) {
+                throw new Failure(e);
+            }
+        }
+    }
+} // Monitor
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/Monitoring.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2005, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share;
+
+import nsk.share.test.*;
+import nsk.share.runner.*;
+import nsk.share.log.Log;
+import java.lang.management.*;
+import javax.management.*;
+import nsk.monitoring.share.thread.RunningThread;
+import nsk.monitoring.share.thread.SleepingThread;
+import nsk.monitoring.share.thread.WaitingThread;
+import nsk.monitoring.share.thread.BlockedThread;
+import nsk.monitoring.share.thread.*;
+import nsk.monitoring.share.direct.DirectMonitoringFactory;
+import nsk.monitoring.share.server.ServerMonitoringFactory;
+import nsk.monitoring.share.proxy.ProxyMonitoringFactory;
+import nsk.share.TestBug;
+import nsk.share.Failure;
+import java.util.Collection;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Set;
+
+public class Monitoring extends nsk.share.test.Tests {
+        private Monitoring() {
+        }
+
+        /**
+         * Convert monitoring exception.
+         *
+         * @param e exception
+         * @return converted exception
+         */
+        public static RuntimeException convertException(Throwable e) {
+                //e.printStackTrace(logger.getOutStream());
+                return new Failure(e);
+        }
+
+        protected static class MonitoringTestRunner extends TestRunner {
+                private ArgumentHandler argHandler;
+
+                public MonitoringTestRunner(Test test, String[] args) {
+                        super(test, args);
+                }
+
+                public synchronized ArgumentHandler getArgumentHandler(String[] args) {
+                        if (argHandler == null)
+                                argHandler = new ArgumentHandler(args);
+                        return argHandler;
+                }
+
+                public synchronized MonitoringFactory getMonitoringFactory(String testMode, String serverType) {
+                        if (testMode.equals(ArgumentHandler.DIRECTLY_MODE))
+                                return new DirectMonitoringFactory();
+                        else if (testMode.equals(ArgumentHandler.SERVER_MODE))
+                                return new ServerMonitoringFactory(getMBeanServer(serverType));
+                        else if (testMode.equals(ArgumentHandler.PROXY_MODE))
+                                return new ProxyMonitoringFactory(getMBeanServer(serverType));
+                        else
+                                throw new TestBug("Unknown test mode" + testMode);
+                }
+
+                public synchronized MBeanServer getMBeanServer(String serverType) {
+                        if (serverType.equals(ArgumentHandler.DEFAULT_TYPE))
+                                return ManagementFactory.getPlatformMBeanServer();
+                        else {
+                                System.setProperty(CustomMBeanServer.SERVER_BUILDER_PROPERTY, CustomMBeanServer.CUSTOM_SERVER_BUILDER);
+                                return ManagementFactory.getPlatformMBeanServer();
+                        }
+                }
+
+
+                public void configure(Object o) {
+                        super.configure(o);
+                        if (o instanceof ArgumentHandlerAware)
+                                ((ArgumentHandlerAware) o).setArgumentHandler(getArgumentHandler(args));
+                        if (o instanceof MonitoringFactoryAware) {
+                                ArgumentHandler argHandler = getArgumentHandler(args);
+                                MonitoringFactory mfactory = getMonitoringFactory(argHandler.getTestMode(), argHandler.getServerType());
+                                ((MonitoringFactoryAware) o).setMonitoringFactory(mfactory);
+                        }
+                        if (o instanceof ScenarioTypeAware) {
+                                ArgumentHandler argHandler = getArgumentHandler(args);
+                                ((ScenarioTypeAware) o).setScenarioType(argHandler.getScenarioType());
+                        }
+                }
+        }
+
+        public static void runTest(Test test, String[] args) {
+                new MonitoringTestRunner(test, args).run();
+        }
+
+        public static Collection<ObjectName> queryNamesByStart(MBeanServer mbeanServer, String name) {
+                try {
+                        ObjectName pattern = ObjectName.getInstance(name + "*");
+                        Set<ObjectName> query = mbeanServer.queryNames(pattern, null);
+                        List<ObjectName> list = new ArrayList<ObjectName>(query.size());
+                        for (ObjectName oname : query) {
+                            list.add(oname);
+                        }
+                        return list;
+                } catch (Exception e) {
+                        throw convertException(e);
+                }
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/MonitoringFactory.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2005, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share;
+
+import java.util.List;
+import java.lang.management.*;
+import javax.management.*;
+
+/**
+ * This factory encapsulates a way to obtain VM monitoring beans.
+ *
+ * There are currently three implementations.
+ * {@link nsk.monitoring.share.direct.DirectMonitoringFactory} obtains
+ * them directly through {@link java.lang.management.MonitoringFactory}.
+ * {@link nsk.monitoring.share.proxy.ProxyMonitoringFactory} obtains
+ * proxies for a given MBeanServer.
+ * {@link nsk.monitoring.share.server.ServerMonitoringFactory} obtains
+ * MXBeans that use MBeanServer property methods to do it's work.
+ *
+ * @see nsk.monitoring.share.direct.DirectMonitoringFactory
+ * @see nsk.monitoring.share.proxy.ProxyMonitoringFactory
+ * @see nsk.monitoring.share.server.ServerMonitoringFactory
+ */
+public interface MonitoringFactory {
+        /**
+         * Obtain ClassLoadingMXBean.
+         */
+        public ClassLoadingMXBean getClassLoadingMXBean();
+
+        /**
+         * Check if CompilationMXBean is available.
+         *
+         * It may be unavailable if VM does not have a compilation
+         * system, for example when -Xint option is used.
+         *
+         * @return true if CompilationMXBean is available, false
+         * otherwise
+         */
+        public boolean hasCompilationMXBean();
+
+        /**
+         * Obtain CompilationMXBean
+         */
+        public CompilationMXBean getCompilationMXBean();
+
+        /**
+         * Obtain GarbageCollectorMXBean's.
+         */
+        public List<GarbageCollectorMXBean> getGarbageCollectorMXBeans();
+
+        /**
+         * Obtain RuntimeMXBean.
+         */
+        public RuntimeMXBean getRuntimeMXBean();
+
+        /**
+         * Obtain MemoryMXBean.
+         */
+        public MemoryMXBean getMemoryMXBean();
+
+        /**
+         * Obtain NotificationEmitter for MemoryMXBean.
+         */
+        public NotificationEmitter getMemoryMXBeanNotificationEmitter();
+
+        /**
+         * Obtain MemoryPoolMXBean's.
+         */
+        public List<MemoryPoolMXBean> getMemoryPoolMXBeans();
+
+        /**
+         * Obtain ThreadMXBean.
+         */
+        public ThreadMXBean getThreadMXBean();
+
+         /**
+         * Check if com.sun.managementThreadMXBean is available.
+         *
+         * It may be unavailable if corresponding API is not integrated
+         * into JDK under test and ThreadImpl does not inherit c.s.m.ThreadMXBean
+         *
+         * @return true if c.s.m.ThreadMXBean is available, false
+         * otherwise
+         */
+        public boolean hasThreadMXBeanNew();
+
+         /**
+         * Obtain com.sun.management.ThreadMXBean.
+         */
+        public ThreadMXBean getThreadMXBeanNew();
+
+        /*
+        public OperatingSystemMXBean getOperatingSystemMXBean();
+        */
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/MonitoringFactoryAware.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2005, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share;
+
+/**
+ * Marker interface that signifies that MonitoringFactory is needed.
+ *
+ * @see nsk.monitoring.share.MonitoringFactory
+ */
+public interface MonitoringFactoryAware {
+        public void setMonitoringFactory(MonitoringFactory mfactory);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/MonitoringTestBase.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2005, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share;
+
+import nsk.share.test.*;
+
+public abstract class MonitoringTestBase extends TestBase implements MonitoringFactoryAware, ArgumentHandlerAware {
+        protected MonitoringFactory monitoringFactory;
+        protected ArgumentHandler argHandler;
+
+        public final void setMonitoringFactory(MonitoringFactory monitoringFactory) {
+                this.monitoringFactory = monitoringFactory;
+        }
+
+        public final void setArgumentHandler(ArgumentHandler argHandler) {
+                this.argHandler = argHandler;
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/RuntimeMonitor.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2003, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share;
+
+import java.lang.management.*;
+import javax.management.*;
+import nsk.share.*;
+
+/**
+ * <code>RuntimeMonitor</code> class is a wrapper of <code>RuntimeMXBean</code>.
+ * Depending on command line arguments, an instance of this class redirects
+ * invocations to the <code>RuntimeMXBean</code> interface. If
+ * <code>-testMode="directly"</code> option is set, this instance directly
+ * invokes corresponding method of the <code>RuntimeMXBean</code> interface. If
+ * <code>-testMode="server"</code> option is set it will make invocations via
+ * MBeanServer. If <code>-testMode="proxy"</code> option is set it will make
+ * invocations via MBeanServer proxy.
+ *
+ * @see ArgumentHandler
+ */
+public class RuntimeMonitor extends Monitor {
+    // An instance of ClassLoadingMBean
+    private final static RuntimeMXBean mbean
+        = ManagementFactory.getRuntimeMXBean();
+
+    // Name of an attribute of RuntimeMonitor
+    private static final String IS_BOOT = "BootClassPathSupported";
+
+    private RuntimeMXBean proxyInstance;
+
+    static {
+        Monitor.logPrefix = "RuntimeMonitor> ";
+    }
+
+    /**
+     * Creates a new <code>RuntimeMonitor</code> object.
+     *
+     * @param log <code>Log</code> object to print info to.
+     * @param argumentHandler <code>ArgumentHandler</code> object that saves
+     *        all info about test's arguments.
+     *
+     */
+    public RuntimeMonitor(Log log, ArgumentHandler argumentHandler) {
+        super(log, argumentHandler);
+    }
+
+    /**
+     *
+     * Return a proxy instance for a platform
+     * {@link java.lang.management.RuntimeMXBean
+     * <code>RuntimeMXBean</code>} interface.
+     *
+     */
+    RuntimeMXBean getProxy() {
+        if (proxyInstance == null) {
+            // create proxy instance
+            try {
+                proxyInstance = (RuntimeMXBean)
+                ManagementFactory.newPlatformMXBeanProxy(
+                    getMBeanServer(),
+                    ManagementFactory.RUNTIME_MXBEAN_NAME,
+                    RuntimeMXBean.class
+                );
+            } catch (java.io.IOException e) {
+                throw new Failure(e);
+            }
+        }
+        return proxyInstance;
+    }
+
+    /**
+     * Redirects the invocation to
+     * {@link java.lang.management.RuntimeMXBean#isBootClassPathSupported()
+     * <code>RuntimeMXBean.isBootClassPathSupported()</code>}.
+     *
+     * @return <code>true</code>, if the JVM supports the class path mechanism;
+     *         <code>flase</code> otherwise.
+     */
+    public boolean isBootClassPathSupported() {
+        int mode = getTestMode();
+
+        switch (mode) {
+        case DIRECTLY_MODE:
+            return mbean.isBootClassPathSupported();
+
+        case SERVER_MODE:
+            return getBooleanAttribute(mbeanObjectName, IS_BOOT);
+
+        case PROXY_MODE:
+            return getProxy().isBootClassPathSupported();
+        }
+
+        throw new TestBug("Unknown testMode " + mode);
+    }
+} // RuntimeMonitor
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/ServerNotificationEmitter.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2005, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share;
+
+import nsk.share.*;
+import nsk.monitoring.share.*;
+import javax.management.*;
+
+/**
+ * NotificationEmitter that delegates functionality to MBeanServer.
+ */
+public class ServerNotificationEmitter implements NotificationEmitter {
+        private MBeanServer mbeanServer;
+        private ObjectName name;
+
+        public ServerNotificationEmitter(MBeanServer mbeanServer, ObjectName name) {
+                this.mbeanServer = mbeanServer;
+                this.name = name;
+        }
+
+        public ServerNotificationEmitter(MBeanServer mbeanServer, String name) {
+                try {
+                        this.mbeanServer = mbeanServer;
+                        this.name = new ObjectName(name);
+                } catch (MalformedObjectNameException e) {
+                        throw Monitoring.convertException(e);
+                }
+        }
+
+        public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)  {
+                try {
+                        mbeanServer.addNotificationListener(name, listener, filter, handback);
+                } catch (InstanceNotFoundException e) {
+                        throw Monitoring.convertException(e);
+                }
+        }
+
+        public MBeanNotificationInfo[] getNotificationInfo() {
+                throw new TestBug("ServerNotificationEmitter.getNotificationInfo() not implemented.");
+        }
+
+        public void removeNotificationListener(NotificationListener listener)
+                throws ListenerNotFoundException {
+                try {
+                        mbeanServer.removeNotificationListener(name, listener);
+                } catch (InstanceNotFoundException e) {
+                        throw Monitoring.convertException(e);
+                }
+        }
+
+        public void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
+                throws ListenerNotFoundException {
+                try {
+                        mbeanServer.removeNotificationListener(name, listener, filter, handback);
+                } catch (InstanceNotFoundException e) {
+                        throw Monitoring.convertException(e);
+                }
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/StackTraceController.c	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2003, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include <jni.h>
+#include <stdio.h>
+#include "jni_tools.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define GET_OBJECT_CLASS(_class, _obj)\
+    if (!NSK_JNI_VERIFY(env, (_class = \
+            NSK_CPP_STUB2(GetObjectClass, env, _obj)) != NULL))\
+        return 2
+
+#define CALL_STATIC_VOID_NOPARAM(_class, _methodName)\
+    GET_STATIC_METHOD_ID(method, _class, _methodName, "()V");\
+    if (!NSK_JNI_VERIFY_VOID(env, NSK_CPP_STUB3(CallStaticVoidMethod, env,\
+                            _class, method)))\
+        return 2
+
+#define GET_STATIC_METHOD_ID(_methodID, _class, _methodName, _sig)\
+    if (!NSK_JNI_VERIFY(env, (_methodID = \
+            NSK_CPP_STUB4(GetStaticMethodID, env, _class,\
+                _methodName, _sig)) != NULL))\
+        return 2
+
+#define GET_METHOD_ID(_methodID, _class, _methodName, _sig)\
+    if (!NSK_JNI_VERIFY(env, (_methodID = \
+            NSK_CPP_STUB4(GetMethodID, env, _class,\
+                _methodName, _sig)) != NULL))\
+        return 2
+
+#define CALL_VOID_NOPARAM(_obj, _class, _methodName)\
+    GET_METHOD_ID(method, _class, _methodName, "()V");\
+    if (!NSK_JNI_VERIFY_VOID(env, NSK_CPP_STUB3(CallVoidMethod, env, _obj,\
+                                                    method)))\
+        return 2
+
+JNIEXPORT jint JNICALL
+Java_nsk_monitoring_stress_thread_RunningThread_recursionNative(JNIEnv *env,
+         jobject obj, jint maxDepth, jint currentDepth, jboolean returnToJava) {
+    jmethodID method;
+    jclass threadClass;
+
+    GET_OBJECT_CLASS(threadClass, obj);
+    currentDepth++;
+
+    if (maxDepth > currentDepth) {
+        CALL_STATIC_VOID_NOPARAM(threadClass, "yield");
+
+        if (returnToJava) {
+            GET_METHOD_ID(method, threadClass, "recursionJava", "(II)V");
+            if (!NSK_JNI_VERIFY_VOID(env,
+                                     NSK_CPP_STUB5(CallIntMethod, env, obj,
+                                                   method, maxDepth,
+                                                   currentDepth))) {
+                return 1;
+            }
+        } else {
+            GET_METHOD_ID(method, threadClass, "recursionNative", "(IIZ)I");
+            if (!NSK_JNI_VERIFY_VOID(env,
+                                     NSK_CPP_STUB6(CallIntMethod, env, obj,
+                                                   method, maxDepth,
+                                                   currentDepth,
+                                                   returnToJava))) {
+                return 1;
+            }
+        }
+    }
+    CALL_VOID_NOPARAM(obj, threadClass, "waitForSign");
+    return 0;
+}
+
+#ifdef __cplusplus
+}
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/StateController.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2003, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share;
+
+import nsk.share.*;
+
+/**
+ * An abstract base class for operating VM state. The follow methods must
+ * be implemented by its subclasses:
+ * <ul>
+ *      <li><code>run()</code> -- brings VM into defined state.
+ *      <li><code>reset()</code> -- tries to reclaim VM into initial state.
+ * </ul>
+ */
+public abstract class StateController implements Runnable {
+
+    /**
+     * Public default constructor.
+     */
+    public StateController() {
+        super();
+    }
+
+    /**
+     * A string that is printed before each string when {@link Log#complain
+     * <code>Log.complain()</code>}, and {@link Log#display
+     * <code>Log.display()</code>} are invoked.
+     */
+    protected String logPrefix;
+
+    /**
+     * A variable to save reference to {@link Log <code>Log.Logger</code>}
+     * class.
+     */
+    protected Log.Logger logger;
+
+    /**
+     * Brings VM into defined state.
+     */
+    public abstract void run();
+
+    /**
+     * Tries to reclaim VM into initial state
+     */
+    public abstract void reset();
+
+    /**
+     * Outputs <code>message</code> using {@link Log <code>Log.Logger</code>}
+     * object.
+     */
+    protected void display(String message) {
+        if (logger != null)
+            logger.display(message);
+    }
+
+    /**
+     * Outputs <code>message</code> using {@link Log <code>Log.Logger</code>}
+     * object.
+     */
+    protected void complain(String message) {
+        if (logger != null)
+            logger.complain(message);
+    }
+
+    /**
+     * Defines {@link Log <code>Log.Logger</code>} object.
+     */
+    public void setLog(Log log) {
+        logger = new Log.Logger(log, logPrefix);
+    }
+
+    /**
+     * Converts an integer to string.
+     *
+     * @param i an integer to convert.
+     * @return a string that represents the int value.
+     */
+    public String int2Str(int i) {
+        String tmp = "";
+
+        if (i < 10) {
+            tmp = "00";
+        } else if (i >= 10 && i < 100) {
+            tmp = "0";
+        }
+        return tmp + String.valueOf(i);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/StateControllerBase.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2005, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share;
+
+import nsk.share.log.*;
+
+/**
+ * An abstract base class for operating VM state. The follow methods must
+ * be implemented by its subclasses:
+ * <ul>
+ *      <li><code>run()</code> -- brings VM into defined state.
+ *      <li><code>reset()</code> -- tries to reclaim VM into initial state.
+ * </ul>
+ */
+public abstract class StateControllerBase implements LogAware {
+        protected Log log;
+
+        public StateControllerBase(Log log) {
+                this.log = log;
+        }
+
+        /**
+         * Brings VM into defined state.
+         */
+        public abstract void run();
+
+        /**
+         * Tries to reclaim VM into initial state
+         */
+        public abstract void reset();
+
+        /**
+         * Defines {@link Log <code>Log.Logger</code>} object.
+         */
+        public final void setLog(Log log) {
+                this.log = log;
+        }
+
+        /**
+         * Converts an integer to string.
+         *
+         * @param i an integer to convert.
+         * @return a string that represents the int value.
+         */
+        protected String int2Str(int i) {
+                String tmp = "";
+
+                if (i < 10) {
+                        tmp = "00";
+                } else if (i >= 10 && i < 100) {
+                        tmp = "0";
+                }
+                return tmp + String.valueOf(i);
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/ThreadController.c	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,531 @@
+/*
+ * Copyright (c) 2003, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include <assert.h>
+#include <jni.h>
+#include <jvmti.h>
+#include <stdio.h>
+#include "jni_tools.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define FIND_CLASS(_class, _className)\
+    if (!NSK_JNI_VERIFY(env, (_class = \
+            NSK_CPP_STUB2(FindClass, env, _className)) != NULL))\
+        return
+
+#define GET_OBJECT_CLASS(_class, _obj)\
+    if (!NSK_JNI_VERIFY(env, (_class = \
+            NSK_CPP_STUB2(GetObjectClass, env, _obj)) != NULL))\
+        return
+
+#define GET_STATIC_FIELD_ID(_fieldID, _class, _fieldName, _fieldSig)\
+    if (!NSK_JNI_VERIFY(env, (_fieldID = \
+            NSK_CPP_STUB4(GetStaticFieldID, env, _class,\
+                _fieldName, _fieldSig)) != NULL))\
+        return
+
+#define GET_STATIC_OBJ_FIELD(_value, _class, _fieldName, _fieldSig)\
+    GET_STATIC_FIELD_ID(field, _class, _fieldName, _fieldSig);\
+    _value = NSK_CPP_STUB3(GetStaticObjectField, env, _class, \
+                                field)
+
+#define GET_STATIC_BOOL_FIELD(_value, _class, _fieldName)\
+    GET_STATIC_FIELD_ID(field, _class, _fieldName, "Z");\
+    _value = NSK_CPP_STUB3(GetStaticBooleanField, env, _class, field)
+
+#define GET_FIELD_ID(_fieldID, _class, _fieldName, _fieldSig)\
+    if (!NSK_JNI_VERIFY(env, (_fieldID = \
+            NSK_CPP_STUB4(GetFieldID, env, _class,\
+                _fieldName, _fieldSig)) != NULL))\
+        return
+
+#define GET_INT_FIELD(_value, _obj, _class, _fieldName)\
+    GET_FIELD_ID(field, _class, _fieldName, "I");\
+    _value = NSK_CPP_STUB3(GetIntField, env, _obj, field)
+
+#define GET_BOOL_FIELD(_value, _obj, _class, _fieldName)\
+    GET_FIELD_ID(field, _class, _fieldName, "Z");\
+    _value = NSK_CPP_STUB3(GetBooleanField, env, _obj, field)
+
+#define GET_LONG_FIELD(_value, _obj, _class, _fieldName)\
+    GET_FIELD_ID(field, _class, _fieldName, "J");\
+    _value = NSK_CPP_STUB3(GetLongField, env, _obj, field)
+
+#define GET_STATIC_INT_FIELD(_value, _class, _fieldName)\
+    GET_STATIC_FIELD_ID(field, _class, _fieldName, "I");\
+    _value = NSK_CPP_STUB3(GetStaticIntField, env, _class, field)
+
+#define SET_INT_FIELD(_obj, _class, _fieldName, _newValue)\
+    GET_FIELD_ID(field, _class, _fieldName, "I");\
+    NSK_CPP_STUB4(SetIntField, env, _obj, field, _newValue)
+
+#define GET_OBJ_FIELD(_value, _obj, _class, _fieldName, _fieldSig)\
+    GET_FIELD_ID(field, _class, _fieldName, _fieldSig);\
+    _value = NSK_CPP_STUB3(GetObjectField, env, _obj, field)
+
+
+#define GET_ARR_ELEMENT(_arr, _index)\
+    NSK_CPP_STUB3(GetObjectArrayElement, env, _arr, _index)
+
+#define SET_ARR_ELEMENT(_arr, _index, _newValue)\
+    NSK_CPP_STUB4(SetObjectArrayElement, env, _arr, _index, _newValue)
+
+#define GET_STATIC_METHOD_ID(_methodID, _class, _methodName, _sig)\
+    if (!NSK_JNI_VERIFY(env, (_methodID = \
+            NSK_CPP_STUB4(GetStaticMethodID, env, _class,\
+                _methodName, _sig)) != NULL))\
+        return
+
+#define GET_METHOD_ID(_methodID, _class, _methodName, _sig)\
+    if (!NSK_JNI_VERIFY(env, (_methodID = \
+            NSK_CPP_STUB4(GetMethodID, env, _class,\
+                _methodName, _sig)) != NULL))\
+        return
+
+#define CALL_STATIC_VOID_NOPARAM(_class, _methodName)\
+    GET_STATIC_METHOD_ID(method, _class, _methodName, "()V");\
+    if (!NSK_JNI_VERIFY_VOID(env, NSK_CPP_STUB3(CallStaticVoidMethod, env,\
+                            _class, method)))\
+        return
+
+#define CALL_STATIC_VOID(_class, _methodName, _sig, _param)\
+    GET_STATIC_METHOD_ID(method, _class, _methodName, _sig);\
+    if (!NSK_JNI_VERIFY_VOID(env, NSK_CPP_STUB4(CallStaticVoidMethod, env,\
+                                                    _class, method, _param)))\
+        return
+
+#define CALL_STATIC_OBJ(_value, _class, _methodName, _sig, _param)\
+    GET_STATIC_METHOD_ID(method, _class, _methodName, _sig);\
+    _value = NSK_CPP_STUB4(CallStaticObjectMethod, env, _class, method, _param)
+
+#define CALL_VOID_NOPARAM(_obj, _class, _methodName)\
+    GET_METHOD_ID(method, _class, _methodName, "()V");\
+    if (!NSK_JNI_VERIFY_VOID(env, NSK_CPP_STUB3(CallVoidMethod, env, _obj,\
+                                                    method)))\
+        return
+
+#define CALL_VOID(_obj, _class, _methodName, _sig, _param)\
+    GET_METHOD_ID(method, _class, _methodName, "()V");\
+    if (!NSK_JNI_VERIFY_VOID(env, NSK_CPP_STUB4(CallVoidMethod, env, _obj,\
+                                                    method, _param)))\
+        return
+
+#define CALL_VOID2(_obj, _class, _methodName, _sig, _param1, _param2)\
+    GET_METHOD_ID(method, _class, _methodName, _sig);\
+    if (!NSK_JNI_VERIFY_VOID(env, NSK_CPP_STUB5(CallVoidMethod, env, _obj, \
+                                                    method, _param1, _param2)))\
+        return
+
+#define CALL_INT_NOPARAM(_value, _obj, _class, _methodName)\
+    GET_METHOD_ID(method, _class, _methodName, "()I");\
+    _value = NSK_CPP_STUB3(CallIntMethod, env, _obj, method)
+
+#define NEW_OBJ(_obj, _class, _constructorName, _sig, _params)\
+    GET_METHOD_ID(method, _class, _constructorName, _sig);\
+    if (!NSK_JNI_VERIFY(env, (_obj = \
+            NSK_CPP_STUB4(NewObject, env, _class, method, _params)) != NULL))\
+        return
+
+#define MONITOR_ENTER(x) \
+    NSK_JNI_VERIFY(env, NSK_CPP_STUB2(MonitorEnter, env, x) == 0)
+
+#define MONITOR_EXIT(x) \
+    NSK_JNI_VERIFY(env, NSK_CPP_STUB2(MonitorExit, env, x) == 0)
+
+#define TRACE(msg)\
+   GET_OBJ_FIELD(logger, obj, threadClass, "logger", "Lnsk/share/Log$Logger;");\
+   jmsg = NSK_CPP_STUB2(NewStringUTF, env, msg);\
+   CALL_VOID2(logger, loggerClass, "trace",\
+                           "(ILjava/lang/String;)V", 50, jmsg)
+
+    static const char *SctrlClassName="nsk/monitoring/share/ThreadController";
+    static const char *SthreadControllerSig
+    = "Lnsk/monitoring/share/ThreadController;";
+
+    static const char *SThreadsGroupLocksSig
+    ="Lnsk/monitoring/share/ThreadsGroupLocks;";
+    static const char *SThreadsGroupLocksClassName
+    ="nsk/monitoring/share/ThreadsGroupLocks";
+
+
+    static const char *SbringState_mn="bringState";
+    static const char *SnativeBringState_mn="nativeBringState";
+    static const char *SrecursiveMethod_mn="recursiveMethod";
+    static const char *SnativeRecursiveMethod_mn="nativeRecursiveMethod";
+    static const char *SloggerClassName = "nsk/share/Log$Logger";
+
+    static const char *Snoparams="()V";
+    static const char *Slongparam="(J)V";
+
+    /*
+     * Class:     nsk_monitoring_share_BaseThread
+     * Method:    nativeRecursiveMethod
+     * Signature: ()V
+     */
+    JNIEXPORT void JNICALL
+    Java_nsk_monitoring_share_BaseThread_nativeRecursiveMethod(JNIEnv *env,
+            jobject obj) {
+        jint currDepth, maxDepth;
+        jobject logger;
+        jstring jmsg;
+        jfieldID field;
+        jmethodID method;
+
+        jobject controller;
+        jclass threadClass, ctrlClass, loggerClass;
+
+        int invocationType;
+
+        GET_OBJECT_CLASS(threadClass, obj);
+        FIND_CLASS(ctrlClass, SctrlClassName);
+        FIND_CLASS(loggerClass, SloggerClassName);
+
+
+        /* currDepth++ */
+        GET_INT_FIELD(currDepth, obj, threadClass, "currentDepth");
+        currDepth++;
+        SET_INT_FIELD(obj, threadClass, "currentDepth", currDepth);
+
+        GET_OBJ_FIELD(controller, obj, threadClass, "controller",
+                      SthreadControllerSig);
+        GET_INT_FIELD(maxDepth, controller, ctrlClass, "maxDepth");
+
+        GET_STATIC_INT_FIELD(invocationType, ctrlClass, "invocationType");
+
+        if (maxDepth - currDepth > 0)
+        {
+            CALL_STATIC_VOID_NOPARAM(threadClass, "yield");
+
+            if (invocationType == 2/*MIXED_TYPE*/)
+            {
+                CALL_VOID_NOPARAM(obj, threadClass, SrecursiveMethod_mn);
+            }
+            else
+            {
+                CALL_VOID_NOPARAM(obj, threadClass, SnativeRecursiveMethod_mn);
+            }
+        }
+        else
+        {
+            TRACE("state has been reached");
+            if (invocationType == 2/*MIXED_TYPE*/)
+            {
+                CALL_VOID_NOPARAM(obj, threadClass, SbringState_mn);
+            }
+            else
+            {
+                CALL_VOID_NOPARAM(obj, threadClass, SnativeBringState_mn);
+            }
+        }
+
+        currDepth--;
+        GET_OBJECT_CLASS(threadClass, obj);
+        SET_INT_FIELD(obj, threadClass, "currentDepth", currDepth);
+    }
+
+    /*
+     * Class:     nsk_monitoring_share_BlockedThread
+     * Method:    nativeBringState
+     * Signature: ()V
+     */
+    JNIEXPORT void JNICALL
+    Java_nsk_monitoring_share_BlockedThread_nativeBringState(JNIEnv *env,
+            jobject obj) {
+        jobject logger;
+        jstring jmsg;
+        jfieldID field;
+        jmethodID method;
+
+        jclass threadClass, loggerClass;
+
+        jobject STATE;
+
+        //ThreadsGroupLocks:
+        jclass ThreadsGroupLocks;
+        jobject  threadsGroupLocks;
+        jmethodID getBarrier;
+
+
+        //CountDownLatch
+        jobject barrier;
+        jclass CountDownLatch;
+
+        //Blocker
+        jobject blocker;
+        jclass Blocker;
+
+        GET_OBJECT_CLASS(threadClass, obj);
+
+        FIND_CLASS(loggerClass, SloggerClassName);
+        FIND_CLASS(ThreadsGroupLocks, SThreadsGroupLocksClassName);
+        FIND_CLASS(Blocker, "Lnsk/monitoring/share/ThreadsGroupLocks$Blocker;");
+        FIND_CLASS(CountDownLatch, "nsk/monitoring/share/ThreadsGroupLocks$PlainCountDownLatch");
+
+        GET_OBJ_FIELD(threadsGroupLocks, obj, threadClass, "threadsGroupLocks", SThreadsGroupLocksSig);
+        GET_STATIC_OBJ_FIELD(STATE, threadClass, "STATE", "Ljava/lang/Thread$State;");
+        GET_OBJ_FIELD(blocker, threadsGroupLocks, ThreadsGroupLocks, "blocker", "Lnsk/monitoring/share/ThreadsGroupLocks$Blocker;");
+
+        getBarrier = (*env)->GetMethodID(env, ThreadsGroupLocks, "getBarrier",
+            "(Ljava/lang/Thread$State;)Lnsk/monitoring/share/ThreadsGroupLocks$PlainCountDownLatch;");
+        barrier = (*env)->CallObjectMethod(env, threadsGroupLocks, getBarrier, STATE);
+
+
+        TRACE("entering to monitor");
+
+        CALL_VOID_NOPARAM(barrier, CountDownLatch, "countDown");
+        CALL_VOID_NOPARAM(blocker, Blocker, "block");
+        TRACE("exiting from monitor");
+
+    }
+
+    /*
+     * Class:     nsk_monitoring_share_WaitingThread
+     * Method:    nativeBringState
+     * Signature: ()V
+     */
+    JNIEXPORT void JNICALL
+    Java_nsk_monitoring_share_WaitingThread_nativeBringState(JNIEnv *env,
+            jobject obj) {
+        jobject logger;
+        jstring jmsg;
+        jfieldID field;
+        jmethodID method;
+
+        jclass threadClass, loggerClass;
+
+        //STATE
+        jobject STATE;
+
+        //ThreadsGroupLocks:
+        jclass ThreadsGroupLocks;
+        jobject  threadsGroupLocks;
+        jmethodID getBarrier;
+
+        //CountDownLatch
+        jobject barrier;
+        jclass CountDownLatch;
+
+        GET_OBJECT_CLASS(threadClass, obj);
+
+        FIND_CLASS(loggerClass, SloggerClassName);
+        FIND_CLASS(ThreadsGroupLocks, "nsk/monitoring/share/ThreadsGroupLocks");
+        FIND_CLASS(CountDownLatch, "nsk/monitoring/share/ThreadsGroupLocks$PlainCountDownLatch");
+
+        GET_STATIC_OBJ_FIELD(STATE, threadClass, "STATE", "Ljava/lang/Thread$State;");
+        GET_OBJ_FIELD(threadsGroupLocks, obj, threadClass, "threadsGroupLocks", "Lnsk/monitoring/share/ThreadsGroupLocks;");
+
+        getBarrier = (*env)->GetMethodID(env, ThreadsGroupLocks, "getBarrier",
+            "(Ljava/lang/Thread$State;)Lnsk/monitoring/share/ThreadsGroupLocks$PlainCountDownLatch;");
+        barrier = (*env)->CallObjectMethod(env, threadsGroupLocks, getBarrier, STATE);
+        CALL_VOID_NOPARAM(barrier, CountDownLatch, "countDown");
+
+        TRACE("waiting on a monitor");
+        CALL_VOID_NOPARAM(barrier, CountDownLatch, "await");
+    }
+
+    /*
+     * Class:     nsk_monitoring_share_SleepingThread
+     * Method:    nativeBringState
+     * Signature: ()V
+     */
+    JNIEXPORT void JNICALL
+    Java_nsk_monitoring_share_SleepingThread_nativeBringState(JNIEnv *env,
+            jobject obj) {
+        jfieldID field;
+        jmethodID method;
+
+        jclass threadClass, loggerClass;
+
+        //STATE
+        jobject STATE;
+
+        //ThreadsGroupLocks:
+        jclass ThreadsGroupLocks;
+        jobject  threadsGroupLocks;
+        jmethodID getBarrier;
+
+        //CountDownLatch
+        jobject barrier;
+        jclass CountDownLatch;
+
+        //Thread
+        jclass Thread;
+
+        jlong sleepTime = 20 * 60 * 1000;
+
+
+        GET_OBJECT_CLASS(threadClass, obj);
+
+        FIND_CLASS(loggerClass, SloggerClassName);
+        FIND_CLASS(ThreadsGroupLocks, "nsk/monitoring/share/ThreadsGroupLocks");
+        FIND_CLASS(CountDownLatch, "nsk/monitoring/share/ThreadsGroupLocks$PlainCountDownLatch");
+
+        GET_STATIC_OBJ_FIELD(STATE, threadClass, "STATE", "Ljava/lang/Thread$State;");
+        GET_OBJ_FIELD(threadsGroupLocks, obj, threadClass, "threadsGroupLocks", "Lnsk/monitoring/share/ThreadsGroupLocks;");
+
+        // Thread.sleep(3600 * 1000);
+        FIND_CLASS(Thread, "java/lang/Thread");
+
+        getBarrier = (*env)->GetMethodID(env, ThreadsGroupLocks, "getBarrier",
+            "(Ljava/lang/Thread$State;)Lnsk/monitoring/share/ThreadsGroupLocks$PlainCountDownLatch;");
+        barrier = (*env)->CallObjectMethod(env, threadsGroupLocks, getBarrier, STATE);
+        CALL_VOID_NOPARAM(barrier, CountDownLatch, "countDown");
+
+        CALL_STATIC_VOID(Thread, "sleep", "(J)V", sleepTime);
+    }
+
+    /*
+     * Class:     nsk_monitoring_share_RunningThread
+     * Method:    nativeBringState
+     * Signature: ()V
+     */
+    JNIEXPORT void JNICALL
+    Java_nsk_monitoring_share_RunningThread_nativeBringState(JNIEnv *env,
+            jobject obj) {
+        jobject logger;
+        jstring jmsg;
+        jfieldID field;
+        jmethodID method;
+
+        jclass threadClass, loggerClass;
+
+        //STATE
+        jobject STATE;
+
+        //ThreadsGroupLocks:
+        jclass ThreadsGroupLocks;
+        jobject  threadsGroupLocks;
+        jmethodID getBarrier;
+
+        //CountDownLatch
+        jobject barrier;
+        jclass CountDownLatch;
+
+        //Thread
+        jclass Thread;
+
+        //runnableCanExit
+        jboolean flag = JNI_FALSE;
+
+        GET_OBJECT_CLASS(threadClass, obj);
+
+        FIND_CLASS(loggerClass, SloggerClassName);
+        FIND_CLASS(ThreadsGroupLocks, "nsk/monitoring/share/ThreadsGroupLocks");
+        FIND_CLASS(CountDownLatch, "nsk/monitoring/share/ThreadsGroupLocks$PlainCountDownLatch");
+
+        GET_STATIC_OBJ_FIELD(STATE, threadClass, "STATE", "Ljava/lang/Thread$State;");
+        GET_OBJ_FIELD(threadsGroupLocks, obj, threadClass, "threadsGroupLocks", "Lnsk/monitoring/share/ThreadsGroupLocks;");
+
+        // Thread.sleep(3600 * 1000);
+        FIND_CLASS(Thread, "java/lang/Thread");
+
+        getBarrier = (*env)->GetMethodID(env, ThreadsGroupLocks, "getBarrier",
+            "(Ljava/lang/Thread$State;)Lnsk/monitoring/share/ThreadsGroupLocks$PlainCountDownLatch;");
+
+        TRACE("running loop");
+
+        barrier = (*env)->CallObjectMethod(env, threadsGroupLocks, getBarrier, STATE);
+        CALL_VOID_NOPARAM(barrier, CountDownLatch, "countDown");
+
+        // while (!threadsGroupLocks.runnableCanExit.get()) {
+        //        Thread.yield();
+        //    }
+        while(flag==JNI_FALSE)
+        {
+            GET_BOOL_FIELD(flag, threadsGroupLocks, ThreadsGroupLocks, "runnableCanExit");
+            CALL_STATIC_VOID_NOPARAM(Thread, "yield");
+        }
+
+    }
+
+    jstring getStateName(JNIEnv *env, jint state) {
+        switch (state & JVMTI_JAVA_LANG_THREAD_STATE_MASK) {
+            case JVMTI_JAVA_LANG_THREAD_STATE_NEW:
+                return (*env)->NewStringUTF(env,"NEW");
+            case JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED:
+                return (*env)->NewStringUTF(env,"TERMINATED");
+            case JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE:
+                return (*env)->NewStringUTF(env,"RUNNABLE");
+            case JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED:
+                return (*env)->NewStringUTF(env,"BLOCKED");
+            case JVMTI_JAVA_LANG_THREAD_STATE_WAITING:
+                return (*env)->NewStringUTF(env, "WAITING");
+            case JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING:
+                return (*env)->NewStringUTF(env,"TIMED_WAITING");
+            }
+        // should never reach
+        assert(0);
+        return 0;
+    }
+
+    /*
+     * Class:     nsk_monitoring_share_ThreadController
+     * Method:    getThreadState
+     * Signature: (Ljava/lang/Thread;)Ljava/lang/Thread/State;
+     */
+    JNIEXPORT jobject JNICALL
+    Java_nsk_monitoring_share_ThreadController_getThreadState(JNIEnv *env,
+            jobject obj, jobject thread){
+
+        JavaVM *vm;
+        jvmtiEnv *jvmti;
+        jclass ThreadState;
+        jmethodID method;
+        jobject threadState;
+        jstring stateName;
+        jint state;
+
+        if(!NSK_VERIFY(
+             NSK_CPP_STUB2(GetJavaVM, env, &vm) == 0)) {
+            return NULL;
+        }
+
+        if(!NSK_VERIFY(
+             NSK_CPP_STUB3(GetEnv, vm, (void **)&jvmti, JVMTI_VERSION_1)
+                    == JNI_OK)) {
+            return NULL;
+        }
+
+        if(!NSK_VERIFY(
+             NSK_CPP_STUB3(GetThreadState, jvmti, (jthread)thread, &state)
+             == JVMTI_ERROR_NONE)) {
+            return NULL;
+        }
+
+        stateName = getStateName(env, state);
+        if (!NSK_JNI_VERIFY(env, (ThreadState = NSK_CPP_STUB2(FindClass, env, "java/lang/Thread$State")) != NULL))
+            return NULL;
+
+        if (!NSK_JNI_VERIFY(env, (method = NSK_CPP_STUB4(GetStaticMethodID, env, ThreadState, "valueOf", "(Ljava/lang/String;)Ljava/lang/Thread$State;")) != NULL))
+            return NULL;
+        threadState = NSK_CPP_STUB4(CallStaticObjectMethod, env, ThreadState, method, stateName);
+
+        return threadState;
+    }
+
+#ifdef __cplusplus
+}
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/ThreadController.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,889 @@
+/*
+ * Copyright (c) 2003, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share;
+
+import java.lang.management.*;
+import java.util.*;
+
+import nsk.share.*;
+
+/**
+ * The <code>ThreadController</code> class allows to operate with threads.
+ */
+public class ThreadController extends StateController {
+
+    /**
+     * Type of threads: pure java.
+     */
+    static public final int JAVA_TYPE = 0;
+
+    /**
+     * Type of threads: native.
+     */
+    static public final int NATIVE_TYPE = 1;
+
+    /**
+     * Type of threads: both java and native.
+     */
+    static public final int MIXED_TYPE = 2;
+
+    /**
+     * Result code: no errors.
+     */
+    static public final int NO_ERROR = 0;
+
+    /**
+     * Result code: wrong state of the thread.
+     */
+    static public final int ERR_STATE = 1;
+
+    /**
+     * Result code: error in stack trace.
+     */
+    static public final int ERR_STACKTRACE = 2;
+
+    /**
+     * Result code: thread not found.
+     */
+    static public final int ERR_THREAD_NOTFOUND = 3;
+
+
+    // Prefix to print while logging
+    static final String LOG_PREFIX = "ThreadController> ";
+
+    // Internal trace levels
+    static final int THREAD_TRACE_LEVEL = 50;
+
+    /**
+     * Suffix of all started threads.
+     */
+    static final String THREAD_SUFFIX = "_ThreadMM";
+
+    // Number of tested kinds of threads
+    public static final int THREAD_KIND_COUNT = 4;
+
+    /**
+     * Index of blocked threads.
+     */
+    static public final int BLOCKED_IDX = 0;
+
+    /**
+     * Index of waiting threads.
+     */
+    static public final int WAITING_IDX = 1;
+
+    /**
+     * Index of sleeping threads.
+     */
+    static public final int SLEEPING_IDX = 2;
+
+    /**
+     * Index of running threads.
+     */
+    static public final int RUNNING_IDX = 3;
+
+    public static final String[] THREAD_KIND_NAMES =  {"BLOCKED","WAITING","SLEEPING","RUNNABLE"};
+    public static final Thread.State[] THREAD_KINDS = {Thread.State.BLOCKED, Thread.State.WAITING, Thread.State.TIMED_WAITING, Thread.State.RUNNABLE};
+
+    private Map<Thread.State, Integer> threadsCount = new HashMap<Thread.State, Integer>();
+    private Map<Thread.State, List<BaseThread>> threadsClusters = new HashMap<Thread.State, List<BaseThread>>();
+
+    private ThreadsGroupLocks threadsGroupLocks;
+
+
+    int maxDepth;
+    static int invocationType;
+
+    static {
+        try {
+            System.loadLibrary("ThreadController");
+        } catch (UnsatisfiedLinkError e) {
+            System.err.println("Could not load \"ThreadController\" "
+                    + "library");
+            System.err.println("java.library.path:"
+                    + System.getProperty("java.library.path"));
+            throw e;
+        }
+    }
+
+    /**
+     * Creates a new <code>ThreadController</code> object with defined
+     * arguments..
+     *
+     * @param log            <code>Log</code> object to print info to.
+     * @param threadCount    number of threads to start.
+     * @param maxDepth       depth of recursion.
+     * @param invocationType type of threads to start (java, native, or mixed).
+     */
+    public ThreadController(Log log, int threadCount, int maxDepth,
+                            String invocationType) {
+        logPrefix = LOG_PREFIX;
+        setLog(log);
+        setThreadCount(threadCount);
+        setDepth(maxDepth);
+        setInvocationType(invocationType);
+    }
+
+
+    // Calculate how many threads of each kind to start
+    private void setThreadCount(int threadCount) {
+        int total = 0;
+        int kinds = THREAD_KIND_COUNT;
+        int tmp = threadCount / kinds;
+        int rest = threadCount % kinds;
+        int increased = kinds - rest;
+        for (int i = 0; i < kinds; i++) {
+            if (i >= increased) {
+                threadsCount.put(THREAD_KINDS[i], tmp + 1);
+            } else {
+                threadsCount.put(THREAD_KINDS[i], tmp);
+            }
+        }
+        display("number of created threads:\t" + threadCount);
+    }
+
+    // Print thread count
+    private void printThreadCount() {
+        for (Thread.State state : THREAD_KINDS) {
+            display("\t" + state + " threads ("
+                    + threadsCount.get(state) + ")");
+        }
+    }
+
+    // Set recursion depth
+    private void setDepth(int depth) {
+        maxDepth = depth;
+        display("depth for all threads:\t" + maxDepth);
+    }
+
+    // Set invocation type
+    private void setInvocationType(String value) {
+        display("invocation type:\t" + value);
+        if (value.equals(ArgumentHandler.JAVA_TYPE)) {
+            invocationType = JAVA_TYPE;
+        } else if (value.equals(ArgumentHandler.NATIVE_TYPE)) {
+            invocationType = NATIVE_TYPE;
+        } else if (value.equals(ArgumentHandler.MIXED_TYPE)) {
+            invocationType = MIXED_TYPE;
+        } else {
+            throw new Failure("UNKNOWN invocation type");
+        }
+    }
+
+    /**
+     * Returns invocation type.
+     *
+     * @return invocation type.
+     */
+    public int getInvocationType() {
+        return invocationType;
+    }
+
+    /**
+     * Returns thread count.
+     *
+     * @param state kind of thread state
+     * @return thread count.
+     */
+    public int getThreadCount(Thread.State state) {
+        return threadsCount.get(state);
+    }
+
+      /**
+     * Returns thread count.
+     *
+     * @param kindIndex of thread state
+     * @return thread count.
+     */
+    public int getThreadCount(int kindIndex) {
+        return threadsCount.get(THREAD_KINDS[kindIndex]);
+    }
+
+    public int getThreadKindCount() {
+        return THREAD_KINDS.length;
+    }
+
+
+    /**
+     * Brings out VM into defined state.
+     * <p/>
+     * The method starts all threads.
+     */
+    public void run() {
+        long startTime = System.currentTimeMillis() / 1000;
+        startThreads();
+        display("locking threads");
+        waitForThreads();
+    }
+
+    /**
+     * Tries to return VM into initial state
+     * <p/>
+     * The method interrupts all threads.
+     */
+    public void reset() {
+        for (Thread.State state : THREAD_KINDS) {
+            threadsGroupLocks.releaseGroup(state);
+        }
+    }
+
+    // Get thread state via JVMTI
+    private native Thread.State getThreadState(Thread thread);
+
+    // Start all threads
+    private void startThreads() throws Failure {
+
+        String tmp_name;
+        BaseThread thread = null;
+
+        threadsGroupLocks = new ThreadsGroupLocks(threadsCount, logger);
+        for (Thread.State state : THREAD_KINDS) {
+            threadsClusters.put(state, new ArrayList<BaseThread>());
+            for (int j = 0; j < threadsCount.get(state); j++) {
+                tmp_name = state + THREAD_SUFFIX + int2Str(j);
+                switch (state) {
+                    case BLOCKED:
+                        thread = new BlockedThread(this, tmp_name, logger.getLog(), threadsGroupLocks);
+                        break;
+                    case WAITING:
+                        thread = new WaitingThread(this, tmp_name, logger.getLog(), threadsGroupLocks);
+                        break;
+                    case TIMED_WAITING:
+                        thread = new SleepingThread(this, tmp_name, logger.getLog(), threadsGroupLocks);
+                        break;
+                    case RUNNABLE:
+                        thread = new RunningThread(this, tmp_name, logger.getLog(), threadsGroupLocks);
+                        break;
+                    default:
+                        throw new TestBug("Unknow thread kind");
+                }
+                threadsClusters.get(state).add(thread);
+                thread.start();
+            }
+        }
+        waitForThreads();
+    }
+
+    private boolean checkState(Thread.State expectedState) {
+        for (Thread thread : threadsClusters.get(expectedState)) {
+            if (getThreadState(thread) != expectedState) {
+
+                return false;
+            }
+        }
+        return true;
+    }
+
+    private void waitForThreads() {
+        for (Thread.State state : THREAD_KINDS) {
+            threadsGroupLocks.waitForGroup(state);
+            while (!checkState(state)) {
+                Thread.yield();
+            }
+        }
+    }
+
+
+    /**
+     * Finds a thread with defined id.
+     *
+     * @param id ID of the thread.
+     * @return a thread with defined id.
+     */
+    public BaseThread findThread(long id) {
+        for(Thread.State state:THREAD_KINDS){
+            for(BaseThread thread:threadsClusters.get(state)){
+                 if (id==thread.getId()) {
+                     return thread;
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Finds a thread by name.
+     *
+     * @param name name of the thread.
+     * @return a thread with defined name.
+     */
+    public BaseThread findThread(String name) {
+        for(Thread.State state:THREAD_KINDS){
+            for(BaseThread thread:threadsClusters.get(state)){
+                 if (name.equals(thread.getName())) {
+                     return thread;
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Checks the thread's <code>ThreadInfo</code>.
+     *
+     * @param info <code>ThreadInfo</code> object to test.
+     * @return result code.
+     * @see #NO_ERROR
+     * @see #ERR_THREAD_NOTFOUND
+     * @see #ERR_STATE
+     * @see #ERR_STACKTRACE
+     */
+    public int checkThreadInfo(ThreadInfo info) {
+        String name = info.getThreadName();
+
+        if (name.indexOf(THREAD_SUFFIX) == -1) {
+            return NO_ERROR;
+        }
+
+        long id = info.getThreadId();
+        Thread.State state = info.getThreadState();
+        StackTraceElement[] stackTrace = info.getStackTrace();
+
+        BaseThread thrd = findThread(id);
+        if (thrd == null) {
+            return ERR_THREAD_NOTFOUND;
+        }
+
+        if (!thrd.checkState(state))
+            return ERR_STATE;
+
+        if (!thrd.checkStackTrace(stackTrace))
+            return ERR_STACKTRACE;
+
+        return NO_ERROR;
+    }
+}
+
+abstract class BaseThread extends Thread {
+
+    private int currentDepth = 0;
+    private String logPrefix;
+    protected Log.Logger logger;
+
+    protected ThreadController controller;
+
+    protected List<String> expectedMethods = new ArrayList<String>();
+    protected int expectedLength;
+
+    protected ThreadsGroupLocks threadsGroupLocks;
+
+    static {
+        if (ThreadController.invocationType == ThreadController.NATIVE_TYPE ||
+                ThreadController.invocationType == ThreadController.MIXED_TYPE) {
+            try {
+                System.loadLibrary("ThreadController");
+            } catch (UnsatisfiedLinkError e) {
+                System.err.println("Could not load \"ThreadController\" "
+                        + "library");
+                System.err.println("java.library.path:"
+                        + System.getProperty("java.library.path"));
+                throw e;
+            }
+        }
+    }
+
+    public BaseThread(ThreadController controller, String name, Log log, ThreadsGroupLocks threadsGroupLocks) {
+        super(name);
+        this.controller = controller;
+        int pos = controller.LOG_PREFIX.indexOf('>');
+        logPrefix = controller.LOG_PREFIX.substring(0, pos) + "::"
+                + name + "> ";
+        setLog(log);
+        this.threadsGroupLocks = threadsGroupLocks;
+
+        expectedLength = 1 + controller.maxDepth + 1;
+        if(controller.invocationType == ThreadController.MIXED_TYPE) {
+             //nativeRecursiveMethod
+             expectedLength ++;
+        }
+
+        expectedMethods.add(BaseThread.class.getName() + ".run");
+
+        switch (controller.invocationType) {
+            case ThreadController.JAVA_TYPE:
+                expectedMethods.add(BaseThread.class.getName() + ".recursiveMethod");
+                break;
+            case ThreadController.NATIVE_TYPE:
+                expectedMethods.add(BaseThread.class.getName() + ".nativeRecursiveMethod");
+                break;
+            case ThreadController.MIXED_TYPE:
+                expectedMethods.add(BaseThread.class.getName() + ".recursiveMethod");
+                expectedMethods.add(BaseThread.class.getName() + ".nativeRecursiveMethod");
+        }
+
+        expectedMethods.add(ThreadsGroupLocks.PlainCountDownLatch.class.getName() + ".countDown");
+    }
+
+    public void run() {
+        try {
+            switch (controller.invocationType) {
+                case ThreadController.JAVA_TYPE:
+                case ThreadController.MIXED_TYPE:
+                    recursiveMethod();
+                    break;
+                case ThreadController.NATIVE_TYPE:
+                    nativeRecursiveMethod();
+                    break;
+                default:
+                    throw new Failure("unknown invocationType:"
+                            + controller.invocationType);
+            }
+        } catch (StackOverflowError e) {
+            logger.complain(e.toString());
+            throw new RuntimeException(e);
+        }
+        logger.trace(controller.THREAD_TRACE_LEVEL, "thread finished");
+    }
+
+    protected abstract void bringState();
+
+    public abstract State getState();
+
+    protected abstract void nativeBringState();
+
+    public abstract boolean checkState(Thread.State state);
+
+    public boolean checkStackTrace(StackTraceElement[] elements) {
+        boolean res = true;
+
+        logger.trace(controller.THREAD_TRACE_LEVEL, "trace elements: "
+                + elements.length);
+
+        if (elements.length > expectedLength) {
+            res = false;
+            logger.complain("Contains " + elements.length + ", more then "
+                    + expectedLength + " elements");
+        }
+
+        for (int j = 0; j < elements.length; j++) {
+            if (!checkElement(elements[j])) {
+                logger.complain("Unexpected method name: "
+                                + elements[j].getMethodName()
+                                + " at " + j + " position");
+                if (elements[j].isNativeMethod()) {
+                    logger.complain("\tline number: (native method)");
+                    logger.complain("\tclass name: " + elements[j].getClassName());
+                } else {
+                    logger.complain("\tline number: " + elements[j].getLineNumber());
+                    logger.complain("\tclass name: " + elements[j].getClassName());
+                    logger.complain("\tfile name: " + elements[j].getFileName());
+                }
+                res = false;
+            }
+        }
+        return res;
+    }
+
+    protected boolean checkElement(StackTraceElement element) {
+        String name = element.getClassName() + "." + element.getMethodName();
+        if (expectedMethods.contains(name)) {
+            return true;
+        }
+
+        logger.trace(controller.THREAD_TRACE_LEVEL, "\"" + name + "\""
+                + " is not expected method name");
+        return false;
+    }
+
+    protected void recursiveMethod() {
+        currentDepth++;
+
+        if (controller.maxDepth - currentDepth > 0) {
+
+            Thread.yield();
+            try {
+                if (ThreadController.invocationType
+                        == ThreadController.MIXED_TYPE) {
+                    nativeRecursiveMethod();
+                } else {
+                    recursiveMethod();
+                }
+
+            } catch (StackOverflowError e) {
+                logger.display(getName() + "> " + e);
+            }
+
+        } else if (controller.maxDepth == currentDepth) {
+            logger.trace(controller.THREAD_TRACE_LEVEL, "state has been "
+                    + "reached");
+            bringState();
+        }
+        currentDepth--;
+    }
+
+    protected native void nativeRecursiveMethod();
+
+    /**
+     * Defines <code>Log.Logger</code> object
+     */
+    public void setLog(Log log) {
+        logger = new Log.Logger(log, logPrefix);
+    }
+}
+
+class BlockedThread extends BaseThread {
+
+    private static final Thread.State STATE = Thread.State.BLOCKED;
+
+    public State getState() {
+        return STATE;
+    }
+
+    public BlockedThread(ThreadController controller, String name, Log log, ThreadsGroupLocks threadsGroupLocks) {
+        super(controller, name, log, threadsGroupLocks);
+
+        this.threadsGroupLocks = threadsGroupLocks;
+
+        expectedLength += 2;
+
+        expectedMethods.add(ThreadsGroupLocks.Blocker.class.getName() + ".block");
+
+        switch (controller.invocationType) {
+            case ThreadController.JAVA_TYPE:
+                expectedMethods.add(BlockedThread.class.getName() + ".bringState");
+                break;
+            case ThreadController.NATIVE_TYPE:
+                expectedMethods.add(BlockedThread.class.getName() + ".nativeBringState");
+                break;
+            case ThreadController.MIXED_TYPE:
+                expectedMethods.add(BlockedThread.class.getName() + ".bringState");
+
+        }
+    }
+
+    protected void bringState() {
+        logger.trace(controller.THREAD_TRACE_LEVEL, "entering to monitor");
+        threadsGroupLocks.getBarrier(getState()).countDown();
+        threadsGroupLocks.blocker.block();
+        logger.trace(controller.THREAD_TRACE_LEVEL, "exiting from monitor");
+    }
+
+    protected native void nativeBringState();
+
+    public boolean checkState(Thread.State state) {
+        return state == Thread.State.BLOCKED;
+    }
+}
+
+class WaitingThread extends BaseThread {
+
+    private static final Thread.State STATE = Thread.State.WAITING;
+    public State getState() {
+        return STATE;
+    }
+
+    private ThreadsGroupLocks threadsGroupLocks;
+
+    public WaitingThread(ThreadController controller, String name, Log log, ThreadsGroupLocks threadsGroupLocks) {
+        super(controller, name, log, threadsGroupLocks);
+
+        this.threadsGroupLocks = threadsGroupLocks;
+
+        expectedLength += 4;
+
+        expectedMethods.add(ThreadsGroupLocks.PlainCountDownLatch.class.getName() + ".await");
+        expectedMethods.add(Object.class.getName() + ".wait");
+
+        switch (controller.invocationType) {
+            case ThreadController.JAVA_TYPE:
+                expectedMethods.add(WaitingThread.class.getName() + ".bringState");
+                break;
+            case ThreadController.NATIVE_TYPE:
+                expectedMethods.add(WaitingThread.class.getName() + ".nativeBringState");
+                break;
+            case ThreadController.MIXED_TYPE:
+                expectedMethods.add(WaitingThread.class.getName() + ".bringState");
+
+        }
+    }
+
+
+    protected void bringState() {
+        ThreadsGroupLocks.PlainCountDownLatch barrier = threadsGroupLocks.getBarrier(STATE);
+        try {
+            logger.trace(controller.THREAD_TRACE_LEVEL, "waiting on a monitor");
+            threadsGroupLocks.getBarrier(getState()).countDown();
+            barrier.await();
+        } catch (InterruptedException e) {
+            logger.display(e.toString());
+        }
+    }
+
+    protected native void nativeBringState();
+
+    public boolean checkState(Thread.State state) {
+        return state == STATE;
+    }
+
+}
+
+class SleepingThread extends BaseThread {
+    private static final Thread.State STATE = State.TIMED_WAITING;
+
+    public State getState() {
+        return STATE;
+    }
+
+    private ThreadsGroupLocks threadsGroupLocks;
+
+    public SleepingThread(ThreadController controller, String name, Log log, ThreadsGroupLocks threadsGroupLocks) {
+        super(controller, name, log, threadsGroupLocks);
+
+        this.threadsGroupLocks = threadsGroupLocks;
+
+        expectedLength += 3;
+
+        expectedMethods.add(Thread.class.getName() + ".sleep");
+        expectedMethods.add(SleepingThread.class.getName() + ".run");
+
+        switch (controller.invocationType) {
+            case ThreadController.JAVA_TYPE:
+                expectedMethods.add(SleepingThread.class.getName() + ".bringState");
+                break;
+            case ThreadController.NATIVE_TYPE:
+                 expectedMethods.add(SleepingThread.class.getName() + ".nativeBringState");
+                break;
+            case ThreadController.MIXED_TYPE:
+                 expectedMethods.add(SleepingThread.class.getName() + ".bringState");
+        }
+
+    }
+
+    protected void bringState() {
+        try {
+            threadsGroupLocks.getBarrier(getState()).countDown();
+            Thread.sleep(3600 * 1000);
+        } catch (InterruptedException e) {
+            logger.display(e.toString());
+        }
+    }
+
+    protected native void nativeBringState();
+
+    public boolean checkState(Thread.State state) {
+        return state == Thread.State.TIMED_WAITING;
+    }
+
+    public void run() {
+        try {
+            switch (controller.invocationType) {
+                case ThreadController.JAVA_TYPE:
+                case ThreadController.MIXED_TYPE:
+                    recursiveMethod();
+                    break;
+                case ThreadController.NATIVE_TYPE:
+                    nativeRecursiveMethod();
+                    break;
+                default:
+                    throw new Failure("unknown invocationType:"
+                            + controller.invocationType);
+            }
+            logger.trace(controller.THREAD_TRACE_LEVEL, "thread finished");
+        } catch (StackOverflowError e) {
+            logger.complain(e.toString());
+            throw new RuntimeException(e);
+        }
+    }
+}
+
+class RunningThread extends BaseThread {
+    public State getState() {
+        return STATE;
+    }
+
+    private static final Thread.State STATE = Thread.State.RUNNABLE;
+    private ThreadsGroupLocks threadsGroupLocks;
+
+    public RunningThread(ThreadController controller, String name, Log log, ThreadsGroupLocks threadsGroupLocks) {
+        super(controller, name, log, threadsGroupLocks);
+        this.threadsGroupLocks = threadsGroupLocks;
+
+        expectedLength += 2;
+
+        expectedMethods.add(Thread.class.getName() + ".yield");
+
+        switch (controller.invocationType) {
+            case ThreadController.JAVA_TYPE:
+                expectedMethods.add(RunningThread.class.getName() + ".bringState");
+                break;
+            case ThreadController.NATIVE_TYPE:
+                expectedMethods.add(RunningThread.class.getName() + ".nativeBringState");
+                break;
+            case ThreadController.MIXED_TYPE:
+                expectedMethods.add(RunningThread.class.getName() + ".bringState");
+        }
+    }
+
+    protected void bringState() {
+        logger.trace(controller.THREAD_TRACE_LEVEL, "running loop");
+        threadsGroupLocks.getBarrier(getState()).countDown();
+        while (!threadsGroupLocks.runnableCanExit) {
+            Thread.yield();
+        }
+    }
+
+    protected native void nativeBringState();
+
+    public boolean checkState(Thread.State state) {
+        return state == Thread.State.RUNNABLE;
+    }
+}
+
+
+class ThreadsGroupLocks {
+
+    private Log.Logger logger;
+
+    //for all
+    private Map<Thread.State, PlainCountDownLatch> barriers = new HashMap<Thread.State, PlainCountDownLatch>();
+
+    //for Blocked
+    public final Blocker blocker = new Blocker();
+
+    //for Runnable
+    public volatile boolean runnableCanExit = false;
+
+    public ThreadsGroupLocks(Map<Thread.State, Integer> threadsCount, Log.Logger logger) {
+        this.logger = logger;
+        for (Thread.State state : threadsCount.keySet()) {
+            if (state == Thread.State.WAITING) {
+                barriers.put(state, new PlainCountDownLatch(threadsCount.get(state) + 1));
+            } else {
+                barriers.put(state, new PlainCountDownLatch(threadsCount.get(state)));
+            }
+        }
+        blocker.startBlocker();
+    }
+
+    public PlainCountDownLatch getBarrier(Thread.State state) {
+        return barriers.get(state);
+    }
+
+    public void waitForGroup(Thread.State stateGroup) {
+        switch (stateGroup) {
+            case BLOCKED:
+            case RUNNABLE:
+            case TIMED_WAITING:
+                try {
+                    barriers.get(stateGroup).await();
+                } catch (InterruptedException e) {
+                    logger.display(e.toString());
+                }
+                break;
+
+            case WAITING:
+                while (barriers.get(stateGroup).getCount() != 1) {
+                    Thread.yield();
+                }
+                break;
+        }
+    }
+
+    public void releaseGroup(Thread.State stateGroup) {
+        switch (stateGroup) {
+            case BLOCKED:
+                blocker.unBlock();
+                break;
+            case RUNNABLE:
+                runnableCanExit = true;
+                break;
+            case TIMED_WAITING:
+            case WAITING:
+                barriers.get(stateGroup).countDown();
+                break;
+        }
+    }
+
+    public class Blocker {
+
+        private Object monitor = new Object();
+        private PlainCountDownLatch blockerCanExit = new PlainCountDownLatch(1);
+        private PlainCountDownLatch blockerStart = new PlainCountDownLatch(1);
+
+        private Runnable blockerThread = new Runnable() {
+            public void run() {
+                synchronized (monitor) {
+                    blockerStart.countDown();
+                    try {
+                        blockerCanExit.await();
+                    } catch (InterruptedException e) {
+                        logger.display(e.toString());
+                    }
+
+                }
+            }
+        };
+
+        public void startBlocker() {
+            new Thread(blockerThread, "Blocker").start();
+        }
+
+        public void block() {
+            try {
+                blockerStart.await();
+            } catch (InterruptedException e) {
+                logger.complain(e.toString());
+            }
+            synchronized (monitor) {
+            }
+        }
+
+        public void unBlock() {
+            blockerCanExit.countDown();
+        }
+    }
+
+     public static class PlainCountDownLatch {
+        private volatile int counter;
+        private Object counterMonitor = new Object();
+
+        public PlainCountDownLatch(int counter){
+            this.counter = counter;
+        }
+
+        public void countDown(){
+            synchronized (counterMonitor) {
+                counter--;
+                if(counter==0) {
+                    counterMonitor.notifyAll();
+                }
+            }
+        }
+
+        public void await() throws InterruptedException{
+            synchronized (counterMonitor){
+                while(counter != 0){
+                    counterMonitor.wait();
+                }
+            }
+        }
+
+         public int getCount(){
+             synchronized (counterMonitor) {
+                 return counter;
+             }
+         }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/ThreadMonitor.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,442 @@
+/*
+ * Copyright (c) 2003, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share;
+
+import java.lang.management.*;
+import javax.management.*;
+import javax.management.openmbean.*;
+import java.util.*;
+import nsk.share.*;
+
+/**
+ * <code>ThreadMonitor</code> class is a wrapper of <code>ThreadMXBean</code>.
+ * Depending on command line arguments, an instance of this class redirects
+ * invocations to the <code>ThreadMXBean</code> interface. If
+ * <code>-testMode="directly"</code> option is set, this instance directly
+ * invokes corresponding method of the <code>ThreadMXBean</code> interface.
+ * If <code>-testMode="server"</code> option is set it will make invocations
+ * via MBeanServer. If <code>-testMode="proxy"</code> option is set it will
+ * make invocations via MBeanServer proxy.
+ *
+ * @see ArgumentHandler
+ */
+public class ThreadMonitor extends Monitor {
+
+    // Names of the attributes of ThreadMXBean
+    private static final String GET_THREAD_INFO = "getThreadInfo";
+    private static final String GET_THREAD_CPU_TIME = "ThreadCpuTime";
+    private static final String ALL_THREAD_IDS = "AllThreadIds";
+    private static final String RESET_PEAK = "resetPeakThreadCount";
+    private static final String GET_PEAK_COUNT = "PeakThreadCount";
+    private static final String THREAD_COUNT = "ThreadCount";
+    private static final String FIND_THREADS = "findMonitorDeadlockedThreads";
+    private static final String IS_CURRENT = "CurrentThreadCpuTimeSupported";
+    private static final String IS_CPUTIME = "ThreadCpuTimeSupported";
+    private static final String IS_CONT_SUPP
+        = "ThreadContentionMonitoringSupported";
+    private static final String IS_CONT_ENAB
+        = "ThreadContentionMonitoringEnabled";
+
+    // An instance of ThreadMXBean
+    private static ThreadMXBean mbean = ManagementFactory.getThreadMXBean();
+
+    // proxy instance
+    private ThreadMXBean proxyInstance;
+
+    // Internal trace level
+    private static final int TRACE_LEVEL = 10;
+
+    static {
+        Monitor.logPrefix = "ThreadMonitor> ";
+    }
+
+    /**
+     * Creates a new <code>ThreadMonitor</code> object.
+     *
+     * @param log <code>Log</code> object to print info to.
+     * @param argumentHandler <code>ArgumentHandler</code> object that saves
+     *        all info about test's arguments.
+     *
+     */
+    public ThreadMonitor(Log log, ArgumentHandler argumentHandler) {
+        super(log, argumentHandler);
+    }
+
+    /**
+     *
+     * Return a proxy instance for a platform
+     * {@link java.lang.management.ThreadMXBean
+     * <code>ThreadMXBean</code>} interface.
+     *
+     */
+    synchronized ThreadMXBean getProxy() {
+        if (proxyInstance == null) {
+            // create proxy instance
+            try {
+                proxyInstance = (ThreadMXBean)
+                ManagementFactory.newPlatformMXBeanProxy(
+                    getMBeanServer(),
+                    ManagementFactory.THREAD_MXBEAN_NAME,
+                    ThreadMXBean.class
+                );
+            } catch (Exception e) {
+                throw new Failure(e);
+            }
+        }
+        return proxyInstance;
+    }
+
+    /**
+     * Redirects the invocation to {@link
+     * java.lang.management.ThreadMXBean#getAllThreadIds()
+     * <code>ThreadMXBean.getAllThreadIds()</code>}.
+     *
+     * @return an array of <code>long</code>, each is a thread ID.
+     */
+    public long[] getAllThreadIds() {
+        int mode = getTestMode();
+
+        switch (mode) {
+        case DIRECTLY_MODE:
+            logger.trace(TRACE_LEVEL,"[getAllThreadIds] getAllThreadIds()"
+                            + " directly invoked");
+            return mbean.getAllThreadIds();
+
+        case SERVER_MODE:
+            logger.trace(TRACE_LEVEL,"[getAllThreadIds] getAllThreadIds()"
+                       + " invoked through MBeanServer");
+            return getLongArrayAttribute(mbeanObjectName, ALL_THREAD_IDS);
+
+        case PROXY_MODE:
+            logger.trace(TRACE_LEVEL,"[getAllThreadIds] getAllThreadIds()"
+                            + " invoked through MBeanServer proxy");
+            return getProxy().getAllThreadIds();
+        }
+
+        throw new TestBug("Unknown testMode " + mode);
+    }
+
+    /**
+     * Redirects the invocation to {@link
+     * java.lang.management.ThreadMXBean#getThreadInfo
+     * <code>ThreadMXBean.getThreadInfo()</code>}.
+     *
+     * @param id the thread ID of the thread.
+     * @param maxDepth the maximum number of entries in the stack trace to
+     *        be dumped. <code>Integer.MAX_VALUE</code> could be used to request
+     *        entire stack to be dumped.
+     *
+     * @return A <code>ThreadInfo</code> of the thread of the given ID.
+     *          <code>null</code> if the thread of the given ID is not alive
+     *          or it does not exist
+     */
+    public ThreadInfo getThreadInfo(long id, int maxDepth) {
+        int mode = getTestMode();
+
+        switch (mode) {
+        case DIRECTLY_MODE:
+            logger.trace(TRACE_LEVEL, "[getThreadInfo] getThreadInfo(long, "
+                       + "int) directly invoked");
+            return mbean.getThreadInfo(id, maxDepth);
+
+        case SERVER_MODE:
+            Object[] params = {new Long(id), new Integer(maxDepth)};
+            String[] signature = {"long", "int"};
+
+            try {
+                logger.trace(TRACE_LEVEL, "[getThreadInfo] getThreadInfo(long, "
+                           + "int) invoked through MBeanServer");
+                Object value = getMBeanServer().invoke(mbeanObjectName,
+                                                             GET_THREAD_INFO,
+                                                             params, signature);
+                if (value instanceof ThreadInfo)
+                        return (ThreadInfo) value;
+                else {
+                        CompositeData data = (CompositeData) value;
+                        return ThreadInfo.from(data);
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+                throw new Failure(e);
+            }
+        case PROXY_MODE:
+            logger.trace(TRACE_LEVEL, "[getThreadInfo] getThreadInfo(long, "
+                       + "int) invoked through MBeanServer proxy");
+            return getProxy().getThreadInfo(id, maxDepth);
+        }
+
+        throw new TestBug("Unknown testMode " + mode);
+    }
+
+    /**
+     * Redirects the invocation to {@link
+     * java.lang.management.ThreadMXBean#isCurrentThreadCpuTimeSupported()
+     * <code>ThreadMXBean.isCurrentThreadCpuTimeSupported()</code>}.
+     *
+     * @return <code>true</code>, if the JVM supports CPU time measurement for
+     *         current thread, <code>false</code> otherwise.
+     */
+    public boolean isCurrentThreadCpuTimeSupported() {
+        int mode = getTestMode();
+
+        switch (mode) {
+        case DIRECTLY_MODE:
+            return mbean.isCurrentThreadCpuTimeSupported();
+
+        case SERVER_MODE:
+            return getBooleanAttribute(mbeanObjectName, IS_CURRENT);
+
+        case PROXY_MODE:
+            return getProxy().isCurrentThreadCpuTimeSupported();
+        }
+
+        throw new TestBug("Unknown testMode " + mode);
+    }
+
+    /**
+     * Redirects the invocation to {@link
+     * java.lang.management.ThreadMXBean#isThreadCpuTimeSupported()
+     * <code>ThreadMXBean.isThreadCpuTimeSupported()</code>}.
+     *
+     * @return <code>true</code>, if the JVM supports CPU time measurement for
+     *         any threads, <code>false</code> otherwise.
+     */
+    public boolean isThreadCpuTimeSupported() {
+        int mode = getTestMode();
+
+        switch (mode) {
+        case DIRECTLY_MODE:
+            return mbean.isThreadCpuTimeSupported();
+
+        case SERVER_MODE:
+            return getBooleanAttribute(mbeanObjectName, IS_CPUTIME);
+
+        case PROXY_MODE:
+            return getProxy().isThreadCpuTimeSupported();
+        }
+
+        throw new TestBug("Unknown testMode " + mode);
+    }
+
+    /**
+     * Redirects the invocation to {@link
+     * java.lang.management.ThreadMXBean#isThreadContentionMonitoringSupported()
+     * <code>ThreadMXBean.isThreadContentionMonitoringSupported()</code>}.
+     *
+     * @return <code>true</code>, if the JVM supports thread contantion
+     *         monitoring, <code>false</code> otherwise.
+     */
+    public boolean isThreadContentionMonitoringSupported() {
+        int mode = getTestMode();
+
+        switch (mode) {
+        case DIRECTLY_MODE:
+            return mbean.isThreadContentionMonitoringSupported();
+
+        case SERVER_MODE:
+            return getBooleanAttribute(mbeanObjectName, IS_CONT_SUPP);
+
+        case PROXY_MODE:
+            return getProxy().isThreadContentionMonitoringSupported();
+        }
+
+        throw new TestBug("Unknown testMode " + mode);
+    }
+
+    /**
+     * Redirects the invocation to {@link
+     * java.lang.management.ThreadMXBean#setThreadContentionMonitoringEnabled
+     * <code>ThreadMXBean.setThreadContentionMonitoringEnabled()</code>}.
+     *
+     * @param enable <code>true</code> to enable, <code>false</code> to disable.
+     */
+    public void setThreadContentionMonitoringEnabled(boolean enable) {
+        int mode = getTestMode();
+
+        switch (mode) {
+        case DIRECTLY_MODE:
+            mbean.setThreadContentionMonitoringEnabled(enable);
+            break;
+
+        case SERVER_MODE:
+            setBooleanAttribute(mbeanObjectName, IS_CONT_ENAB, enable);
+            break;
+
+        case PROXY_MODE:
+            getProxy().setThreadContentionMonitoringEnabled(enable);
+            break;
+
+        default:
+            throw new TestBug("Unknown testMode " + mode);
+        }
+    }
+
+    /**
+     * Redirects the invocation to {@link
+     * java.lang.management.ThreadMXBean#getThreadCpuTime
+     * <code>ThreadMXBean.getThreadCpuTime()</code>}.
+     *
+     * @param id the id of a thread
+     *
+     * @return the CPU time for a thread of the specified ID, if the thread
+     *         existsand is alive and CPU time measurement is enabled, -1
+     *         otherwise.
+     */
+    public long getThreadCpuTime(long id) {
+        int mode = getTestMode();
+
+        switch (mode) {
+        case DIRECTLY_MODE:
+            return mbean.getThreadCpuTime(id);
+
+        case SERVER_MODE:
+            Object[] params = {new Long(id)};
+            String[] signature = {"long"};
+
+            try {
+                Long l = (Long) getMBeanServer().invoke(mbeanObjectName,
+                                                            GET_THREAD_CPU_TIME,
+                                                             params, signature);
+                return l.longValue();
+            } catch (Exception e) {
+                e.printStackTrace();
+                throw new Failure(e);
+            }
+
+        case PROXY_MODE:
+            return getProxy().getThreadCpuTime(id);
+        }
+
+        throw new TestBug("Unknown testMode " + mode);
+    }
+
+    /**
+     * Redirects the invocation to {@link
+     * java.lang.management.ThreadMXBean#getThreadCount()
+     * <code>ThreadMXBean.getThreadCount()</code>}.
+     *
+     * @return the current number of live threads.
+     */
+    public int getThreadCount() {
+        int mode = getTestMode();
+
+        switch (mode) {
+        case DIRECTLY_MODE:
+            return mbean.getThreadCount();
+
+        case SERVER_MODE:
+            return getIntAttribute(mbeanObjectName, THREAD_COUNT);
+
+        case PROXY_MODE:
+            return getProxy().getThreadCount();
+        }
+
+        throw new TestBug("Unknown testMode " + mode);
+    }
+
+    /**
+     * Redirects the invocation to {@link
+     * java.lang.management.ThreadMXBean#getPeakThreadCount()
+     * <code>ThreadMXBean.getPeakThreadCount()</code>}.
+     *
+     * @return the peak live thrad count.
+     */
+    public int getPeakThreadCount() {
+        int mode = getTestMode();
+
+        switch (mode) {
+        case DIRECTLY_MODE:
+            return mbean.getPeakThreadCount();
+
+        case SERVER_MODE:
+            return getIntAttribute(mbeanObjectName, GET_PEAK_COUNT);
+
+        case PROXY_MODE:
+            return getProxy().getPeakThreadCount();
+        }
+
+        throw new TestBug("Unknown testMode " + mode);
+    }
+
+    /**
+     * Redirects the invocation to {@link
+     * java.lang.management.ThreadMXBean#resetPeakThreadCount()
+     * <code>ThreadMXBean.resetPeakThreadCount()</code>}.
+     */
+    public void resetPeakThreadCount() {
+        int mode = getTestMode();
+
+        switch (mode) {
+        case DIRECTLY_MODE:
+            mbean.resetPeakThreadCount();
+            break;
+
+        case SERVER_MODE:
+            try {
+               getMBeanServer().invoke(mbeanObjectName, RESET_PEAK, null, null);
+            } catch (Exception e) {
+                e.printStackTrace(logger.getOutStream());
+                throw new Failure(e);
+            }
+            break;
+        case PROXY_MODE:
+            getProxy().resetPeakThreadCount();
+            break;
+
+        default:
+            throw new TestBug("Unknown testMode " + mode);
+        }
+
+    }
+
+    /**
+     * Redirects the invocation to {@link
+     * java.lang.management.ThreadMXBean#findMonitorDeadlockedThreads
+     * <code>ThreadMXBean.findMonitorDeadlockedThreads()</code>}.
+     *
+     * @return an array of IDs of the reads that are monitor deadlocked, if any;
+     *         <code>null</code> otherwise.
+     */
+    public long[] findMonitorDeadlockedThreads() {
+        int mode = getTestMode();
+
+        switch (mode) {
+        case DIRECTLY_MODE:
+            return mbean.findMonitorDeadlockedThreads();
+
+        case SERVER_MODE:
+            try {
+                Object o = (Object) getMBeanServer().invoke(mbeanObjectName,
+                                                      FIND_THREADS, null, null);
+                return (long[]) o;
+            } catch (Exception e) {
+                e.printStackTrace(logger.getOutStream());
+                throw new Failure(e);
+            }
+        case PROXY_MODE:
+            return getProxy().findMonitorDeadlockedThreads();
+        }
+        throw new TestBug("Unknown testMode " + mode);
+    }
+} // ThreadMonitor
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/direct/DirectMonitoringFactory.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share.direct;
+
+import java.lang.management.*;
+import javax.management.*;
+import nsk.monitoring.share.*;
+import java.util.List;
+import java.lang.reflect.Method;
+
+/**
+ * This is MonitoringFactory implementation, which obtains
+ * MXBeans directly from ManagementFactory.
+ *
+ * @see nsk.monitoring.share.MonitoringFactory
+ */
+public class DirectMonitoringFactory implements MonitoringFactory {
+        public ClassLoadingMXBean getClassLoadingMXBean() {
+                return ManagementFactory.getClassLoadingMXBean();
+        }
+
+        public boolean hasCompilationMXBean() {
+                return ManagementFactory.getCompilationMXBean() != null;
+        }
+
+        public CompilationMXBean getCompilationMXBean() {
+                return ManagementFactory.getCompilationMXBean();
+        }
+
+        public List<GarbageCollectorMXBean> getGarbageCollectorMXBeans() {
+                return ManagementFactory.getGarbageCollectorMXBeans();
+        }
+
+        public RuntimeMXBean getRuntimeMXBean() {
+                return ManagementFactory.getRuntimeMXBean();
+        }
+
+        public MemoryMXBean getMemoryMXBean() {
+                return ManagementFactory.getMemoryMXBean();
+        }
+
+        public NotificationEmitter getMemoryMXBeanNotificationEmitter() {
+                return (NotificationEmitter) ManagementFactory.getMemoryMXBean();
+        }
+
+        public List<MemoryPoolMXBean> getMemoryPoolMXBeans() {
+                return ManagementFactory.getMemoryPoolMXBeans();
+        }
+
+        public ThreadMXBean getThreadMXBean() {
+                return ManagementFactory.getThreadMXBean();
+        }
+
+        public boolean hasThreadMXBeanNew() {
+            boolean supported = false;
+            Class cl = ManagementFactory.getThreadMXBean().getClass();
+            Method[] methods = cl.getDeclaredMethods();
+            for (int i = 0; i < methods.length; i++ ) {
+                if (methods[i].getName().equals("isThreadAllocatedMemorySupported")) {
+                    supported = true;
+                    break;
+                }
+            }
+            return supported;
+        }
+
+        public ThreadMXBean getThreadMXBeanNew() {
+            return getThreadMXBean();
+        }
+        /*
+        public OperatingSystemMXBean getOperatingSystemMXBean() {
+                return ManagementFactory.getOperatingSystemMXBean();
+        }
+
+        */
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/libStackTraceController.c	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include "StackTraceController.c"
+#include "jni_tools.c"
+#include "nsk_tools.c"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/libThreadController.c	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include "ThreadController.c"
+#include "jni_tools.c"
+#include "nsk_tools.c"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/proxy/ProxyMonitoringFactory.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,174 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share.proxy;
+
+import javax.management.MBeanServer;
+import java.lang.management.*;
+import javax.management.*;
+import nsk.monitoring.share.*;
+import java.util.*;
+import java.lang.reflect.Method;
+
+public class ProxyMonitoringFactory implements MonitoringFactory {
+        private MBeanServer mbeanServer;
+        private ClassLoadingMXBean classLoadingMXBean;
+        private CompilationMXBean compilationMXBean;
+        private List<GarbageCollectorMXBean> garbageCollectorMXBeans;
+        private RuntimeMXBean runtimeMXBean;
+        private MemoryMXBean memoryMXBean;
+        private List<MemoryPoolMXBean> memoryPoolMXBeans;
+        private ThreadMXBean threadMXBean;
+        private com.sun.management.ThreadMXBean threadMXBeanNew;
+
+        public ProxyMonitoringFactory(MBeanServer mbeanServer) {
+                this.mbeanServer = mbeanServer;
+        }
+
+        protected <T> T getProxy(String name, Class<T> cl) {
+                try {
+                        return (T) ManagementFactory.newPlatformMXBeanProxy(
+                                mbeanServer,
+                                name,
+                                cl
+                        );
+                } catch (Exception e) {
+                        throw Monitoring.convertException(e);
+                }
+        }
+
+        protected <T> T getProxy(ObjectName name, Class<T> cl) {
+                return getProxy(name.toString(), cl);
+        }
+
+        protected <T> List<T> getProxies(String prefix, Class<T> cl) {
+                Collection<ObjectName> coll = Monitoring.queryNamesByStart(mbeanServer, prefix + ",");
+                List<T> list = new ArrayList<T>(coll.size());
+                for (ObjectName name : coll) {
+                        list.add(getProxy(name, cl));
+                }
+                return list;
+        }
+
+        public synchronized ClassLoadingMXBean getClassLoadingMXBean() {
+                if (classLoadingMXBean == null)
+                        classLoadingMXBean = getProxy(
+                                ManagementFactory.CLASS_LOADING_MXBEAN_NAME,
+                                ClassLoadingMXBean.class
+                        );
+                return classLoadingMXBean;
+        }
+
+        public boolean hasCompilationMXBean() {
+                try {
+                        return mbeanServer.isRegistered(new ObjectName(ManagementFactory.COMPILATION_MXBEAN_NAME));
+                } catch (MalformedObjectNameException e) {
+                        throw Monitoring.convertException(e);
+                }
+        }
+
+        public synchronized CompilationMXBean getCompilationMXBean() {
+                if (compilationMXBean == null)
+                        compilationMXBean = getProxy(
+                                ManagementFactory.COMPILATION_MXBEAN_NAME,
+                                CompilationMXBean.class
+                        );
+                return compilationMXBean;
+        }
+
+        public synchronized List<GarbageCollectorMXBean> getGarbageCollectorMXBeans() {
+                if (garbageCollectorMXBeans == null) {
+                        Collection<ObjectName> coll = Monitoring.queryNamesByStart(mbeanServer, ManagementFactory.GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE + ",");
+                        garbageCollectorMXBeans = new ArrayList<GarbageCollectorMXBean>(coll.size());
+                        for (ObjectName name : coll) {
+                                garbageCollectorMXBeans.add(getProxy(
+                                        name,
+                                        GarbageCollectorMXBean.class
+                                ));
+                        }
+                }
+                return garbageCollectorMXBeans;
+        }
+
+        public synchronized RuntimeMXBean getRuntimeMXBean() {
+                if (runtimeMXBean == null) {
+                        runtimeMXBean = getProxy(
+                                ManagementFactory.RUNTIME_MXBEAN_NAME,
+                                RuntimeMXBean.class
+                        );
+                }
+                return runtimeMXBean;
+        }
+
+        public synchronized MemoryMXBean getMemoryMXBean() {
+                if (memoryMXBean == null) {
+                        memoryMXBean = getProxy(
+                                ManagementFactory.MEMORY_MXBEAN_NAME,
+                                MemoryMXBean.class
+                        );
+                }
+                return memoryMXBean;
+        }
+
+        public synchronized NotificationEmitter getMemoryMXBeanNotificationEmitter() {
+                return new ServerNotificationEmitter(mbeanServer, ManagementFactory.MEMORY_MXBEAN_NAME);
+        }
+
+        public synchronized List<MemoryPoolMXBean> getMemoryPoolMXBeans() {
+                if (memoryPoolMXBeans == null)
+                        memoryPoolMXBeans = getProxies(ManagementFactory.MEMORY_POOL_MXBEAN_DOMAIN_TYPE, MemoryPoolMXBean.class);
+                return memoryPoolMXBeans;
+        }
+
+        public synchronized ThreadMXBean getThreadMXBean() {
+                if (threadMXBean == null)
+                        threadMXBean = getProxy(
+                                ManagementFactory.THREAD_MXBEAN_NAME,
+                                ThreadMXBean.class
+                        );
+                return threadMXBean;
+        }
+
+        public boolean hasThreadMXBeanNew() {
+            boolean supported = false;
+            Class cl = ManagementFactory.getThreadMXBean().getClass();
+            Method[] methods = cl.getDeclaredMethods();
+            for (int i = 0; i < methods.length; i++ ) {
+                if (methods[i].getName().equals("isThreadAllocatedMemorySupported")) {
+                    supported = true;
+                    break;
+                }
+            }
+            return supported;
+        }
+
+        public ThreadMXBean getThreadMXBeanNew() {
+            if (threadMXBeanNew == null) {
+                threadMXBeanNew = getProxy(
+                    ManagementFactory.THREAD_MXBEAN_NAME,
+                    com.sun.management.ThreadMXBean.class
+                );
+            }
+            return (ThreadMXBean) threadMXBeanNew;
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/server/ServerClassLoadingMXBean.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share.server;
+
+import javax.management.MBeanServer;
+import java.lang.management.*;
+
+public class ServerClassLoadingMXBean extends ServerMXBean implements ClassLoadingMXBean {
+        private static final String LOADED_CLASSES = "LoadedClassCount";
+        private static final String TOTAL_CLASSES = "TotalLoadedClassCount";
+        private static final String UNLOADED_CLASSES = "UnloadedClassCount";
+        private static final String VERBOSE = "Verbose";
+
+        public ServerClassLoadingMXBean(MBeanServer mbeanServer) {
+                super(mbeanServer, ManagementFactory.CLASS_LOADING_MXBEAN_NAME);
+        }
+
+        public int getLoadedClassCount() {
+                return getIntAttribute(LOADED_CLASSES);
+        }
+
+        public long getTotalLoadedClassCount() {
+                return getLongAttribute(TOTAL_CLASSES);
+        }
+
+        public long getUnloadedClassCount() {
+                return getLongAttribute(UNLOADED_CLASSES);
+        }
+
+        public boolean isVerbose() {
+                return getBooleanAttribute(VERBOSE);
+        }
+
+        public void setVerbose(boolean verbose) {
+                setBooleanAttribute(VERBOSE, verbose);
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/server/ServerCompilationMXBean.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share.server;
+
+import javax.management.MBeanServer;
+import java.lang.management.*;
+
+public class ServerCompilationMXBean extends ServerMXBean implements CompilationMXBean {
+        private static final String NAME = "Name";
+        private static final String TOTAL_COMPILATION_TIME = "TotalCompilationTime";
+        private static final String IS_COMP = "CompilationTimeMonitoringSupported";
+
+        public ServerCompilationMXBean(MBeanServer mbeanServer) {
+                super(mbeanServer, ManagementFactory.COMPILATION_MXBEAN_NAME);
+        }
+
+        public String getName() {
+                return getStringAttribute(NAME);
+        }
+
+        public long getTotalCompilationTime() {
+                return getLongAttribute(TOTAL_COMPILATION_TIME);
+        }
+
+        public boolean isCompilationTimeMonitoringSupported() {
+                return getBooleanAttribute(IS_COMP);
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/server/ServerGarbageCollectorMXBean.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share.server;
+
+import javax.management.*;
+import java.lang.management.*;
+
+public class ServerGarbageCollectorMXBean extends ServerMemoryManagerMXBean implements GarbageCollectorMXBean {
+        private static final String COLLECTION_COUNT = "CollectionCount";
+        private static final String COLLECTION_TIME = "CollectionTime";
+
+        public ServerGarbageCollectorMXBean(MBeanServer mbeanServer, String name) {
+                super(mbeanServer, name);
+        }
+
+        public ServerGarbageCollectorMXBean(MBeanServer mbeanServer, ObjectName name) {
+                super(mbeanServer, name);
+        }
+
+        public long getCollectionCount() {
+                return getLongAttribute(COLLECTION_COUNT);
+        }
+
+        public long getCollectionTime() {
+                return getLongAttribute(COLLECTION_TIME);
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/server/ServerMXBean.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,271 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share.server;
+
+import javax.management.*;
+import javax.management.openmbean.CompositeData;
+import java.lang.management.*;
+import nsk.share.*;
+import nsk.monitoring.share.*;
+import java.lang.reflect.Method;
+import java.lang.reflect.Array;
+import java.lang.reflect.InvocationTargetException;
+
+public class ServerMXBean {
+        protected MBeanServer mbeanServer;
+        protected ObjectName objectName;
+
+        public ServerMXBean(MBeanServer mbeanServer, String name) {
+                this.mbeanServer = mbeanServer;
+                try {
+                        this.objectName = new ObjectName(name);
+                } catch (Exception e) {
+                        throw Monitoring.convertException(e);
+                }
+        }
+
+        public ServerMXBean(MBeanServer mbeanServer, ObjectName objectName) {
+                this.mbeanServer = mbeanServer;
+                this.objectName = objectName;
+        }
+
+        protected RuntimeException convertException(Exception e) {
+                //e.printStackTrace(logger.getOutStream());
+                return new Failure(e);
+        }
+
+        /**
+         * Retrieves the <code>int</code> value of the specified attribute
+         * from MBeanServer.
+         *
+         * @param object MBean's <code>ObjectName</code>
+         * @param name name of the attribute.
+         *
+         * @return value of the attribute.
+         */
+        protected int getIntAttribute(String name) {
+                try {
+                        Integer i = (Integer) mbeanServer.getAttribute(objectName, name);
+                        return i.intValue();
+                } catch (Exception e) {
+                        throw convertException(e);
+                }
+        }
+
+        /**
+         * Retrieves the <code>long</code> value of the specified attribute
+         * from MBeanServer.
+         *
+         * @param object MBean's <code>ObjectName</code>
+         * @param name name of the attribute.
+         *
+         * @return value of the attribute.
+         */
+        protected long getLongAttribute(String name) {
+                try {
+                        Long l = (Long) mbeanServer.getAttribute(objectName, name);
+                        return l.longValue();
+                } catch (Exception e) {
+                        throw convertException(e);
+                }
+        }
+
+        /**
+         * Sets the value of the specified <code>long</code> attribute
+         * from MBeanServer.
+         *
+         * @param object MBean's <code>ObjectName</code>
+         * @param name name of the attribute.
+         *
+         * @return value of the attribute.
+         */
+        protected void setLongAttribute(String name, long value) {
+                Attribute attribute = new Attribute(name, new Long(value));
+                try {
+                        mbeanServer.setAttribute(objectName, attribute);
+                } catch (Exception e) {
+                        throw convertException(e);
+                }
+        }
+
+
+        /**
+         * Sets the <code>boolean</code> value to the specified attribute from
+         * MBeanServer.
+         *
+         * @param object MBean's <code>ObjectName</code>
+         * @param name name of the attribute.
+         * @param value value of the attribute.
+         */
+        protected void setBooleanAttribute(String name, boolean value) {
+                Attribute attribute = new Attribute(name, new Boolean(value));
+                try {
+                        mbeanServer.setAttribute(objectName, attribute);
+                } catch (Exception e) {
+                        throw convertException(e);
+                }
+        }
+
+        /**
+         * Retrieves the <code>boolean</code> value of the specified attribute
+         * from MBeanServer.
+         *
+         * @param object MBean's <code>ObjectName</code>
+         * @param name name of the attribute.
+         *
+         * @return value of the attribute.
+         */
+        protected boolean getBooleanAttribute(String name) {
+                try {
+                        Boolean b = (Boolean) mbeanServer.getAttribute(objectName, name);
+                        return b.booleanValue();
+                } catch (Exception e) {
+                        throw convertException(e);
+                }
+        }
+
+        /**
+         * Retrieves the <code>String</code> value of the specified attribute
+         * from MBeanServer.
+         *
+         * @param object MBean's <code>ObjectName</code>
+         * @param name name of the attribute.
+         *
+         * @return value of the attribute.
+         */
+        protected String getStringAttribute(String name) {
+                try {
+                        String s = (String) mbeanServer.getAttribute(objectName, name);
+                        return s;
+                } catch (Exception e) {
+                        throw convertException(e);
+                }
+        }
+
+        /**
+         * Retrieves the <code>String</code> value of the specified attribute
+         * from MBeanServer.
+         *
+         * @param object MBean's <code>ObjectName</code>
+         * @param name name of the attribute.
+         *
+         * @return value of the attribute.
+         */
+        protected String[] getStringArrayAttribute(String name) {
+                try {
+                        String[] s = (String[]) mbeanServer.getAttribute(objectName, name);
+                        return s;
+                } catch (Exception e) {
+                        throw convertException(e);
+                }
+        }
+
+        /**
+         * Retrieves the <code>MemoryUsage</code> value of the specified attribute
+         * from MBeanServer.
+         *
+         * @param object MBean's <code>ObjectName</code>
+         * @param name name of the attribute.
+         *
+         * @return value of the attribute.
+         */
+        protected MemoryUsage getMemoryUsageAttribute(String name) {
+                try {
+                        Object data = mbeanServer.getAttribute(objectName, name);
+                        if (data instanceof MemoryUsage)
+                                return (MemoryUsage) data;
+                        return MemoryUsage.from((CompositeData) data);
+                } catch (Exception e) {
+                        throw convertException(e);
+                }
+        }
+
+        /**
+         * Retrieves the <code>MemoryType</code> value of the specified attribute
+         * from MBeanServer.
+         *
+         * @param object MBean's <code>ObjectName</code>
+         * @param name name of the attribute.
+         *
+         * @return value of the attribute.
+         */
+        protected MemoryType getMemoryTypeAttribute(String name) {
+                try {
+                        Object data = mbeanServer.getAttribute(objectName, name);
+                        return (MemoryType) data;
+                } catch (Exception e) {
+                        throw convertException(e);
+                }
+        }
+
+        protected<T> T[] convertArray(Object o, Class<T[]> cl) {
+                if (cl.isInstance(o))
+                        return (T[]) o;
+                else {
+                        CompositeData[] data = (CompositeData[]) o;
+                        Class<?> ccl = cl.getComponentType();
+                        T[] t = (T[]) Array.newInstance(ccl, data.length);
+                        for (int i = 0; i < t.length; ++i)
+                                t[i] = (T) convertObject(data[i], ccl);
+                        return t;
+                }
+        }
+
+        protected<T> T convertObject(Object o, Class<T> cl) {
+                if (cl.isInstance(o))
+                        return (T) o;
+                else {
+                        try {
+                                Method method = cl.getMethod("from", CompositeData.class);
+                                return (T) method.invoke(null, o);
+                        } catch (NoSuchMethodException e) {
+                                throw Monitoring.convertException(e);
+                        } catch (IllegalAccessException e) {
+                                throw Monitoring.convertException(e);
+                        } catch (InvocationTargetException e) {
+                                throw Monitoring.convertException(e);
+                        }
+                }
+        }
+
+        protected void invokeVoidMethod(String name) {
+                invokeMethod(name, new Object[0], null);
+        }
+
+        protected Object invokeMethod(String name, Object[] params, String[] signature) {
+                try {
+                        return mbeanServer.invoke(objectName, name, params, signature);
+                } catch (InstanceNotFoundException e) {
+                        throw Monitoring.convertException(e);
+                } catch (MBeanException e) {
+                        throw Monitoring.convertException(e);
+                } catch (ReflectionException e) {
+                        throw Monitoring.convertException(e);
+                }
+        }
+
+        public ObjectName getObjectName() {
+                return null;
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/server/ServerMemoryMXBean.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share.server;
+
+import java.util.*;
+import nsk.monitoring.share.*;
+import javax.management.*;
+import java.lang.management.*;
+
+/**
+ * MemoryMXBean implementation that delegates functionality to MBeanServer.
+ */
+public class ServerMemoryMXBean extends ServerMXBean implements MemoryMXBean {
+        private static final String GC = "gc";
+        private static final String HEAP_MEMORY_USAGE = "MemoryUsage";
+        private static final String NONHEAP_MEMORY_USAGE = "MemoryUsage";
+        private static final String OBJECT_PENDING_FINALIZATION_COUNT = "ObjectsPendingFinalizationCount";
+        private static final String VERBOSE = "Verbose";
+
+        public ServerMemoryMXBean(MBeanServer mbeanServer) {
+                super(mbeanServer, ManagementFactory.MEMORY_MXBEAN_NAME);
+        }
+
+        public void gc() {
+                invokeVoidMethod(GC);
+        }
+
+        public MemoryUsage getHeapMemoryUsage() {
+                return getMemoryUsageAttribute(HEAP_MEMORY_USAGE);
+        }
+
+        public MemoryUsage getNonHeapMemoryUsage() {
+                return getMemoryUsageAttribute(NONHEAP_MEMORY_USAGE);
+        }
+
+        public int getObjectPendingFinalizationCount() {
+                return getIntAttribute(OBJECT_PENDING_FINALIZATION_COUNT);
+        }
+
+        public boolean isVerbose() {
+                return getBooleanAttribute(VERBOSE);
+        }
+
+        public void setVerbose(boolean verbose) {
+                setBooleanAttribute(VERBOSE, verbose);
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/server/ServerMemoryManagerMXBean.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share.server;
+
+import javax.management.*;
+import java.lang.management.*;
+
+public class ServerMemoryManagerMXBean extends ServerMXBean implements MemoryManagerMXBean {
+        private static final String MEMORY_POOL_NAMES = "MemoryPoolNames";
+        private static final String NAME = "Name";
+        private static final String VALID = "Valid";
+
+        public ServerMemoryManagerMXBean(MBeanServer mbeanServer, String name) {
+                super(mbeanServer, name);
+        }
+
+        public ServerMemoryManagerMXBean(MBeanServer mbeanServer, ObjectName name) {
+                super(mbeanServer, name);
+        }
+
+        public String[] getMemoryPoolNames() {
+                throw new UnsupportedOperationException("TODO");
+        }
+
+        public String getName() {
+                return getStringAttribute(NAME);
+        }
+
+        public boolean isValid() {
+                return getBooleanAttribute(VALID);
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/server/ServerMemoryPoolMXBean.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share.server;
+
+import java.util.*;
+import nsk.monitoring.share.*;
+import javax.management.*;
+import java.lang.management.*;
+
+/**
+ * MemoryPoolMXBean implementation that delegates functionality to MBeanServer.
+ */
+public class ServerMemoryPoolMXBean extends ServerMXBean implements MemoryPoolMXBean {
+        public ServerMemoryPoolMXBean(MBeanServer mbeanServer, String name) {
+                super(mbeanServer, name);
+        }
+
+        public ServerMemoryPoolMXBean(MBeanServer mbeanServer, ObjectName name) {
+                super(mbeanServer, name);
+        }
+
+        public MemoryUsage getCollectionUsage() {
+                return getMemoryUsageAttribute("CollectionUsage");
+        }
+
+        public long getCollectionUsageThreshold() {
+                return getLongAttribute("CollectionUsageThreshold");
+        }
+
+        public long getCollectionUsageThresholdCount() {
+                return getLongAttribute("CollectionUsageThresholdCount");
+        }
+
+        public String[] getMemoryManagerNames() {
+                return getStringArrayAttribute("MemoryManagerNames");
+        }
+
+        public String getName() {
+                return getStringAttribute("Name");
+        }
+
+        public MemoryUsage getPeakUsage() {
+                return getMemoryUsageAttribute("PeakUsage");
+        }
+
+        public MemoryType getType() {
+                return getMemoryTypeAttribute("MemoryType");
+        }
+
+        public MemoryUsage getUsage() {
+                return getMemoryUsageAttribute("Usage");
+        }
+
+        public long getUsageThreshold() {
+                return getLongAttribute("UsageThreshhold");
+        }
+
+        public long getUsageThresholdCount() {
+                return getLongAttribute("UsageThreshholdCount");
+        }
+
+        public boolean isCollectionUsageThresholdExceeded() {
+                return getBooleanAttribute("CollectionUsageThresholdExceeded");
+        }
+
+        public boolean isCollectionUsageThresholdSupported() {
+                return getBooleanAttribute("CollectionUsageThresholdSupported");
+        }
+
+        public boolean isUsageThresholdExceeded() {
+                return getBooleanAttribute("UsageThresholdExceeded");
+        }
+
+        public boolean isUsageThresholdSupported() {
+                return getBooleanAttribute("UsageThresholdSupported");
+        }
+
+        public boolean isValid() {
+                return getBooleanAttribute("Valid");
+        }
+
+        public void resetPeakUsage() {
+                invokeVoidMethod("resetPeakUsage");
+        }
+
+        public void setCollectionUsageThreshold(long threshold) {
+                setLongAttribute("CollectionUsageThreshold", threshold);
+        }
+
+        public void setUsageThreshold(long threshold) {
+                setLongAttribute("UsageThreshold", threshold);
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/server/ServerMonitoringFactory.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share.server;
+
+import javax.management.*;
+import java.lang.management.*;
+import nsk.monitoring.share.*;
+import java.util.*;
+import java.lang.reflect.Method;
+
+public class ServerMonitoringFactory implements MonitoringFactory {
+        private MBeanServer mbeanServer;
+        private List<GarbageCollectorMXBean> garbageCollectorMXBeans;
+        private List<MemoryPoolMXBean> memoryPoolMXBeans;
+        private ThreadMXBean threadMXBean;
+
+        public ServerMonitoringFactory(MBeanServer mbeanServer) {
+                this.mbeanServer = mbeanServer;
+        }
+
+        public ClassLoadingMXBean getClassLoadingMXBean() {
+                return new ServerClassLoadingMXBean(mbeanServer);
+        }
+
+        public boolean hasCompilationMXBean() {
+                try {
+                        return mbeanServer.isRegistered(new ObjectName(ManagementFactory.COMPILATION_MXBEAN_NAME));
+                } catch (MalformedObjectNameException e) {
+                        throw Monitoring.convertException(e);
+                }
+        }
+
+        public CompilationMXBean getCompilationMXBean() {
+                return new ServerCompilationMXBean(mbeanServer);
+        }
+
+        public synchronized List<GarbageCollectorMXBean> getGarbageCollectorMXBeans() {
+                if (garbageCollectorMXBeans == null) {
+                        Collection<ObjectName> coll = Monitoring.queryNamesByStart(mbeanServer, ManagementFactory.GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE + ",");
+                        garbageCollectorMXBeans = new ArrayList<GarbageCollectorMXBean>(coll.size());
+                        int i = 0;
+                        for (ObjectName name : coll)
+                                garbageCollectorMXBeans.add(new ServerGarbageCollectorMXBean(mbeanServer, name));
+                }
+                return garbageCollectorMXBeans;
+        }
+
+        public RuntimeMXBean getRuntimeMXBean() {
+                return new ServerRuntimeMXBean(mbeanServer);
+        }
+
+        public MemoryMXBean getMemoryMXBean() {
+                return new ServerMemoryMXBean(mbeanServer);
+        }
+
+        public NotificationEmitter getMemoryMXBeanNotificationEmitter() {
+                return new ServerNotificationEmitter(mbeanServer, ManagementFactory.MEMORY_MXBEAN_NAME);
+        }
+
+        public List<MemoryPoolMXBean> getMemoryPoolMXBeans() {
+                if (memoryPoolMXBeans == null) {
+                        Collection<ObjectName> coll = Monitoring.queryNamesByStart(mbeanServer, ManagementFactory.MEMORY_POOL_MXBEAN_DOMAIN_TYPE + ",");
+                        memoryPoolMXBeans = new ArrayList<MemoryPoolMXBean>(coll.size());
+                        int i = 0;
+                        for (ObjectName name : coll)
+                                memoryPoolMXBeans.add(new ServerMemoryPoolMXBean(mbeanServer, name));
+                }
+                return memoryPoolMXBeans;
+        }
+
+        public ThreadMXBean getThreadMXBean() {
+                if (threadMXBean == null)
+                        threadMXBean = new ServerThreadMXBean(mbeanServer);
+                return threadMXBean;
+        }
+
+        public boolean hasThreadMXBeanNew() {
+            boolean supported = false;
+            Class cl = ManagementFactory.getThreadMXBean().getClass();
+            Method[] methods = cl.getDeclaredMethods();
+            for (int i = 0; i < methods.length; i++ ) {
+                if (methods[i].getName().equals("isThreadAllocatedMemorySupported")) {
+                    supported = true;
+                    break;
+                }
+            }
+            return supported;
+        }
+
+        public ThreadMXBean getThreadMXBeanNew () {
+            return new ServerThreadMXBeanNew(mbeanServer);
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/server/ServerRuntimeMXBean.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share.server;
+
+import java.util.*;
+import javax.management.MBeanServer;
+import java.lang.management.*;
+
+public class ServerRuntimeMXBean extends ServerMXBean implements RuntimeMXBean {
+        private static final String BOOT_CLASSPATH= "BootClassPath";
+        private static final String CLASSPATH= "ClassPath";
+        private static final String INPUT_ARGUMENTS = "InputArguments";
+        private static final String LIBRARY_PATH = "LibraryPath";
+        private static final String MANAGEMENT_SPEC_VERSION = "ManagementSpecVersion";
+        private static final String NAME = "Name";
+        private static final String SPEC_NAME = "SpecName";
+        private static final String SPEC_VENDOR = "SpecVendor";
+        private static final String SPEC_VERSION = "SpecVersion";
+        private static final String START_TIME = "StartTime";
+        private static final String UPTIME = "Uptime";
+        private static final String VM_NAME = "VmName";
+        private static final String VM_VENDOR = "VmVendor";
+        private static final String VM_VERSION = "VmVersion";
+        private static final String BOOT_CLASSPATH_SUPPORTED = "BootClassPathSupported";
+
+        public ServerRuntimeMXBean(MBeanServer mbeanServer) {
+                super(mbeanServer, ManagementFactory.RUNTIME_MXBEAN_NAME);
+        }
+
+        public String getBootClassPath() {
+                return getStringAttribute(BOOT_CLASSPATH);
+        }
+
+        public String getClassPath() {
+                return getStringAttribute(CLASSPATH);
+        }
+
+        public List<String> getInputArguments() {
+                throw new UnsupportedOperationException("TODO");
+        }
+
+        public String getLibraryPath() {
+                return getStringAttribute(LIBRARY_PATH);
+        }
+
+        public String getManagementSpecVersion() {
+                return getStringAttribute(MANAGEMENT_SPEC_VERSION);
+        }
+
+        public String getName() {
+                return getStringAttribute(NAME);
+        }
+
+        public String getSpecName() {
+                return getStringAttribute(SPEC_NAME);
+        }
+
+        public String getSpecVendor() {
+                return getStringAttribute(SPEC_VENDOR);
+        }
+
+        public String getSpecVersion() {
+                return getStringAttribute(SPEC_VERSION);
+        }
+
+        public long getStartTime() {
+                return getLongAttribute(START_TIME);
+        }
+
+        public Map<String, String> getSystemProperties() {
+                throw new UnsupportedOperationException("TODO");
+        }
+
+        public long getUptime() {
+                return getLongAttribute(UPTIME);
+        }
+
+        public String getVmName() {
+                return getStringAttribute(VM_NAME);
+        }
+
+        public String getVmVendor() {
+                return getStringAttribute(VM_VENDOR);
+        }
+
+        public String getVmVersion() {
+                return getStringAttribute(VM_VERSION);
+        }
+
+        public boolean isBootClassPathSupported() {
+                return getBooleanAttribute(BOOT_CLASSPATH_SUPPORTED);
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/server/ServerThreadMXBean.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share.server;
+
+import java.util.*;
+import nsk.monitoring.share.*;
+import javax.management.*;
+import java.lang.management.*;
+import javax.management.openmbean.*;
+
+/**
+ * ThreadMXBean implementation that delegates functionality to MBeanServer.
+ */
+public class ServerThreadMXBean extends ServerMXBean implements ThreadMXBean {
+        public ServerThreadMXBean(MBeanServer mbeanServer) {
+                super(mbeanServer, ManagementFactory.THREAD_MXBEAN_NAME);
+        }
+
+        public ThreadInfo[] dumpAllThreads(boolean lockedMonitors, boolean lockedSynchronizers) {
+                return getThreadInfoArr(invokeMethod("dumpAllThreads", new Object[] { lockedMonitors, lockedSynchronizers },
+                        new String[] { boolean.class.getName(), boolean.class.getName() }));
+        }
+
+        public ThreadInfo[] dumpAllThreads(boolean lockedMonitors, boolean lockedSynchronizers, int maxDepth) {
+                return getThreadInfoArr(invokeMethod("dumpAllThreads", new Object[] { lockedMonitors, lockedSynchronizers, maxDepth },
+                        new String[] { boolean.class.getName(), boolean.class.getName(), int.class.getName() }));
+        }
+
+        public long[] findDeadlockedThreads() {
+                return (long[]) invokeMethod("findDeadlockedThreads", null, null);
+        }
+
+        public long[] findMonitorDeadlockedThreads() {
+                return (long[]) invokeMethod("findMonitorDeadlockedThreads", null, null);
+        }
+
+        public long[] getAllThreadIds() {
+                return (long[]) invokeMethod("getAllThreadIds", null, null);
+        }
+
+        public long getCurrentThreadCpuTime() {
+                return getLongAttribute("CurrentThreadCpuTime");
+        }
+
+        public long getCurrentThreadUserTime() {
+                return getLongAttribute("CurrentThreadUserTime");
+        }
+
+        public int getDaemonThreadCount() {
+                return getIntAttribute("DaemonThreadCount");
+        }
+
+        public int getPeakThreadCount() {
+                return getIntAttribute("PeakThreadCount");
+        }
+
+        public int getThreadCount() {
+                return getIntAttribute("ThreadCount");
+        }
+
+        public long getThreadCpuTime(long id) {
+                throw new UnsupportedOperationException("This method is not supported");
+        }
+
+        public ThreadInfo getThreadInfo(long id) {
+                return getThreadInfo(invokeMethod("getThreadInfo", new Object[] { id }, new String[] { long.class.getName() }));
+        }
+
+        public ThreadInfo[] getThreadInfo(long[] ids) {
+                return getThreadInfoArr(invokeMethod("getThreadInfo", new Object[] { ids },
+                        new String[] { long[].class.getName() }));
+        }
+
+        public ThreadInfo[] getThreadInfo(long[] ids, boolean lockedMonitors, boolean lockedSynchronizers) {
+                return getThreadInfoArr(invokeMethod("getThreadInfo", new Object[] { ids, lockedMonitors, lockedSynchronizers },
+                        new String[] { long[].class.getName(), boolean.class.getName(), boolean.class.getName() }));
+        }
+
+        public ThreadInfo[] getThreadInfo(long[] ids, boolean lockedMonitors, boolean lockedSynchronizers, int maxDepth) {
+                return getThreadInfoArr(invokeMethod("getThreadInfo", new Object[] { ids, lockedMonitors, lockedSynchronizers, maxDepth },
+                        new String[] { long[].class.getName(), boolean.class.getName(), boolean.class.getName(), int.class.getName() }));
+        }
+
+        public ThreadInfo[] getThreadInfo(long[] ids, int maxDepth) {
+                return getThreadInfoArr(invokeMethod("getThreadInfo", new Object[] { ids, maxDepth }, new String[] { long[].class.getName(), int.class.getName() }));
+        }
+
+        public ThreadInfo getThreadInfo(long id, int maxDepth) {
+                return getThreadInfo(invokeMethod("getThreadInfo", new Object[] { id, maxDepth }, new String[] { long.class.getName(), int.class.getName() }));
+        }
+
+        public long getThreadUserTime(long id) {
+                throw new UnsupportedOperationException("This method is not supported");
+        }
+
+        public long getTotalStartedThreadCount() {
+                return getLongAttribute("TotalStartedThreadCount");
+        }
+
+        public boolean isCurrentThreadCpuTimeSupported() {
+                return getBooleanAttribute("CurrentThreadCpuTimeSupported");
+        }
+
+        public boolean isObjectMonitorUsageSupported() {
+                return getBooleanAttribute("ObjectMonitorUsageSupported");
+        }
+
+        public boolean isSynchronizerUsageSupported() {
+                return getBooleanAttribute("SynchronizerUsageSupported");
+        }
+
+        public boolean isThreadContentionMonitoringEnabled() {
+                return getBooleanAttribute("ThreadContentionMonitoringEnabled");
+        }
+
+        public boolean isThreadContentionMonitoringSupported() {
+                return getBooleanAttribute("ThreadContentionMonitoringSupported");
+        }
+
+        public boolean isThreadCpuTimeEnabled() {
+                return getBooleanAttribute("ThreadCpuTimeEnabled");
+        }
+
+        public boolean isThreadCpuTimeSupported() {
+                return getBooleanAttribute("ThreadCpuTimeSupported");
+        }
+
+        public void resetPeakThreadCount() {
+                invokeVoidMethod("resetPeakThreadCount");
+        }
+
+        public void setThreadContentionMonitoringEnabled(boolean enable) {
+                setBooleanAttribute("ThreadContentionMonitorinEnabled", enable);
+        }
+
+        public void setThreadCpuTimeEnabled(boolean enable) {
+                setBooleanAttribute("ThreadCpuTimeEnabled", enable);
+        }
+
+        protected ThreadInfo getThreadInfo(Object o) {
+                return convertObject(o, ThreadInfo.class);
+        }
+
+        protected ThreadInfo[] getThreadInfoArr(Object o) {
+                return convertArray(o, ThreadInfo[].class);
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/server/ServerThreadMXBeanNew.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2011, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share.server;
+
+import javax.management.*;
+import com.sun.management.*;
+
+/**
+ * com.sun.management.ThreadMXBean implementation that delegates functionality to MBeanServer.
+ */
+public class ServerThreadMXBeanNew extends ServerThreadMXBean implements ThreadMXBean{
+
+    public ServerThreadMXBeanNew(MBeanServer mbeanServer) {
+        super(mbeanServer);
+    }
+
+    public long[] getThreadUserTime(long[] ids) {
+        return (long[]) invokeMethod("getThreadUserTime",
+                new Object[] { ids },
+                new String[] { long[].class.getName() });
+    }
+
+    public long[] getThreadCpuTime(long[] ids) {
+        return (long[]) invokeMethod("getThreadCpuTime",
+                new Object[] { ids },
+                new String[] { long[].class.getName() });
+    }
+
+    public long[] getThreadAllocatedBytes(long[] ids) {
+        return (long[]) invokeMethod("getThreadAllocatedBytes",
+                new Object[] { ids },
+                new String[] { long[].class.getName() });
+    }
+
+    public long getThreadAllocatedBytes(long id) {
+        return (Long) invokeMethod("getThreadAllocatedBytes",
+            new Object[] { id },
+            new String[] { long.class.getName() });
+    }
+
+    public void setThreadAllocatedMemoryEnabled(boolean enabled) {
+        setBooleanAttribute("ThreadAllocatedMemoryEnabled", enabled);
+    }
+
+    public boolean isThreadAllocatedMemorySupported() {
+        return getBooleanAttribute("ThreadAllocatedMemorySupported");
+    }
+
+    public boolean isThreadAllocatedMemoryEnabled() {
+        return getBooleanAttribute("ThreadAllocatedMemoryEnabled");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/BlockedThread.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package nsk.monitoring.share.thread;
+
+import nsk.share.log.Log;
+import java.lang.management.ThreadInfo;
+import java.lang.management.MonitorInfo;
+import java.lang.management.LockInfo;
+import nsk.share.TestBug;
+import nsk.share.test.LocalRandom;
+import nsk.monitoring.share.Monitoring;
+
+/**
+ * BlockedThread is RecursiveMonitoringThread that blocks on entering
+ * synchronized section.
+ */
+public class BlockedThread extends RecursiveMonitoringThread {
+        private LockerThread lockerThread;
+        protected Object lock;
+        protected Object readyLock = new Object();
+        protected volatile boolean ready = false;
+        private static final String[] expectedMethods = {
+                "nsk.monitoring.share.thread.BlockedThread.runInside"
+        };
+
+        public BlockedThread(Log log, RunType recursionType, int maxDepth, LockerThread lockerThread) {
+                super(log, recursionType, maxDepth);
+                this.lockerThread = lockerThread;
+                this.lock = lockerThread.getLock();
+        }
+
+        public void checkThreadInfo(ThreadInfo info) {
+                super.checkThreadInfo(info);
+                verify(info.getThreadState() == Thread.State.BLOCKED, "ThreadInfo.getThreadState() = " + info.getThreadState() + " != " + Thread.State.BLOCKED);
+                verify(info.getBlockedTime() == 0 || info.getBlockedTime() == -1, "ThreadInfo.getBlockedTime() == " + info.getBlockedTime());
+                verify(info.getBlockedCount() >= 1, "ThreadInfo.getBlockedCount() = " + info.getBlockedCount() + " != " + 1);
+                verify(info.getWaitedTime() == 0 || info.getWaitedTime() == -1, "ThreadInfo.getWaitedTime() == " + info.getWaitedTime());
+                verify(info.getWaitedCount() == 0, "ThreadInfo.getWaitedCount() = " + info.getWaitedCount() + " != " + 0);
+                checkLockInfo(info.getLockInfo(), lock);
+                verify(info.getLockName().equals(info.getLockInfo().toString()), "ThreadInfo.getLockName() = " + info.getLockName() + " != lock.toString() = " + lock.toString());
+                verify(info.getLockOwnerId() == lockerThread.getId(), "ThreadInfo.getLockOwnerId() = " + info.getLockOwnerId() + " != this.getId() = " + this.getId());
+                verify(info.getLockOwnerName().equals(lockerThread.getName()), "ThreadInfo.getLockOwnerName() = " + info.getLockOwnerName() + " != lockerThread.getName() = " + lockerThread.getName());
+                checkMonitorInfo(info.getLockedMonitors(), null);
+                checkSynchronizers(info.getLockedSynchronizers(), null);
+        }
+
+        private void checkStackTrace(MonitorInfo[] minfo, StackTraceElement[] elements) {
+                verify(minfo.length == 1, "ThreadInfo.getLockedMonitors() is of length " + minfo.length);
+                MonitorInfo minfo1 = minfo[0];
+                verify(minfo1.getLockedStackDepth() == elements.length, "MonitorInfo.getLockedStackDepth() = " + minfo1.getLockedStackDepth() + " != elements.length = " + elements.length);
+                verify(minfo1.getLockedStackFrame().equals(elements[elements.length - 1]), "MonitorInfo.getLockedStackFrame() = " + minfo1.getLockedStackFrame() + " is different from last element " + elements[elements.length - 1]);
+                checkLockInfo(minfo1, lock);
+        }
+
+        public void waitState() {
+                synchronized (readyLock) {
+                        while (!ready) {
+                                try {
+                                        readyLock.wait();
+                                } catch (InterruptedException e) {
+                                        log.warn(e);
+                                }
+                        }
+                }
+                waitThreadState(Thread.State.BLOCKED);
+        }
+
+        public void finish() {
+                ready = false;
+                synchronized (lock) {
+                        lock.notify();
+                }
+        }
+
+        protected void runInside() {
+                synchronized (readyLock) {
+                        ready = true;
+                        readyLock.notifyAll();
+                }
+                do {
+                        synchronized (lock) {
+                                System.out.println("BlockedThread acquired lock");
+
+                                // Actually, this thread will reach here after LockerThread.finish() is called,
+                                // but before finish() is called. But it does not matter, because check(ThreadInfo)
+                                // was already called.
+                        }
+
+                        System.out.println("BlockedThread relinquished lock");
+
+                } while (ready);
+        }
+
+        protected boolean isStackTraceElementExpected(StackTraceElement element) {
+                return super.isStackTraceElementExpected(element) || checkStackTraceElement(element, expectedMethods);
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/Deadlock.c	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+#include <jni.h>
+#include "jni_tools.h"
+
+#define FIND_CLASS(_class, _className)\
+        if (!NSK_JNI_VERIFY(env, (_class = \
+             NSK_CPP_STUB2(FindClass, env, _className)) != NULL))\
+                return
+
+#define GET_OBJECT_CLASS(_class, _obj)\
+        if (!NSK_JNI_VERIFY(env, (_class = \
+             NSK_CPP_STUB2(GetObjectClass, env, _obj)) != NULL))\
+                return
+
+#define GET_OBJ_FIELD(_value, _obj, _class, _fieldName, _fieldSig)\
+        GET_FIELD_ID(field, _class, _fieldName, _fieldSig);\
+        _value = NSK_CPP_STUB3(GetObjectField, env, _obj, field)
+
+#define GET_FIELD_ID(_fieldID, _class, _fieldName, _fieldSig)\
+        if (!NSK_JNI_VERIFY(env, (_fieldID = \
+             NSK_CPP_STUB4(GetFieldID, env, _class,\
+             _fieldName, _fieldSig)) != NULL))\
+                return
+
+#define GET_METHOD_ID(_methodID, _class, _methodName, _sig)\
+        if (!NSK_JNI_VERIFY(env, (_methodID = \
+             NSK_CPP_STUB4(GetMethodID, env, _class,\
+             _methodName, _sig)) != NULL)) \
+                return
+
+#define CALL_VOID_NOPARAM(_obj, _class, _methodName)\
+            GET_METHOD_ID(method, _class, _methodName, "()V");\
+        if (!NSK_JNI_VERIFY_VOID(env, NSK_CPP_STUB3(CallVoidMethod, env, _obj,\
+             method))) \
+                return
+
+/*
+ * Class:     nsk_monitoring_share_thread_MonitorDeadlock_DeadlockThread
+ * Method:    nativeLock2
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_nsk_monitoring_share_thread_Deadlock_00024NativeLocker_lock
+(JNIEnv *env, jobject this) {
+        jclass testBugClass, nativeLockerClass, lockerClass, wicketClass;
+        jobject lock, inner, step1, step2, step3;
+        jfieldID field;
+        jmethodID method;
+
+        GET_OBJECT_CLASS(nativeLockerClass, this);
+        FIND_CLASS(lockerClass, "nsk/monitoring/share/thread/Deadlock$Locker");
+        FIND_CLASS(wicketClass, "nsk/share/Wicket");
+        FIND_CLASS(testBugClass, "nsk/share/TestBug");
+        GET_OBJ_FIELD(lock, this, nativeLockerClass, "lock", "Ljava/lang/Object;");
+        GET_OBJ_FIELD(step1, this, nativeLockerClass, "step1", "Lnsk/share/Wicket;");
+        if (step1 == NULL) {
+                (*env)->ThrowNew(env, testBugClass, "step1 field is null");
+                return;
+        }
+        GET_OBJ_FIELD(step2, this, nativeLockerClass, "step2", "Lnsk/share/Wicket;");
+        if (step2 == NULL) {
+                (*env)->ThrowNew(env, testBugClass, "step2 field is null");
+                return;
+        }
+        GET_OBJ_FIELD(step3, this, nativeLockerClass, "step3", "Lnsk/share/Wicket;");
+        if (step3 == NULL) {
+                (*env)->ThrowNew(env, testBugClass, "step3 field is null");
+                return;
+        }
+        GET_OBJ_FIELD(inner, this, lockerClass, "inner", "Lnsk/monitoring/share/thread/Deadlock$Locker;");
+        if ((*env)->MonitorEnter(env, lock) == JNI_OK) {
+                if (inner == NULL) {
+                        (*env)->ThrowNew(env, testBugClass, "Should not reach here");
+                } else {
+                        CALL_VOID_NOPARAM(step1, wicketClass, "unlock");
+                        CALL_VOID_NOPARAM(step2, wicketClass, "waitFor");
+                        CALL_VOID_NOPARAM(step3, wicketClass, "unlock");
+                        CALL_VOID_NOPARAM(inner, lockerClass, "lock");
+                }
+                (*env)->MonitorExit(env, lock);
+        } else {
+                (*env)->ThrowNew(env, testBugClass, "MonitorEnter(lock) call failed");
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/Deadlock.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,595 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share.thread;
+
+import java.lang.management.*;
+import nsk.share.log.*;
+import nsk.share.TestBug;
+import nsk.share.TestFailure;
+import nsk.share.Wicket;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.concurrent.locks.ReentrantLock;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Scenario that starts threads that use different scenarios to deadlock.
+ * Several types of deadlocks are implemented:
+ * Deadlock.Type.JAVA - several threads use synchronized blocks on java objects
+ * Deadlock.Type.NATIVE - several threads use JNI MonitorEnter on java objects
+ * Deadlock.Type.SYNCHRONIZED_METHOD - several threads use synchronized method
+ * Deadlock.Type.SYNCHRONIZER - several threads use java.util.concurrent.locks locks
+ * Deadlock.Type.MIXED - a mix of all above, each thread uses different combination
+ * of lock types
+ *
+ * Note: this scenario is not reusable in sense that it cannot be run and successfully
+ * checked several times, because there is no way to finish deadlocked threads.
+ */
+public class Deadlock extends ThreadMonitoringScenarioBase {
+        public static enum Type {
+                JAVA,
+                NATIVE,
+                SYNCHRONIZED_METHOD,
+                SYNCHRONIZER,
+                MIXED
+        };
+
+        private static final String[] expectedMethods = {
+                "nsk.monitoring.share.thread.Deadlock$DeadlockThread.runInside",
+                "nsk.monitoring.share.thread.Deadlock$DeadlockThread.javaLock",
+                "nsk.monitoring.share.thread.Deadlock$DeadlockThread.nativeLock",
+                "nsk.monitoring.share.thread.Deadlock$DeadlockThread.mixedLock",
+                "nsk.monitoring.share.thread.Deadlock$DeadlockThread.nativeLock2"
+        };
+        private Type deadlockType;
+        private RunType recursionType;
+        private int maxDepth;
+        private Wicket step1;
+        private Wicket step2;
+        private Wicket step3;
+        private Object[] locks;
+        private Locker[] lockers;
+        private DeadlockThread[] threads;
+        private long[] threadIds;
+        private ThreadInfo[] threadInfo;
+        private Deadlocker deadlocker;
+
+        static {
+                System.loadLibrary("Deadlock");
+        }
+
+        public Deadlock(Log log, RunType recursionType, int maxDepth, Type deadlockType) {
+                this(log, recursionType, maxDepth, deadlockType, 3);
+        }
+
+        public Deadlock(Log log, RunType recursionType, int maxDepth, Type deadlockType, int threadCount) {
+                super(log);
+                this.recursionType = recursionType;
+                this.maxDepth = maxDepth;
+                threads = new DeadlockThread[threadCount];
+                lockers = new Locker[threadCount];
+                locks = new Object[threadCount];
+                this.deadlockType = deadlockType;
+        }
+
+        public abstract class Locker {
+                protected Locker inner;
+
+                public Locker(Locker inner) {
+                        this.inner = inner;
+                }
+
+                public abstract String getTypeName();
+                public abstract void lock();
+                public abstract void check(ThreadInfo info);
+                public abstract Thread.State getExpectedThreadState();
+        }
+
+        private class JavaLocker extends Locker {
+                private Object lock;
+                private Map<String, Object[]> lockMap = new HashMap<String, Object[]>();
+
+                public JavaLocker(Object lock, Locker inner) {
+                        super(inner);
+                        this.lock = lock;
+                        lockMap.put("lock", new Object[] { lock });
+                }
+
+                public String getTypeName() {
+                        return "synchronized block";
+                }
+
+                public void lock() {
+                        synchronized (lock) {
+                                if (inner != null) {
+                                        step1.unlock();
+                                        step2.waitFor();
+                                        step3.unlock();
+                                        inner.lock();
+                                } else
+                                        throw new TestBug("Should not reach here");
+                        }
+                }
+
+                public void check(ThreadInfo info) {
+                        if (inner == null) {
+                                verify(info.getThreadState() == Thread.State.BLOCKED, "ThreadInfo.getThreadState() = " + info.getThreadState() + " != " + Thread.State.BLOCKED);
+                                checkLockInfo(info.getLockInfo(), lock);
+                                verify(info.getLockName().equals(info.getLockInfo().toString()), "ThreadInfo.getLockName() = " + info.getLockName() + " != info.getLockInfo().toString() = " + info.getLockInfo().toString());
+                        } else {
+                                verify(info.getBlockedCount() >= 0, "ThreadInfo.getBlockedCount() = " + info.getBlockedCount() + " < " + 0);
+                                verify(info.getWaitedCount() >= 0, "ThreadInfo.getWaitedCount() = " + info.getWaitedCount() + " < " + 0);
+                                checkMonitorInfo(info.getLockedMonitors(), lockMap);
+                                checkSynchronizers(info.getLockedSynchronizers(), null);
+                                inner.check(info);
+                        }
+                }
+
+                public Thread.State getExpectedThreadState() {
+                        if (inner != null)
+                                return inner.getExpectedThreadState();
+                        else
+                                return Thread.State.BLOCKED;
+                }
+        }
+
+        private class NativeLocker extends Locker {
+                private Object lock;
+                private Wicket step1;
+                private Wicket step2;
+                private Wicket step3;
+                private Map<String, Object[]> lockMap = new HashMap<String, Object[]>();
+
+                public NativeLocker(Object lock, Locker inner) {
+                        super(inner);
+                        this.lock = lock;
+                        this.step1 = Deadlock.this.step1;
+                        this.step2 = Deadlock.this.step2;
+                        this.step3 = Deadlock.this.step3;
+                        lockMap.put("lock", new Object[] { lock });
+                }
+
+                public String getTypeName() {
+                        return "JNI MonitorEnter";
+                }
+
+                public native void lock();
+
+                public void check(ThreadInfo info) {
+                        if (inner != null) {
+                                verify(info.getLockName().equals(info.getLockInfo().toString()), "ThreadInfo.getLockName() = " + info.getLockName() + " != info.getLockInfo().toString() = " + info.getLockInfo().toString());
+                                checkMonitorInfo(info.getLockedMonitors(), lockMap);
+                                checkSynchronizers(info.getLockedSynchronizers(), null);
+                                inner.check(info);
+                        } else {
+                                verify(info.getThreadState() == Thread.State.BLOCKED, "ThreadInfo.getThreadState() = " + info.getThreadState() + " != " + Thread.State.BLOCKED);
+                                verify(info.getBlockedCount() >= 0, "ThreadInfo.getBlockedCount() = " + info.getBlockedCount() + " < " + 0);
+                                verify(info.getWaitedCount() >= 0, "ThreadInfo.getWaitedCount() = " + info.getWaitedCount() + " < " + 0);
+                                checkLockInfo(info.getLockInfo(), lock);
+                        }
+                }
+
+                public Thread.State getExpectedThreadState() {
+                        if (inner != null)
+                                return inner.getExpectedThreadState();
+                        else
+                                return Thread.State.BLOCKED;
+                }
+        }
+
+        private class SynchronizedMethod {
+                public synchronized void synchronizedMethod(Locker inner) {
+                        if (inner != null) {
+                                step1.unlock();
+                                step2.waitFor();
+                                step3.unlock();
+                                inner.lock();
+                        } else
+                                throw new TestBug("Should not reach here");
+                }
+        }
+
+        private class SynchronizedMethodLocker extends Locker {
+                private SynchronizedMethod lock;
+                private Map<String, Object[]> lockMap = new HashMap<String, Object[]>();
+
+                public SynchronizedMethodLocker(SynchronizedMethod lock, Locker inner) {
+                        super(inner);
+                        this.lock = lock;
+                        lockMap.put("synchronizedMethod", new Object[] { lock });
+                }
+
+                public String getTypeName() {
+                        return "SynchronizedMethod";
+                }
+
+                public void lock() {
+                        lock.synchronizedMethod(inner);
+                }
+
+                public void check(ThreadInfo info) {
+                        if (inner != null) {
+                                checkMonitorInfo(info.getLockedMonitors(), lockMap);
+                                checkSynchronizers(info.getLockedSynchronizers(), null);
+                                inner.check(info);
+                        } else {
+                                verify(info.getThreadState() == Thread.State.BLOCKED, "ThreadInfo.getThreadState() = " + info.getThreadState() + " != " + Thread.State.BLOCKED);
+                                verify(info.getBlockedCount() >= 0, "ThreadInfo.getBlockedCount() = " + info.getBlockedCount() + " < " + 0);
+                                verify(info.getWaitedCount() >= 0, "ThreadInfo.getWaitedCount() = " + info.getWaitedCount() + " < " + 0);
+                                checkLockInfo(info.getLockInfo(), lock);
+                                verify(info.getLockName().equals(info.getLockInfo().toString()), "ThreadInfo.getLockName() = " + info.getLockName() + " != info.getLockInfo().toString() = " + info.getLockInfo().toString());
+                        }
+                }
+
+                public Thread.State getExpectedThreadState() {
+                        if (inner != null)
+                                return inner.getExpectedThreadState();
+                        else
+                                return Thread.State.BLOCKED;
+                }
+        }
+
+        private class SynchronizerLocker extends Locker {
+                private Lock lock;
+                private Map<String, Lock[]> lockMap = new HashMap<String, Lock[]>();
+
+                public SynchronizerLocker(Lock lock, Locker inner) {
+                        super(inner);
+                        this.lock = lock;
+                        lockMap.put("lock", new Lock[] { lock });
+                }
+
+                public String getTypeName() {
+                        return "java.util.concurrent.locks synchronizer";
+                }
+
+                public void lock() {
+                        try {
+                                lock.tryLock(10000000, TimeUnit.SECONDS);
+                        } catch (InterruptedException e) {
+                                log.warn(e);
+                        }
+                        try {
+                                if (inner != null) {
+                                        step1.unlock();
+                                        step2.waitFor();
+                                        step3.unlock();
+                                        inner.lock();
+                                } else
+                                        throw new TestBug("Should not reach here");
+                        } finally {
+                                lock.unlock();
+                        }
+                }
+
+                public void check(ThreadInfo info) {
+                        if (inner != null) {
+                                checkMonitorInfo(info.getLockedMonitors(), null);
+                                checkSynchronizers(info.getLockedSynchronizers(), lockMap);
+                                inner.check(info);
+                        } else {
+                                verify(info.getThreadState() == Thread.State.TIMED_WAITING, "ThreadInfo.getThreadState() = " + info.getThreadState() + " != " + Thread.State.TIMED_WAITING);
+                                //checkLockInfo(info.getLockInfo(), lock2); // Do not check this because actual lock is instance of inner class of ReentrantLock
+                                verify(info.getLockName().equals(info.getLockInfo().toString()), "ThreadInfo.getLockName() = " + info.getLockName() + " != info.getLockInfo().toString() = " + info.getLockInfo().toString());
+                        }
+                }
+
+                public Thread.State getExpectedThreadState() {
+                        if (inner != null)
+                                return inner.getExpectedThreadState();
+                        else
+                                return Thread.State.TIMED_WAITING;
+                }
+        }
+
+
+        private class DeadlockThread extends RecursiveMonitoringThread {
+                private boolean ready = false;
+                private Object readyLock = new Object();
+                private Locker locker;
+
+                public DeadlockThread(Locker locker) {
+                        super(Deadlock.this.log, Deadlock.this.recursionType, Deadlock.this.maxDepth);
+                        this.locker = locker;
+                }
+
+                public void runInside() {
+                        synchronized (readyLock) {
+                                ready = true;
+                                readyLock.notifyAll();
+                        }
+                        locker.lock();
+                }
+
+                public void waitState() {
+                        synchronized (readyLock) {
+                                while (!ready) {
+                                        try {
+                                                readyLock.wait();
+                                        } catch (InterruptedException e) {
+                                                log.warn(e);
+                                        }
+                                }
+                        }
+                        waitThreadState(locker.getExpectedThreadState());
+                }
+
+                public void checkThreadInfo(ThreadInfo info) {
+                        super.checkThreadInfo(info);
+                        locker.check(info);
+                }
+
+                public void finish() {
+                        throw new UnsupportedOperationException("Can't finish deadlocked thread");
+                }
+
+                public void end() {
+                        throw new UnsupportedOperationException("Can't end deadlocked thread");
+                }
+
+                protected boolean isStackTraceElementExpected(StackTraceElement element) {
+                        return super.isStackTraceElementExpected(element) ||
+                               element.getClassName().startsWith("nsk.monitoring.share.thread.Deadlock") ||
+                               element.getClassName().startsWith("java.util.concurrent.locks.") ||
+                               element.getClassName().startsWith("jdk.internal.misc.");
+                }
+        }
+
+        private interface Deadlocker {
+                public void createLockers();
+                public void check(ThreadMXBean threadMXBean);
+        }
+
+        private class JavaDeadlocker implements Deadlocker {
+                public void createLockers() {
+                        for (int i = 0; i < locks.length; ++i)
+                                locks[i] = new String(this + "lock " + i);
+                        for (int i = 0; i < locks.length; ++i)
+                                lockers[i] = new JavaLocker(locks[i], new JavaLocker(locks[(i + 1) % locks.length], null));
+                }
+
+                public void check(ThreadMXBean threadMXBean) {
+                        checkDeadlocks(threadMXBean, threadMXBean.findMonitorDeadlockedThreads());
+                        checkDeadlocks(threadMXBean, threadMXBean.findDeadlockedThreads());
+                        for (DeadlockThread thread : threads)
+                                thread.check(threadMXBean);
+                }
+        }
+
+        private class SynchronizedMethodDeadlocker implements Deadlocker {
+                public void createLockers() {
+                        for (int i = 0; i < locks.length; ++i)
+                                locks[i] = new SynchronizedMethod();
+                        for (int i = 0; i < locks.length; ++i)
+                                lockers[i] = new SynchronizedMethodLocker((SynchronizedMethod) locks[i], new SynchronizedMethodLocker((SynchronizedMethod) locks[(i + 1) % locks.length], null));
+                }
+
+                public void check(ThreadMXBean threadMXBean) {
+                        checkDeadlocks(threadMXBean, threadMXBean.findMonitorDeadlockedThreads());
+                        checkDeadlocks(threadMXBean, threadMXBean.findDeadlockedThreads());
+                        for (DeadlockThread thread : threads)
+                                thread.check(threadMXBean);
+                }
+        }
+
+
+        private class NativeDeadlocker implements Deadlocker {
+                public void createLockers() {
+                        for (int i = 0; i < locks.length; ++i)
+                                locks[i] = new String(this + "lock " + i);
+                        for (int i = 0; i < locks.length; ++i)
+                                lockers[i] = new NativeLocker(locks[i], new NativeLocker(locks[(i + 1) % locks.length], null));
+                }
+
+                public void check(ThreadMXBean threadMXBean) {
+                        checkDeadlocks(threadMXBean, threadMXBean.findMonitorDeadlockedThreads());
+                        checkDeadlocks(threadMXBean, threadMXBean.findDeadlockedThreads());
+                        for (DeadlockThread thread : threads)
+                                thread.check(threadMXBean);
+                }
+        }
+
+        private class SynchronizerDeadlocker implements Deadlocker {
+                public void createLockers() {
+                        for (int i = 0; i < locks.length; ++i)
+                                locks[i] = new ReentrantLock();
+                        for (int i = 0; i < locks.length; ++i)
+                                lockers[i] = new SynchronizerLocker((Lock) locks[i], new SynchronizerLocker((Lock) locks[(i + 1) % locks.length], null));
+                }
+
+                public void check(ThreadMXBean threadMXBean) {
+                        checkDeadlocks(threadMXBean, threadMXBean.findDeadlockedThreads());
+                        for (DeadlockThread thread : threads)
+                                thread.check(threadMXBean);
+                }
+        }
+
+        private class MixedDeadlocker implements Deadlocker {
+                private int getCount() {
+                        return 4;
+                }
+
+                private Object createLock(int type, int i) {
+                        switch (type) {
+                        case 0:
+                                return new String("lock " + i);
+                        case 1:
+                                return new String("lock " + i);
+                        case 2:
+                                return new SynchronizedMethod();
+                        case 3:
+                                return new ReentrantLock();
+                        default:
+                                throw new TestBug("Should not reach here");
+                        }
+                }
+
+                private Locker createLocker(int type, Object lock, Locker inner) {
+                        switch (type) {
+                        case 0:
+                                return new JavaLocker(lock, inner);
+                        case 1:
+                                return new NativeLocker(lock, inner);
+                        case 2:
+                                return new SynchronizedMethodLocker((SynchronizedMethod) lock, inner);
+                        case 3:
+                                return new SynchronizerLocker((Lock) lock, inner);
+                        default:
+                                throw new TestBug("Should not reach here");
+                        }
+                }
+
+                public void createLockers() {
+                        int n = getCount();
+                        int threadCount = lockers.length;
+                        if (threadCount != n * n)
+                                throw new TestBug("Thread count is expected to be " + n * n + ", actual: " + threadCount);
+                        int[] types = new int[n];
+                        for (int i = 0; i < n; ++i)
+                                types[i] = i;
+                        int type = 0;
+                        locks[0] = createLock(0, 0);
+                        log.info("Creating lockers");
+                        /*
+                         * This will ensure that we will have each combination
+                         * of lock type and inner lock type in some thread. Together
+                         * all these threads deadlock.
+                         */
+                        for (int i = 0; i < threadCount; ++i) {
+                                int newtype = types[type];
+                                if (i < threadCount - 1)
+                                        locks[i + 1] = createLock(newtype, i);
+                                Locker inner = createLocker(newtype, locks[(i + 1) % threadCount], null);
+                                lockers[i] = createLocker(type, locks[i], inner);
+                                log.info("Locker " + i + " will lock " + locks[i] + " (" + lockers[i].getTypeName() + ") and will wait for " + locks[(i + 1) % threadCount] + " (" + inner.getTypeName() + ")");
+                                types[type] = (types[type] + 1) % n;
+                                type = newtype;
+                        }
+                }
+
+                public void check(ThreadMXBean threadMXBean) {
+                        checkDeadlocks(threadMXBean, threadMXBean.findDeadlockedThreads());
+                        for (DeadlockThread thread : threads)
+                                thread.check(threadMXBean);
+                }
+        }
+
+
+        protected Deadlocker createDeadlocker() {
+                switch (deadlockType) {
+                case JAVA:
+                        return new JavaDeadlocker();
+                case NATIVE:
+                        return new NativeDeadlocker();
+                case SYNCHRONIZED_METHOD:
+                        return new SynchronizedMethodDeadlocker();
+                case SYNCHRONIZER:
+                        return new SynchronizerDeadlocker();
+                case MIXED:
+                        return new MixedDeadlocker();
+                default:
+                        throw new TestBug("Unknown deadlockType: " + deadlockType);
+                }
+        }
+
+        public void begin() {
+                deadlocker = createDeadlocker();
+                step1 = new Wicket(lockers.length);
+                step2 = new Wicket();
+                step3 = new Wicket(lockers.length);
+                deadlocker.createLockers();
+                threads = new DeadlockThread[lockers.length];
+                for (int i = 0; i < threads.length; ++i)
+                        threads[i] = new DeadlockThread(lockers[i]);
+                for (DeadlockThread thread : threads)
+                        thread.begin();
+        }
+
+        public void waitState() {
+                step1.waitFor();
+                while (step2.getWaiters() != threads.length)
+                        Thread.yield();
+                step2.unlock();
+                step3.waitFor();
+                for (DeadlockThread thread : threads)
+                        thread.waitState();
+        }
+
+        private void obtainThreadDump(ThreadMXBean threadMXBean) {
+                threadIds = new long[threads.length];
+                for (int i = 0; i < threads.length; ++i)
+                        threadIds[i] = threads[i].getId();
+                threadInfo = threadMXBean.getThreadInfo(threadIds, true, true);
+        }
+
+        private void checkDeadlocks(ThreadMXBean threadMXBean, long[] ids) {
+                try {
+                        ThreadUtils.verify(ids != null, "Deadlocked thread ids array is null");
+                        ThreadUtils.verify(ids.length == threads.length, "Wrong length of ThreadMXBean.findMonitorDeadlockedThreads(): " + ids.length + " expected: " + threads.length);
+                        for (long id : ids) {
+                                boolean found = false;
+                                for (MonitoringThread thread : threads)
+                                        if (thread.getId() == id)
+                                                found = true;
+                                ThreadUtils.verify(found, "Unexpected thread id found in ThreadMXBean.findMonitorDeadlockedThreads(): " + id);
+                        }
+                        for (DeadlockThread thread : threads) {
+                                boolean found = false;
+                                for (long id : ids)
+                                        if (thread.getId() == id)
+                                                found = true;
+                                ThreadUtils.verify(found, "Expected thread id not found in ThreadMXBean.findMonitorDeadlockedThreads(): " + thread.getId());
+                        }
+                        log.info("Expected deadlock thread ids found: " + ThreadUtils.strIds(ids));
+                } catch (TestFailure t) {
+                        log.info("Thread dump for verified threads (before the check):");
+                        ThreadUtils.threadDump(log, threadInfo);
+                        log.info("Expected thread ids (total " + threads.length + "): " + ThreadUtils.strIds(threadIds));
+                        if (ids == null)
+                                log.info("Obtained ids array is null");
+                        else {
+                                log.info("Obtained thread ids (total " + ids.length + "): " + ThreadUtils.strIds(ids));
+                                log.info("Thread dump for obtained threads:");
+                                ThreadUtils.threadDump(log, threadMXBean.getThreadInfo(ids));
+                        }
+                        throw t;
+                }
+
+        }
+
+        public void check(ThreadMXBean threadMXBean) {
+                obtainThreadDump(threadMXBean);
+                deadlocker.check(threadMXBean);
+        }
+
+        public void finish() {
+                // Unfortunately, in deadlock situation we cannot terminate started threads
+        }
+
+        public void end() {
+                // Unfortunately, in deadlock situation the threads will not ever end
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/FinishedThread.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package nsk.monitoring.share.thread;
+
+import nsk.share.log.Log;
+import java.lang.management.ThreadInfo;
+import nsk.share.TestFailure;
+import nsk.share.TestBug;
+
+/**
+ * Finished Thread is dummy RecursiveMonitoringThread that is getting
+ * started and finished.
+ */
+public class FinishedThread extends RecursiveMonitoringThread {
+        public FinishedThread(Log log, RunType recursionType, int maxDepth) {
+                super(log, recursionType, maxDepth);
+        }
+
+        public void waitState() {
+                try {
+                        if (runner != null)
+                                runner.join();
+                } catch (InterruptedException e) {
+                        log.warn(e);
+                }
+        }
+
+        public void finish() {
+        }
+
+        protected void runInside() {
+        }
+
+        public void checkThreadInfo(ThreadInfo info) {
+                verify(info == null, "ThreadInfo != null");
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/LockerThread.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share.thread;
+
+/**
+ * Locker thread is used to lock monitor on which BlockedThread's
+ * waits.
+ */
+public class LockerThread extends Thread {
+        private String lock = new String("a lock");
+        private Object ready = new Object();
+        private Object lockit = new Object();
+        private volatile boolean locked = false;
+
+        public Object getLock() {
+                return lock;
+        }
+
+        public boolean isLocked() {
+                return locked;
+        }
+
+        public void waitState() {
+                synchronized (ready) {
+                        while (!locked) {
+                                try {
+                                        ready.wait();
+                                } catch (InterruptedException e) {
+                                }
+                        }
+                }
+
+                ThreadUtils.waitThreadState(this, Thread.State.WAITING);
+
+                System.out.println("Locker thread reached WAITING state");
+        }
+
+        public void finish() {
+                locked = false;
+                synchronized (lockit) {
+                        lockit.notifyAll();
+                }
+        }
+
+        public void run() {
+                synchronized (lock) {
+                        synchronized (lockit) {
+                                synchronized (ready) {
+                                        locked = true;
+                                        ready.notifyAll();
+                                }
+                                while (locked) {
+                                        try {
+                                                lockit.wait();
+                                        } catch (InterruptedException e) {
+                                        }
+                                }
+                        }
+                }
+
+                System.out.println("Locker thread leaved WAITING state");
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/LockingThreads.c	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+#include <jni.h>
+#include "jni_tools.h"
+
+#define FIND_CLASS(_class, _className)\
+        if (!NSK_JNI_VERIFY(env, (_class = \
+             NSK_CPP_STUB2(FindClass, env, _className)) != NULL))\
+                return
+
+#define GET_OBJECT_CLASS(_class, _obj)\
+        if (!NSK_JNI_VERIFY(env, (_class = \
+             NSK_CPP_STUB2(GetObjectClass, env, _obj)) != NULL))\
+                return
+
+#define GET_OBJ_FIELD(_value, _obj, _class, _fieldName, _fieldSig)\
+        GET_FIELD_ID(field, _class, _fieldName, _fieldSig);\
+        _value = NSK_CPP_STUB3(GetObjectField, env, _obj, field)
+
+#define GET_FIELD_ID(_fieldID, _class, _fieldName, _fieldSig)\
+        if (!NSK_JNI_VERIFY(env, (_fieldID = \
+             NSK_CPP_STUB4(GetFieldID, env, _class,\
+             _fieldName, _fieldSig)) != NULL))\
+                return
+
+#define GET_METHOD_ID(_methodID, _class, _methodName, _sig)\
+        if (!NSK_JNI_VERIFY(env, (_methodID = \
+             NSK_CPP_STUB4(GetMethodID, env, _class,\
+             _methodName, _sig)) != NULL))\
+                return
+
+#define CALL_VOID_NOPARAM(_obj, _class, _methodName)\
+            GET_METHOD_ID(method, _class, _methodName, "()V");\
+        if (!NSK_JNI_VERIFY_VOID(env, NSK_CPP_STUB3(CallVoidMethod, env, _obj,\
+             method)))\
+                return
+/*
+ * Class:     nsk_monitoring_share_thread_LockingThreads_Thread1
+ * Method:    B
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_nsk_monitoring_share_thread_LockingThreads_00024Thread1_B
+  (JNIEnv *env, jobject this) {
+        jclass testBugClass, threadClass;
+        jobject lock4, lock5;
+        jfieldID field;
+        jmethodID method;
+
+        GET_OBJECT_CLASS(threadClass, this);
+        FIND_CLASS(testBugClass, "nsk/share/TestBug");
+        GET_OBJ_FIELD(lock4, this, threadClass, "lock4", "Lnsk/monitoring/share/thread/LockingThreads$CustomLock;");
+        GET_OBJ_FIELD(lock5, this, threadClass, "lock5", "Lnsk/monitoring/share/thread/LockingThreads$CustomLock;");
+        if ((*env)->MonitorEnter(env, lock4) == JNI_OK) {
+                if ((*env)->MonitorEnter(env, lock5) == JNI_OK) {
+                        CALL_VOID_NOPARAM(this, threadClass, "C");
+                        (*env)->MonitorExit(env, lock5);
+                } else
+                        (*env)->ThrowNew(env, testBugClass, "MonitorEnter(lock5) call failed");
+                (*env)->MonitorExit(env, lock4);
+        } else
+                (*env)->ThrowNew(env, testBugClass, "MonitorEnter(lock4) call failed");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/LockingThreads.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,262 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share.thread;
+
+import java.lang.management.*;
+import nsk.share.log.*;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * Scenario that starts two threads that use locks * to synchronize.
+ * Based on tests/java/lang/management/ThreadMXBean/LockingThread.java.
+ */
+public class LockingThreads implements ThreadMonitoringScenario, LogAware {
+        private static final String[] expectedMethodsThread1 = {
+                "nsk.monitoring.share.thread.LockingThreads$Thread1.runInside",
+                "nsk.monitoring.share.thread.LockingThreads$Thread1.A",
+                "nsk.monitoring.share.thread.LockingThreads$Thread1.B",
+                "nsk.monitoring.share.thread.LockingThreads$Thread1.C",
+                "nsk.monitoring.share.thread.LockingThreads$Thread1.D",
+                "java.lang.Object.wait",
+        };
+        private static final String[] expectedMethodsThread2 = {
+                "nsk.monitoring.share.thread.LockingThreads$Thread2.runInside",
+                "java.lang.Object.wait",
+        };
+        private CustomLock lock1 = new CustomLock("lock1");
+        private CustomLock lock2 = new CustomLock("lock2");
+        private CustomLock lock3 = new CustomLock("lock3");
+        private CustomLock lock4 = new CustomLock("lock4");
+        private CustomLock lock5 = new CustomLock("lock5");
+        private CustomLock lock6 = new CustomLock("lock6");
+        private CustomLock lock7 = new CustomLock("lock7");
+        private CustomLock lock8 = new CustomLock("lock8");
+        private MonitoringThread thread1;
+        private MonitoringThread thread2;
+        private Log log;
+        private RunType recursionType;
+        private int maxDepth;
+
+        static {
+                System.loadLibrary("LockingThreads");
+        }
+
+        public LockingThreads(Log log, RunType recursionType, int maxDepth) {
+                setLog(log);
+                this.recursionType = recursionType;
+                this.maxDepth = maxDepth;
+        }
+
+        static class CustomLock {
+                private String name;
+
+                public CustomLock(String name) {
+                        this.name = name;
+                }
+
+                public String toString() {
+                        return name;
+                }
+        }
+
+        private class Thread1 extends RecursiveMonitoringThread {
+                private volatile boolean ready = false;
+                private Object readyLock = new Object();
+                private CustomLock lock4;
+                private CustomLock lock5;
+                private Map<String, Object[]> lockedMonitors = new HashMap<String, Object[]>();
+
+                public Thread1(Log log, RunType recursionType, int maxDepth) {
+                        super(log, recursionType, maxDepth);
+                        lock4 = LockingThreads.this.lock4;
+                        lock5 = LockingThreads.this.lock5;
+                        lockedMonitors.put("D", new Object[] {});
+                        lockedMonitors.put("C", new Object[] { lock6 });
+                        lockedMonitors.put("B", new Object[] { lock5, lock4 });
+                        lockedMonitors.put("A", new Object[] { lock3, lock2, lock1});
+                }
+
+                public void checkThreadInfo(ThreadInfo info) {
+                        super.checkThreadInfo(info);
+                        checkLockInfo(info.getLockInfo(), lock7);
+                        checkMonitorInfo(info.getLockedMonitors(), lockedMonitors);
+                }
+
+                protected void runInside() {
+                        A();
+                }
+
+                void A() {
+                        synchronized (lock1) {
+                                synchronized(lock2) {
+                                        synchronized(lock3) {
+                                                B();
+                                        }
+                                }
+                        }
+                }
+
+                private native void B();
+
+                /*
+                void B() {
+                        synchronized (lock4) {
+                                synchronized(lock5) {
+                                        C();
+                                }
+                        }
+                }
+                */
+
+                void C() {
+                        synchronized (lock6) {
+                                D();
+                        }
+                }
+
+                void D() {
+                        synchronized (lock7) {
+                                try {
+                                        synchronized (readyLock) {
+                                                ready = true;
+                                                readyLock.notifyAll();
+                                        }
+                                        lock7.wait();
+                                } catch (InterruptedException e) {
+                                        throw new RuntimeException(e);
+                                }
+                        }
+                }
+
+                public void waitState() {
+                        synchronized (readyLock) {
+                                while (!ready) {
+                                        try {
+                                                readyLock.wait();
+                                        } catch (InterruptedException e) {
+                                                log.warn(e);
+                                        }
+                                }
+                        }
+                        waitThreadState(Thread.State.WAITING);
+                }
+
+                public void finish() {
+                        synchronized (lock7) {
+                                lock7.notifyAll();
+                        }
+                }
+
+                protected boolean isStackTraceElementExpected(StackTraceElement element) {
+                        return super.isStackTraceElementExpected(element) || checkStackTraceElement(element, expectedMethodsThread1);
+                }
+        }
+
+        private class Thread2 extends RecursiveMonitoringThread {
+                private boolean ready = false;
+                private Object readyLock = new Object();
+                private Map<String, Object[]> lockedMonitors = new HashMap<String, Object[]>();
+
+                public Thread2(Log log, RunType recursionType, int maxDepth) {
+                        super(log, recursionType, maxDepth);
+                }
+
+                public void checkThreadInfo(ThreadInfo info) {
+                        super.checkThreadInfo(info);
+                        checkLockInfo(info.getLockInfo(), lock8);
+                        ThreadUtils.printMonitorInfo(log, info.getLockedMonitors());
+                        checkMonitorInfo(info.getLockedMonitors(), lockedMonitors);
+                }
+
+                protected void runInside() {
+                        synchronized (lock8) {
+                                try {
+                                        synchronized (readyLock) {
+                                                ready = true;
+                                                readyLock.notifyAll();
+                                        }
+                                        lock8.wait();
+                                } catch (InterruptedException e) {
+                                        throw new RuntimeException(e);
+                                }
+                        }
+                }
+
+                public void waitState() {
+                        synchronized (readyLock) {
+                                while (!ready) {
+                                        try {
+                                                readyLock.wait();
+                                        } catch (InterruptedException e) {
+                                                log.warn(e);
+                                        }
+                                }
+                        }
+                        waitThreadState(Thread.State.WAITING);
+                }
+
+                public void finish() {
+                        synchronized (lock8) {
+                                lock8.notifyAll();
+                        }
+                }
+
+                protected boolean isStackTraceElementExpected(StackTraceElement element) {
+                        return super.isStackTraceElementExpected(element) || checkStackTraceElement(element, expectedMethodsThread2);
+                }
+        }
+
+
+        public void begin() {
+                thread1 = new Thread1(log, recursionType, maxDepth);
+                thread1.begin();
+                thread2 = new Thread2(log, recursionType, maxDepth);
+                thread2.begin();
+        }
+
+        public void waitState() {
+                thread1.waitState();
+                thread2.waitState();
+        }
+
+        public void check(ThreadMXBean threadMXBean) {
+                thread1.check(threadMXBean);
+                thread2.check(threadMXBean);
+        }
+
+        public void finish() {
+                thread1.finish();
+                thread2.finish();
+        }
+
+        public void end() {
+                thread1.end();
+                thread1.end();
+        }
+
+        public void setLog(Log log) {
+                this.log = log;
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/MonitoringThread.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package nsk.monitoring.share.thread;
+
+import java.lang.management.ThreadMXBean;
+import java.lang.management.ThreadInfo;
+import java.lang.management.MonitorInfo;
+import java.lang.management.LockInfo;
+import nsk.share.log.Log;
+import nsk.share.log.LogAware;
+import nsk.share.TestFailure;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.concurrent.locks.ReentrantLock;
+import java.util.concurrent.locks.Lock;
+
+/**
+ * Base class for all threads that are used in monitoring testing.
+ */
+public abstract class MonitoringThread extends ThreadMonitoringScenarioBase implements Runnable {
+        private final static String[] expectedMethods = {
+                "java.lang.Thread.run"
+        };
+        protected boolean expectedJava = true;
+        protected boolean expectedSuspended = false;
+        protected Thread runner;
+
+        public MonitoringThread(Log log) {
+                super(log);
+        }
+
+        /**
+         * Check that info for this thread is correct. This method is expected
+         * to be called between calls to waitState() and finish().
+         *
+         * @param info thread info
+         * @throws TestFailure when verification fails
+         */
+        public void checkThreadInfo(ThreadInfo info) {
+                verify(info != null, "ThreadInfo is null");
+                verify(info.getThreadId() == runner.getId(), "info.getId() = " + info.getThreadId() + " != this.getId() " + runner.getId());
+                verify(info.getThreadName().equals(runner.getName()), "info.getName() = " + info.getThreadName() + " != this.getName() " + runner.getName());
+                verify(info.getThreadState().equals(runner.getState()), "info.getState() = " + info.getThreadState() + " != this.getState() " + runner.getState());
+                verify(checkStackTrace(info.getStackTrace()), "Verification of stack trace failed");
+                verify(info.isSuspended() == expectedSuspended, "ThreadInfo.isSuspended() = " + info.isSuspended() + " != " + expectedSuspended);
+                verify(info.isInNative() == !expectedJava, "ThreadInfo.isInNative() = " + info.isInNative() + " != " + !expectedJava);
+        }
+
+        public void begin() {
+                runner = new Thread(this);
+                runner.setName(this.getClass().getName() + '@' + System.identityHashCode(this) + "[id=" + runner.getId() + "]");
+                runner.setDaemon(true);
+                runner.start();
+        }
+
+        public abstract void waitState();
+
+        private void doCheck(ThreadInfo info, String description) {
+                try {
+                        checkThreadInfo(info);
+                } catch (TestFailure t) {
+                        log.info("Failed to check: " + description + " thread: " + this);
+                        printThreadInfo(info);
+                        throw t;
+                }
+        }
+
+        private void doCheck(ThreadInfo[] info, String description) {
+                verify(info.length == 1, "Failed to check: " + description + " thread: " + this + " length of returned array is wrong: " + info.length + " expected: " + 1);
+                doCheck(info[0], description);
+        }
+
+        public void check(ThreadMXBean threadMXBean) {
+                lockedMonitorsAvailable = false;
+                lockedSynchronizersAvailable = false;
+                doCheck(threadMXBean.getThreadInfo(runner.getId(), Integer.MAX_VALUE), "ThreadMXBean.getThreadInfo(long, int)");
+                doCheck(threadMXBean.getThreadInfo(runner.getId()), "ThreadMXBean.getThreadInfo(long)");
+                doCheck(threadMXBean.getThreadInfo(new long[] { runner.getId() }), "ThreadMXBean.getThreadInfo(long[])");
+                doCheck(threadMXBean.getThreadInfo(new long[] { runner.getId() }, Integer.MAX_VALUE), "ThreadMXBean.getThreadInfo(long[], int)");
+                lockedMonitorsAvailable = true;
+                lockedSynchronizersAvailable = true;
+                doCheck(threadMXBean.getThreadInfo(new long[] { runner.getId() }, true, true), "ThreadMXBean.getThreadInfo(long[], boolean, boolean)");
+        }
+
+        public abstract void finish();
+
+        public void end() {
+                try {
+                        if (runner != null)
+                                runner.join();
+                } catch (InterruptedException e) {
+                        log.warn(e);
+                }
+        }
+
+        /**
+         * Run this thread.
+         */
+        public abstract void run();
+
+        protected void waitThreadState(Thread.State state) {
+                ThreadUtils.waitThreadState(runner, state);
+        }
+
+        protected boolean isStackTraceElementExpected(StackTraceElement element) {
+                return super.isStackTraceElementExpected(element) || checkStackTraceElement(element, expectedMethods);
+        }
+
+        public final void setExpectedJava(boolean expectedJava) {
+                this.expectedJava = expectedJava;
+        }
+
+        public final long getId() {
+                return runner.getId();
+        }
+
+        public static void yield() {
+                Thread.yield();
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/MultiScenario.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share.thread;
+
+import java.lang.management.*;
+import nsk.share.log.*;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * MultiScenario is stress scenario that creates many scenarios and runs all of them.
+ */
+public class MultiScenario implements ThreadMonitoringScenario {
+        private ThreadMonitoringScenario[] scenarios;
+        private int count;
+        private ThreadMonitoringScenarioFactory scenarioFactory;
+
+        public MultiScenario(ThreadMonitoringScenarioFactory scenarioFactory, int count) {
+                this.scenarioFactory = scenarioFactory;
+                this.count = count;
+        }
+
+        public void begin() {
+                scenarios = scenarioFactory.createScenarios(count);
+                for (ThreadMonitoringScenario scenario : scenarios)
+                        scenario.begin();
+        }
+
+        public void waitState() {
+                for (ThreadMonitoringScenario scenario : scenarios) {
+                        System.out.println("Waiting: " + scenario);
+                        scenario.waitState();
+                }
+        }
+
+        public void check(ThreadMXBean threadMXBean) {
+                for (ThreadMonitoringScenario scenario : scenarios) {
+                        System.out.println("Checking: " + scenario);
+                        scenario.check(threadMXBean);
+                }
+        }
+
+        public void finish() {
+                /* This is still called when ScenarioFactory.createScenarios() throws exception.. */
+                if (scenarios == null)
+                        return;
+                for (ThreadMonitoringScenario scenario : scenarios)
+                        scenario.finish();
+        }
+
+        public void end() {
+                /* This is still called when ScenarioFactory.createScenarios() throws exception.. */
+                if (scenarios == null)
+                        return;
+                for (ThreadMonitoringScenario scenario : scenarios)
+                        scenario.end();
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/NativeBlockedThread.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package nsk.monitoring.share.thread;
+
+import nsk.share.log.Log;
+import java.lang.management.ThreadInfo;
+import java.lang.management.MonitorInfo;
+import java.lang.management.LockInfo;
+import nsk.share.test.LocalRandom;
+import nsk.monitoring.share.Monitoring;
+
+/**
+ * NativeBlockedThread is RecursiveMonitoringThread that blocks to enter
+ * monitor using JNI function MonitorEnter.
+ */
+public class NativeBlockedThread extends BlockedThread {
+        private static final String[] expectedMethods = {
+                "nsk.monitoring.share.thread.NativeBlockedThread.runInside",
+                "nsk.monitoring.share.thread.NativeBlockedThread.nativeBlock"
+        };
+
+        static {
+                System.loadLibrary("NativeBlockedThread");
+        }
+
+        public NativeBlockedThread(Log log, RunType recursionType, int maxDepth, LockerThread lockerThread) {
+                super(log, recursionType, maxDepth, lockerThread);
+        }
+
+        protected void runInside() {
+                synchronized (readyLock) {
+                        ready = true;
+                        readyLock.notifyAll();
+                }
+                nativeBlock(lock);
+        }
+
+        protected native void nativeBlock(Object lock);
+
+        protected boolean isStackTraceElementExpected(StackTraceElement element) {
+                return super.isStackTraceElementExpected(element) || checkStackTraceElement(element, expectedMethods);
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/NewThread.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package nsk.monitoring.share.thread;
+
+import nsk.share.log.Log;
+import java.lang.management.ThreadInfo;
+import nsk.share.TestFailure;
+import nsk.share.TestBug;
+
+/**
+ * New Thread is dummy RecursiveMonitoringThread that is not getting
+ * started.
+ */
+public class NewThread extends RecursiveMonitoringThread {
+        public NewThread(Log log, RunType recursionType, int maxDepth) {
+                super(log, recursionType, maxDepth);
+        }
+
+        public void begin() {
+                // We don't run this thread.
+                runner = new Thread(this);
+        }
+
+        public void waitState() {
+        }
+
+        public void finish() {
+        }
+
+        protected void runInside() {
+                throw new TestBug("Should not reach here");
+        }
+
+        protected boolean isStackTraceElementExpected(StackTraceElement element) {
+                return super.isStackTraceElementExpected(element);
+        }
+
+        public void checkThreadInfo(ThreadInfo info) {
+                verify(info == null, "ThreadInfo != null");
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/RecursiveMonitoringThread.c	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,177 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include <jni.h>
+#include <stdio.h>
+#include "jni_tools.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define FIND_CLASS(_class, _className)\
+    if (!NSK_JNI_VERIFY(env, (_class = \
+            NSK_CPP_STUB2(FindClass, env, _className)) != NULL))\
+        return
+
+#define GET_OBJECT_CLASS(_class, _obj)\
+    if (!NSK_JNI_VERIFY(env, (_class = \
+            NSK_CPP_STUB2(GetObjectClass, env, _obj)) != NULL))\
+        return
+
+#define GET_STATIC_FIELD_ID(_fieldID, _class, _fieldName, _fieldSig)\
+    if (!NSK_JNI_VERIFY(env, (_fieldID = \
+            NSK_CPP_STUB4(GetStaticFieldID, env, _class,\
+                _fieldName, _fieldSig)) != NULL))\
+        return
+
+#define GET_STATIC_OBJ_FIELD(_value, _class, _fieldName, _fieldSig)\
+    GET_STATIC_FIELD_ID(field, _class, _fieldName, _fieldSig);\
+    _value = NSK_CPP_STUB3(GetStaticObjectField, env, _class, \
+                                field)
+
+#define GET_STATIC_BOOL_FIELD(_value, _class, _fieldName)\
+    GET_STATIC_FIELD_ID(field, _class, _fieldName, "Z");\
+    _value = NSK_CPP_STUB3(GetStaticBooleanField, env, _class, field)
+
+#define GET_FIELD_ID(_fieldID, _class, _fieldName, _fieldSig)\
+    if (!NSK_JNI_VERIFY(env, (_fieldID = \
+            NSK_CPP_STUB4(GetFieldID, env, _class,\
+                _fieldName, _fieldSig)) != NULL))\
+        return
+
+#define GET_INT_FIELD(_value, _obj, _class, _fieldName)\
+    GET_FIELD_ID(field, _class, _fieldName, "I");\
+    _value = NSK_CPP_STUB3(GetIntField, env, _obj, field)
+
+#define GET_LONG_FIELD(_value, _obj, _class, _fieldName)\
+    GET_FIELD_ID(field, _class, _fieldName, "J");\
+    _value = NSK_CPP_STUB3(GetLongField, env, _obj, field)
+
+#define GET_STATIC_INT_FIELD(_value, _class, _fieldName)\
+    GET_STATIC_FIELD_ID(field, _class, _fieldName, "I");\
+    _value = NSK_CPP_STUB3(GetStaticIntField, env, _class, field)
+
+#define SET_INT_FIELD(_obj, _class, _fieldName, _newValue)\
+    GET_FIELD_ID(field, _class, _fieldName, "I");\
+    NSK_CPP_STUB4(SetIntField, env, _obj, field, _newValue)
+
+#define GET_OBJ_FIELD(_value, _obj, _class, _fieldName, _fieldSig)\
+    GET_FIELD_ID(field, _class, _fieldName, _fieldSig);\
+    _value = NSK_CPP_STUB3(GetObjectField, env, _obj, field)
+
+
+#define GET_ARR_ELEMENT(_arr, _index)\
+    NSK_CPP_STUB3(GetObjectArrayElement, env, _arr, _index)
+
+#define SET_ARR_ELEMENT(_arr, _index, _newValue)\
+    NSK_CPP_STUB4(SetObjectArrayElement, env, _arr, _index, _newValue)
+
+#define GET_STATIC_METHOD_ID(_methodID, _class, _methodName, _sig)\
+    if (!NSK_JNI_VERIFY(env, (_methodID = \
+            NSK_CPP_STUB4(GetStaticMethodID, env, _class,\
+                _methodName, _sig)) != NULL))\
+        return
+
+#define GET_METHOD_ID(_methodID, _class, _methodName, _sig)\
+    if (!NSK_JNI_VERIFY(env, (_methodID = \
+            NSK_CPP_STUB4(GetMethodID, env, _class,\
+                _methodName, _sig)) != NULL))\
+        return
+
+#define CALL_STATIC_VOID_NOPARAM(_class, _methodName)\
+    GET_STATIC_METHOD_ID(method, _class, _methodName, "()V");\
+    if (!NSK_JNI_VERIFY_VOID(env, NSK_CPP_STUB3(CallStaticVoidMethod, env,\
+                            _class, method)))\
+        return
+
+#define CALL_STATIC_VOID(_class, _methodName, _sig, _param)\
+    GET_STATIC_METHOD_ID(method, _class, _methodName, _sig);\
+    if (!NSK_JNI_VERIFY_VOID(env, NSK_CPP_STUB4(CallStaticVoidMethod, env,\
+                                                    _class, method, _param)))\
+        return
+
+#define CALL_VOID_NOPARAM(_obj, _class, _methodName)\
+    GET_METHOD_ID(method, _class, _methodName, "()V");\
+    if (!NSK_JNI_VERIFY_VOID(env, NSK_CPP_STUB3(CallVoidMethod, env, _obj,\
+                                                    method)))\
+        return
+
+#define CALL_VOID(_obj, _class, _methodName, _sig, _param)\
+    GET_METHOD_ID(method, _class, _methodName, _sig);\
+    if (!NSK_JNI_VERIFY_VOID(env, NSK_CPP_STUB4(CallVoidMethod, env, _obj,\
+                                                    method, _param)))\
+        return
+
+#define CALL_VOID2(_obj, _class, _methodName, _sig, _param1, _param2)\
+    GET_METHOD_ID(method, _class, _methodName, _sig);\
+    if (!NSK_JNI_VERIFY_VOID(env, NSK_CPP_STUB5(CallVoidMethod, env, _obj, \
+                                                    method, _param1, _param2)))\
+        return
+
+#define CALL_INT_NOPARAM(_value, _obj, _class, _methodName)\
+    GET_METHOD_ID(method, _class, _methodName, "()I");\
+    _value = NSK_CPP_STUB3(CallIntMethod, env, _obj, method)
+
+#define NEW_OBJ(_obj, _class, _constructorName, _sig, _params)\
+    GET_METHOD_ID(method, _class, _constructorName, _sig);\
+    if (!NSK_JNI_VERIFY(env, (_obj = \
+            NSK_CPP_STUB4(NewObject, env, _class, method, _params)) != NULL))\
+        return
+
+#define MONITOR_ENTER(x) \
+    NSK_JNI_VERIFY(env, NSK_CPP_STUB2(MonitorEnter, env, x) == 0)
+
+#define MONITOR_EXIT(x) \
+    NSK_JNI_VERIFY(env, NSK_CPP_STUB2(MonitorExit, env, x) == 0)
+
+#define TRACE(msg)\
+   GET_OBJ_FIELD(logger, obj, threadClass, "logger", "Lnsk/share/Log$Logger;");\
+   jmsg = NSK_CPP_STUB2(NewStringUTF, env, msg);\
+   CALL_VOID2(logger, loggerClass, "trace",\
+                           "(ILjava/lang/String;)V", 50, jmsg)
+
+
+/*
+ * Class:     nsk_monitoring_share_thread_RecursiveMonitoringThread
+ * Method:    nativeRecursiveMethod
+ * Signature: (IZ)V
+ */
+JNIEXPORT void JNICALL Java_nsk_monitoring_share_thread_RecursiveMonitoringThread_nativeRecursiveMethod
+(JNIEnv *env, jobject this, jint currentDepth, jboolean pureNative) {
+        jclass class;
+        jmethodID method;
+
+        GET_OBJECT_CLASS(class, this);
+        if (currentDepth-- > 0) {
+/*              printf("Current depth: %d\n", currentDepth); */
+                CALL_STATIC_VOID_NOPARAM(class, "yield");
+                if (pureNative == JNI_TRUE) {
+                        CALL_VOID2(this, class, "nativeRecursiveMethod", "(IZ)V", currentDepth, pureNative);
+                } else {
+                        CALL_VOID(this, class, "recursiveMethod", "(I)V", currentDepth);
+                }
+        } else {
+                CALL_VOID_NOPARAM(this, class, "runInside");
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/RecursiveMonitoringThread.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package nsk.monitoring.share.thread;
+
+import nsk.share.log.Log;
+
+/**
+ * RecursiveMonitoringThread is a thread that recursively executes some
+ * methods and runs method runInside inside. The method may be implemented
+ * by subclasses. The types of methods are determined by recursionType,
+ * which may be JAVA (only java methods), NATIVE (only native
+ * methods) and MIXED (java and native methods).
+ */
+public abstract class RecursiveMonitoringThread extends MonitoringThread {
+        private RunType recursionType;
+        private int maxDepth;
+        private static final String[] expectedMethodsJava = {
+                "nsk.monitoring.share.thread.RecursiveMonitoringThread.recursiveMethod",
+                "nsk.monitoring.share.thread.RecursiveMonitoringThread.run"
+        };
+        private static final String[] expectedMethodsNative = {
+                "nsk.monitoring.share.thread.RecursiveMonitoringThread.nativeRecursiveMethod",
+                "nsk.monitoring.share.thread.RecursiveMonitoringThread.run"
+        };
+        private static final String[] expectedMethodsMixed = {
+                "nsk.monitoring.share.thread.RecursiveMonitoringThread.nativeRecursiveMethod",
+                "nsk.monitoring.share.thread.RecursiveMonitoringThread.recursiveMethod",
+                "nsk.monitoring.share.thread.RecursiveMonitoringThread.run"
+        };
+
+        static {
+                System.loadLibrary("RecursiveMonitoringThread");
+        }
+
+        public RecursiveMonitoringThread(Log log, RunType recursionType, int maxDepth) {
+                super(log);
+                this.recursionType = recursionType;
+                this.maxDepth = maxDepth;
+        }
+
+        public void run() {
+                switch (recursionType) {
+                case JAVA:
+                case MIXED:
+                        recursiveMethod(maxDepth);
+                        break;
+                case NATIVE:
+                        nativeRecursiveMethod(maxDepth, true);
+                        break;
+                }
+        }
+
+        protected void recursiveMethod(int currentDepth) {
+                if (currentDepth-- > 0) {
+                        switch (recursionType) {
+                        case JAVA:
+                                recursiveMethod(currentDepth);
+                                break;
+                        case MIXED:
+                                nativeRecursiveMethod(currentDepth, false);
+                                break;
+                        }
+                } else {
+                        runInside();
+                }
+        }
+
+        protected boolean isStackTraceElementExpected(StackTraceElement element) {
+                if (super.isStackTraceElementExpected(element))
+                        return true;
+                switch (recursionType) {
+                case JAVA:
+                        return checkStackTraceElement(element, expectedMethodsJava);
+                case NATIVE:
+                        return checkStackTraceElement(element, expectedMethodsNative);
+                case MIXED:
+                        return checkStackTraceElement(element, expectedMethodsMixed);
+                default:
+                        throw new IllegalArgumentException("Unknown recursionType: " + recursionType);
+                }
+        }
+
+        protected native void nativeRecursiveMethod(int currentDepth, boolean pureNative);
+
+        protected abstract void runInside();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/RunType.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package nsk.monitoring.share.thread;
+
+/**
+ * RunType defines how particular code should run - pure java,
+ * pure native or mixed.
+ */
+public enum RunType {
+        JAVA,
+        NATIVE,
+        MIXED
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/RunningThread.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package nsk.monitoring.share.thread;
+
+import nsk.share.log.Log;
+import java.lang.management.ThreadInfo;
+import nsk.share.TestFailure;
+
+/**
+ * RunningThread is a RecursiveMonitoringThread that simply
+ * runs a loop.
+ */
+public class RunningThread extends RecursiveMonitoringThread {
+        private volatile boolean running = false;
+        private volatile boolean ready = false;
+        private Object readyLock = new Object();
+        private static final String[] expectedMethods = {
+                "nsk.monitoring.share.thread.RunningThread.runInside",
+                "java.lang.Thread.yield"
+        };
+
+        public RunningThread(Log log, RunType recursionType, int maxDepth) {
+                super(log, recursionType, maxDepth);
+        }
+
+        public void waitState() {
+                synchronized (readyLock) {
+                        while (!ready) {
+                                try {
+                                        readyLock.wait();
+                                } catch (InterruptedException e) {
+                                        log.warn(e);
+                                }
+                        }
+                }
+                waitThreadState(Thread.State.RUNNABLE);
+        }
+
+        public void finish() {
+                running = false;
+        }
+
+        protected void runInside() {
+                synchronized (readyLock) {
+                        ready = true;
+                        running = true;
+                        readyLock.notifyAll();
+                }
+                while (running)
+                        ;
+        }
+
+        protected boolean isStackTraceElementExpected(StackTraceElement element) {
+                return super.isStackTraceElementExpected(element) || checkStackTraceElement(element, expectedMethods);
+        }
+
+        public void checkThreadInfo(ThreadInfo info) {
+                super.checkThreadInfo(info);
+                verify(info.getThreadState() == Thread.State.RUNNABLE, "ThreadInfo.getState() = " + info.getThreadState() + "!= Thread.State.RUNNABLE");
+                verify(info.getBlockedTime() == 0 || info.getBlockedTime() == -1, "ThreadInfo.getBlockedTime() == " + info.getBlockedTime());
+                verify(info.getBlockedCount() >= 0, "ThreadInfo.getBlockedCount() = " + info.getBlockedCount() + " < 0");
+                verify(info.getWaitedTime() == 0 || info.getWaitedTime() == -1, "ThreadInfo.getWaitedTime() == " + info.getWaitedTime());
+                verify(info.getWaitedCount() == 0, "ThreadInfo.getWaitedCount() = " + info.getWaitedCount() + " != 0");
+                verify(info.getLockInfo() == null, "ThreadInfo.getLockInfo() != null");
+                verify(info.getLockName() == null, "ThreadInfo.getLockName() != null");
+                verify(info.getLockOwnerId() == -1, "ThreadInfo.getLockOwnerId() != -1");
+                verify(info.getLockOwnerName() == null, "ThreadInfo.getLockOwnerName() != null");
+                checkMonitorInfo(info.getLockedMonitors(), null);
+                checkSynchronizers(info.getLockedSynchronizers(), null);
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/ScenarioTypeAware.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package nsk.monitoring.share.thread;
+
+/**
+ * ScenarioTypeAware is marker interface for obtaining scenario type.
+ */
+public interface ScenarioTypeAware {
+        public void setScenarioType(String threadType);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/SleepingThread.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package nsk.monitoring.share.thread;
+
+import nsk.share.log.Log;
+import java.lang.management.ThreadInfo;
+import java.lang.management.MonitorInfo;
+import java.lang.management.LockInfo;
+
+/**
+ * SleepingThread is RecursiveMonitoringThread that sleeps.
+ */
+public class SleepingThread extends RecursiveMonitoringThread {
+        private String lock = new String("a lock");
+        private volatile boolean sleeping = false;
+        private Object readyLock = new Object();
+        private static final String[] expectedMethods = {
+                "java.lang.Thread.sleep",
+                "nsk.monitoring.share.thread.SleepingThread.runInside"
+        };
+
+        public SleepingThread(Log log, RunType recursionType, int maxDepth) {
+                super(log, recursionType, maxDepth);
+        }
+
+        public void checkThreadInfo(ThreadInfo info) {
+                super.checkThreadInfo(info);
+                verify(info.getThreadState() == Thread.State.TIMED_WAITING, "ThreadInfo.getThreadState() = " + info.getThreadState() + " != " + Thread.State.TIMED_WAITING);
+                verify(info.getBlockedTime() == 0 || info.getBlockedTime() == -1, "ThreadInfo.getBlockedTime() == " + info.getBlockedTime());
+                verify(info.getBlockedCount() >= 0, "ThreadInfo.getBlockedCount() = " + info.getBlockedCount() + " != 0");
+                verify(info.getWaitedTime() == 0 || info.getWaitedTime() == -1, "ThreadInfo.getWaitedTime() == " + info.getWaitedTime());
+                verify(info.getWaitedCount() == 1, "ThreadInfo.getWaitedCount() = " + info.getWaitedCount() + " != 1");
+                verify(info.getLockInfo() == null, "ThreadInfo.getLockInfo() != null ");
+                verify(info.getLockName() == null, "ThreadInfo.getLockName() " + info.getLockName() + " != null");
+                verify(info.getLockOwnerId() == -1, "ThreadInfo.getLockOwnerId() = " + info.getLockOwnerId() + " != null");
+                verify(info.getLockOwnerName() == null, "ThreadInfo.getLockOwnerName() = " + info.getLockOwnerName() + " != null");
+                checkMonitorInfo(info.getLockedMonitors(), null);
+                checkSynchronizers(info.getLockedSynchronizers(), null);
+        }
+
+        public void waitState() {
+                synchronized (readyLock) {
+                        while (!sleeping) {
+                                try {
+                                        readyLock.wait();
+                                } catch (InterruptedException e) {
+                                        log.warn(e);
+                                }
+                        }
+                }
+                waitThreadState(Thread.State.TIMED_WAITING);
+        }
+
+        public void finish() {
+                sleeping = false;
+                runner.interrupt();
+        }
+
+        protected void runInside() {
+                synchronized (readyLock) {
+                        sleeping = true;
+                        readyLock.notifyAll();
+                }
+                while (sleeping) {
+                        try {
+                                Thread.sleep(10000000);
+                        } catch (InterruptedException e) {
+                        }
+                }
+        }
+
+        protected boolean isStackTraceElementExpected(StackTraceElement element) {
+                return super.isStackTraceElementExpected(element) || checkStackTraceElement(element, expectedMethods);
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/StandardThreadMonitoringScenarioFactory.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package nsk.monitoring.share.thread;
+
+import nsk.share.TestBug;
+import nsk.share.log.Log;
+import nsk.share.log.LogAware;
+
+public class StandardThreadMonitoringScenarioFactory implements ThreadMonitoringScenarioFactory, LogAware {
+        private Log log;
+        private int maxDepth;
+        private LockerThread lockerThread;
+        private final int typeCount = 7;
+        private int threadCount;
+
+        public StandardThreadMonitoringScenarioFactory(Log log, int maxDepth, int threadCount) {
+                setLog(log);
+                this.maxDepth = maxDepth;
+                this.threadCount = threadCount;
+        }
+
+        public int getScenarioCount(int basicThreadCount) {
+                // This is choosen to have one scenario of each type and recursionType.
+                basicThreadCount = Math.min(basicThreadCount, 3);
+                return basicThreadCount * typeCount * 3;
+        }
+
+        public ThreadMonitoringScenario[] createScenarios(int count) {
+                ThreadMonitoringScenario[] scenarios = new ThreadMonitoringScenario[count];
+                for (int i = 0; i < count; ++i)
+                        scenarios[i] = createScenario(i);
+                return scenarios;
+        }
+
+        public ThreadMonitoringScenario createScenario(String scenarioType) {
+                RunType recursionType = RunType.MIXED;
+                if (scenarioType.equals("running"))
+                        return new RunningThread(log, recursionType, maxDepth);
+                else if (scenarioType.equals("sleeping"))
+                        return new SleepingThread(log, recursionType, maxDepth);
+                else if (scenarioType.equals("timedWaiting"))
+                        return new TimedWaitingThread(log, recursionType, maxDepth);
+                else if (scenarioType.equals("waiting"))
+                        return new WaitingThread(log, recursionType, maxDepth);
+                else if (scenarioType.equals("blocked"))
+                        return new BlockedThread(log, recursionType, maxDepth, getLockerThread());
+                else if (scenarioType.equals("nativeBlocked"))
+                        return new NativeBlockedThread(log, recursionType, maxDepth, getLockerThread());
+                else if (scenarioType.equals("new"))
+                        return new NewThread(log, recursionType, maxDepth);
+                else if (scenarioType.equals("finished"))
+                        return new FinishedThread(log, recursionType, maxDepth);
+                else if (scenarioType.equals("lockingThreads"))
+                        return new LockingThreads(log, recursionType, maxDepth);
+                else if (scenarioType.equals("synchronizerLockingThreads"))
+                        return new SynchronizerLockingThreads(log, recursionType, maxDepth);
+                else if (scenarioType.equals("javaDeadlock"))
+                        return new Deadlock(log, recursionType, maxDepth, Deadlock.Type.JAVA, threadCount);
+                else if (scenarioType.equals("nativeDeadlock"))
+                        return new Deadlock(log, recursionType, maxDepth, Deadlock.Type.NATIVE, threadCount);
+                else if (scenarioType.equals("synchronizedMethodDeadlock"))
+                        return new Deadlock(log, recursionType, maxDepth, Deadlock.Type.SYNCHRONIZED_METHOD, threadCount);
+                else if (scenarioType.equals("synchronizerDeadlock"))
+                        return new Deadlock(log, recursionType, maxDepth, Deadlock.Type.SYNCHRONIZER, threadCount);
+                else if (scenarioType.equals("mixedDeadlock"))
+                        return new Deadlock(log, recursionType, maxDepth, Deadlock.Type.MIXED, 16);
+                /*
+                else if (scenarioType.equals("mixedMonitorDeadlock"))
+                        return new Deadlock(log, recursionType, maxDepth, Deadlock.DeadlockType.MIXED, threadCount);
+                else if (scenarioType.equals("mixed2MonitorDeadlock"))
+                        return new MonitorDeadlock(log, recursionType, maxDepth, MonitorDeadlock.DeadlockType.MIXED2, threadCount);
+                        */
+                throw new TestBug("Unknown scenario type: " + scenarioType);
+        }
+
+        protected ThreadMonitoringScenario createScenario(int i) {
+                RunType recursionType;
+                switch (i % 3) {
+                case 0:
+                        recursionType = RunType.JAVA;
+                        break;
+                case 1:
+                        recursionType = RunType.NATIVE;
+                        break;
+                case 2:
+                        recursionType = RunType.MIXED;
+                        break;
+                default:
+                        throw new TestBug("Unknown recursionType.");
+                }
+                switch (i % typeCount) {
+                case 0:
+                        return new SleepingThread(log, recursionType, maxDepth);
+                case 1:
+                        return new TimedWaitingThread(log, recursionType, maxDepth);
+                case 2:
+                        return new RunningThread(log, recursionType, maxDepth);
+                case 3:
+                        return new WaitingThread(log, recursionType, maxDepth);
+                case 4:
+                        return new BlockedThread(log, recursionType, maxDepth, getLockerThread());
+                case 5:
+                        return new LockingThreads(log, recursionType, maxDepth);
+                case 6:
+                        return new SynchronizerLockingThreads(log, recursionType, maxDepth);
+                default:
+                        throw new TestBug("Unknown thread kind");
+                }
+        }
+
+        private LockerThread getLockerThread() {
+                if (lockerThread == null) {
+                        lockerThread = new LockerThread();
+                        lockerThread.start();
+                        lockerThread.waitState();
+                }
+                return lockerThread;
+        }
+
+        public void finish() {
+                if (lockerThread != null) {
+                        lockerThread.finish();
+                        try {
+                                lockerThread.join();
+                        } catch (InterruptedException e) {
+                                log.warn(e);
+                        }
+                        lockerThread = null;
+                }
+        }
+
+        public void setLog(Log log) {
+                this.log = log;
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/SynchronizerLockingThreads.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,282 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share.thread;
+
+import java.lang.management.*;
+import nsk.share.log.*;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.concurrent.locks.ReentrantLock;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.Lock;
+
+/**
+ * Scenario that starts two threads that use locks * to synchronize.
+ * The code is based on tests/java/lang/management/ThreadMXBean/LockingThread.java
+ */
+public class SynchronizerLockingThreads implements ThreadMonitoringScenario, LogAware {
+        private static final String[] expectedMethodsThread1 = {
+                "nsk.monitoring.share.thread.SynchronizerLockingThreads$Thread1.runInside",
+                "nsk.monitoring.share.thread.SynchronizerLockingThreads$Thread1.A",
+                "nsk.monitoring.share.thread.SynchronizerLockingThreads$Thread1.B",
+                "nsk.monitoring.share.thread.SynchronizerLockingThreads$Thread1.C",
+                "nsk.monitoring.share.thread.SynchronizerLockingThreads$Thread1.D",
+                "java.lang.Object.wait"
+        };
+        private static final String[] expectedMethodsThread2 = {
+                "nsk.monitoring.share.thread.SynchronizerLockingThreads$Thread2.runInside"
+        };
+        private ReentrantLock lock1 = new ReentrantLock();
+        private ReentrantLock lock2 = new ReentrantLock();
+        private ReentrantLock lock3 = new ReentrantLock();
+        private ReentrantLock lock4 = new ReentrantLock();
+        private CustomLock lock5 = new CustomLock("lock5");
+        private CustomLock lock6 = new CustomLock("lock6");
+        private CustomLock lock7 = new CustomLock("lock7");
+        private ReentrantLock lock8 = new ReentrantLock();
+        private MonitoringThread thread1;
+        private MonitoringThread thread2;
+        private Log log;
+        private RunType recursionType;
+        private int maxDepth;
+
+        public SynchronizerLockingThreads(Log log, RunType recursionType, int maxDepth) {
+                setLog(log);
+                this.recursionType = recursionType;
+                this.maxDepth = maxDepth;
+                thread1 = new Thread1(log, recursionType, maxDepth);
+                thread2 = new Thread2(log, recursionType, maxDepth);
+        }
+
+        static class CustomLock {
+                private String name;
+
+                public CustomLock(String name) {
+                        this.name = name;
+                }
+
+                public String toString() {
+                        return name;
+                }
+        }
+
+        private class Thread1 extends RecursiveMonitoringThread {
+                private volatile boolean ready = false;
+                private Object readyLock = new Object();
+                private Map<String, Object[]> lockedMonitors = new HashMap<String, Object[]>();
+                private Map<String, Lock[]> lockedSynchronizers = new HashMap<String, Lock[]>();
+
+                public Thread1(Log log, RunType recursionType, int maxDepth) {
+                        super(log, recursionType, maxDepth);
+                        lockedMonitors.put("D", new Object[] {});
+                        lockedMonitors.put("C", new Object[] { lock6 });
+                        lockedMonitors.put("B", new Object[] { lock5 });
+                        lockedMonitors.put("A", new Object[] { });
+                        lockedSynchronizers.put("D", new ReentrantLock[0]); // no sync locked
+                        lockedSynchronizers.put("C", new ReentrantLock[0]); // no sync locked
+                        lockedSynchronizers.put("B", new Lock[] {lock4});
+                        lockedSynchronizers.put("A", new Lock[] {lock3, lock2, lock1});
+                }
+
+                public void checkThreadInfo(ThreadInfo info) {
+                        super.checkThreadInfo(info);
+                        checkLockInfo(info.getLockInfo(), lock7);
+                        checkMonitorInfo(info.getLockedMonitors(), lockedMonitors);
+                        checkSynchronizers(info.getLockedSynchronizers(), lockedSynchronizers);
+                }
+
+                protected void runInside() {
+                        A();
+                }
+
+                void A() {
+                        lock1.lock();
+                        try {
+                                lock2.lock();
+                                try {
+                                        lock3.lock();
+                                        try {
+                                                B();
+                                        } finally {
+                                                lock3.unlock();
+                                        }
+                                } finally {
+                                        lock2.unlock();
+                                }
+                        } finally {
+                                lock1.unlock();
+                        }
+                }
+
+                void B() {
+                        lock4.lock();
+                        try {
+                                synchronized(lock5) {
+                                        C();
+                                }
+                        } finally {
+                                lock4.unlock();
+                        }
+                }
+
+                void C() {
+                        synchronized(lock6) {
+                                D();
+                        }
+                }
+
+                void D() {
+                        synchronized(lock7) {
+                                try {
+                                        synchronized (readyLock) {
+                                                ready = true;
+                                                readyLock.notifyAll();
+                                        }
+                                        lock7.wait();
+                                } catch (InterruptedException e) {
+                                        throw new RuntimeException(e);
+                                }
+                        }
+                }
+
+
+                public void waitState() {
+                        synchronized (readyLock) {
+                                while (!ready) {
+                                        try {
+                                                readyLock.wait();
+                                        } catch (InterruptedException e) {
+                                                log.warn(e);
+                                        }
+                                }
+                        }
+                        waitThreadState(Thread.State.WAITING);
+                }
+
+                public void finish() {
+                        synchronized (lock7) {
+                                lock7.notifyAll();
+                        }
+                }
+
+                protected boolean isStackTraceElementExpected(StackTraceElement element) {
+                        return super.isStackTraceElementExpected(element) || checkStackTraceElement(element, expectedMethodsThread1);
+                }
+        }
+
+        private class Thread2 extends RecursiveMonitoringThread {
+                private boolean ready = false;
+                private Object readyLock = new Object();
+                private Map<String, Object[]> lockedMonitors = new HashMap<String, Object[]>();
+                private Map<String, Lock[]> lockedSynchronizers = new HashMap<String, Lock[]>();
+                private Condition c = lock8.newCondition();
+
+                public Thread2(Log log, RunType recursionType, int maxDepth) {
+                        super(log, recursionType, maxDepth);
+                }
+
+                public void checkThreadInfo(ThreadInfo info) {
+                        super.checkThreadInfo(info);
+                        checkLockInfo(info.getLockInfo(), c);
+                        checkMonitorInfo(info.getLockedMonitors(), lockedMonitors);
+                        checkSynchronizers(info.getLockedSynchronizers(), lockedSynchronizers);
+                }
+
+                protected void runInside() {
+                        lock8.lock();
+                        try {
+                                synchronized (readyLock) {
+                                        ready = true;
+                                        readyLock.notifyAll();
+                                }
+                                c.await();
+                        } catch (InterruptedException e) {
+                                throw new RuntimeException(e);
+                        } finally {
+                                lock8.unlock();
+                        }
+                }
+
+                public void waitState() {
+                        synchronized (readyLock) {
+                                while (!ready) {
+                                        try {
+                                                readyLock.wait();
+                                        } catch (InterruptedException e) {
+                                                log.warn(e);
+                                        }
+                                }
+                        }
+                        waitThreadState(Thread.State.WAITING);
+                }
+
+                public void finish() {
+                        lock8.lock();
+                        try {
+                                c.signalAll();
+                        } finally {
+                                lock8.unlock();
+                        }
+                }
+
+                protected boolean isStackTraceElementExpected(StackTraceElement element) {
+                        return super.isStackTraceElementExpected(element) ||
+                                checkStackTraceElement(element, expectedMethodsThread2) ||
+                                element.getClassName().startsWith("java.util.concurrent.locks.") ||
+                                element.getClassName().startsWith("jdk.internal.misc.");
+                }
+        }
+
+
+        public void begin() {
+                thread1.begin();
+                thread2.begin();
+        }
+
+        public void waitState() {
+                thread1.waitState();
+                thread2.waitState();
+        }
+
+        public void check(ThreadMXBean threadMXBean) {
+                long[] ids = new long[] { thread1.getId(), thread2.getId() };
+                ThreadInfo[] info = threadMXBean.getThreadInfo(ids, true, true);
+                thread1.checkThreadInfo(info[0]);
+                thread2.checkThreadInfo(info[1]);
+        }
+
+        public void finish() {
+                thread1.finish();
+                thread2.finish();
+        }
+
+        public void end() {
+                thread1.end();
+                thread2.end();
+        }
+
+        public void setLog(Log log) {
+                this.log = log;
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/ThreadMonitoringScenario.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package nsk.monitoring.share.thread;
+
+import java.lang.management.ThreadMXBean;
+
+/**
+ * ThreadMonitoringScenario is basic interface which should be
+ * implemented by all scenarios that excersize ThreadMXBean threads
+ * information.
+ */
+public interface ThreadMonitoringScenario {
+        /**
+         * Begin this scenario. Make necessary preparations and start threads.
+         */
+        public void begin();
+
+        /**
+         * Wait for threads to come into pre-defined state.
+         */
+        public void waitState();
+
+        /**
+         * Check ThreadMXBean information.
+         */
+        public void check(ThreadMXBean threadMXBean);
+
+        /**
+         * Signal threads to finish.
+         */
+        public void finish();
+
+        /**
+         * End this scenario. Wait for threads to exit and make
+         * necessary cleanup.
+         */
+        public void end();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/ThreadMonitoringScenarioBase.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,264 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package nsk.monitoring.share.thread;
+
+import java.lang.management.ThreadMXBean;
+import java.lang.management.ThreadInfo;
+import java.lang.management.MonitorInfo;
+import java.lang.management.LockInfo;
+import nsk.share.log.Log;
+import nsk.share.log.LogAware;
+import nsk.share.TestFailure;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.concurrent.locks.ReentrantLock;
+import java.util.concurrent.locks.Lock;
+
+/**
+ * Base class for all threads that are used in monitoring testing.
+ */
+public abstract class ThreadMonitoringScenarioBase implements LogAware, ThreadMonitoringScenario {
+        protected static boolean lockedMonitorsAvailable = true;
+        protected static boolean lockedSynchronizersAvailable = true;
+        protected Log log;
+
+        public ThreadMonitoringScenarioBase(Log log) {
+                setLog(log);
+        }
+
+        public abstract void begin();
+
+        public abstract void waitState();
+
+        public abstract void finish();
+
+        public abstract void end();
+
+        protected void printThreadInfo(ThreadInfo info) {
+                //ThreadUtils.threadDump(log, threadMXBean.dumpAllThreads(true, true));
+                ThreadUtils.threadInfo(log, info);
+        }
+
+
+        /**
+         * Check that there are no unexpected elements in stack trace.
+         */
+        protected boolean checkStackTrace(StackTraceElement[] elements) {
+                boolean unexpected = false;
+                for (StackTraceElement element : elements)
+                        if (!isStackTraceElementExpected(element)) {
+                                if (!unexpected) {
+                                        log.info("Unexpected stack trace elements for: " + this);
+                                        unexpected = true;
+                                }
+                                log.info(ThreadUtils.INDENT + "at " + element);
+                        }
+                return !unexpected;
+        }
+
+        /**
+         * Verifies that given stack trace element from stack trace is expected
+         * in pre-defined state. This method will be called by checkStackTrace
+         * for each element.
+         *
+         * @param element stack trace element
+         * @return true if element is expected, false otherwise
+         */
+        protected boolean isStackTraceElementExpected(StackTraceElement element) {
+                return false;
+        }
+
+        /**
+         * Check that stack trace element is expected.
+         */
+        protected boolean checkStackTraceElement(StackTraceElement element, String[] expectedMethods) {
+                String name = element.getClassName() + "." + element.getMethodName();
+                for (String method : expectedMethods)
+                        if (method.equals(name))
+                                return true;
+                return false;
+        }
+
+        /**
+         * Check that lock info matches given lock object.
+         *
+         * @param lockInfo lock info
+         * @param lock lock object
+         */
+        protected void checkLockInfo(LockInfo lockInfo, Object lock) {
+                if (lock != null) {
+                        verify(lockInfo.getClassName().equals(lock.getClass().getName()), "LockInfo.getClassName() = " + lockInfo.getClassName() + " differs from lock.getClass().getName() = " + lock.getClass().getName());
+                        verify(lockInfo.getIdentityHashCode() == System.identityHashCode(lock), "LockInfo.getIdentityHashCode() = " + lockInfo.getIdentityHashCode() + " differs from System.identityHashCode(lock) = " + System.identityHashCode(lock));
+                        String expectedToString = lock.getClass().getName() + '@' + Integer.toHexString(System.identityHashCode(lock));
+                        verify(lockInfo.toString().equals(expectedToString), "LockInfo.toString() = " + lockInfo.toString() + " differs from expected toString() = " + expectedToString);
+                } else
+                        verify(lockInfo == null, "Unexpected ThreadInfo.getLockInfo(): " + ThreadUtils.strLockInfo(lockInfo));
+        }
+
+        /**
+         * Check that given MonitorInfo matches given lock object and method name.
+         *
+         * @param monitorInfo monitor info
+         * @param lock lock object
+         * @param methodName method name
+         */
+        protected void checkMonitorInfo(MonitorInfo monitorInfo, Object lock, String methodName) {
+                checkLockInfo(monitorInfo, lock);
+                StackTraceElement element = monitorInfo.getLockedStackFrame();
+                String expectedMethodName = element.getClassName() + '.' + element.getMethodName();
+                verify(expectedMethodName.equals(methodName), "Unexpected method name in " + ThreadUtils.strMonitorInfo(monitorInfo) + " expected: " + methodName);
+        }
+
+        /**
+         * Check that monitor info for all given method names and locks is present.
+         *
+         * @param monitorInfo array of monitor info to check
+         * @param lockMap map with method names as keys and locks as values
+         */
+        protected void checkMonitorInfo(MonitorInfo[] monitorInfos, Map<String, Object[]> lockMap) {
+                try {
+                        if (lockMap == null || !lockedMonitorsAvailable) {
+                                verify(monitorInfos.length == 0, "Unexpected MonitorInfo[] objects: " + ThreadUtils.strMonitorInfoArr(monitorInfos));
+                        } else {
+                                int n = 0;
+                                // Check that each entry in the map has corresponding monitorInfo
+                                for (Map.Entry<String, Object[]> entry : lockMap.entrySet()) {
+                                        String methodName = entry.getKey();
+                                        Object[] locks = entry.getValue();
+                                        n += locks.length;
+                                        for (Object lock : locks)
+                                                checkMonitorInfo(monitorInfos, methodName, lock);
+                                }
+                                // Check that each monitorInfo entry corresponds to entry in lockMap
+                                for (MonitorInfo monitorInfo : monitorInfos) {
+                                        StackTraceElement element = monitorInfo.getLockedStackFrame();
+                                        if (element == null)
+                                                continue;
+                                        Object[] locks = lockMap.get(element.getMethodName());
+                                        checkMonitorInfo(monitorInfo, element.getMethodName(), locks);
+                                }
+                                verify(n == monitorInfos.length, "Unexpected monitor info array length: " + monitorInfos.length + " expected: " + n);
+                        }
+                } catch (TestFailure t) {
+                        log.info("Expected monitor info for locks:");
+                        for (Map.Entry<String, Object[]> entry : lockMap.entrySet()) {
+                                for (Object lock : entry.getValue()) {
+                                        String s = "";
+                                        s +=  "methodName: " + entry.getKey();
+                                        s += " className: " + lock.getClass().getName();
+                                        s += " identityHashCode: " + System.identityHashCode(lock);
+                                        log.info(s);
+                                }
+                        }
+                        throw t;
+                }
+        }
+
+        /**
+         * Check that monitor info for given method name and lock is present.
+         *
+         * @param monitorInfos monitor info array
+         * @param methodName method name
+         * @param lock lock object
+         */
+        protected void checkMonitorInfo(MonitorInfo[] monitorInfos, String methodName, Object lock) {
+                String className = lock.getClass().getName();
+                int hashCode = System.identityHashCode(lock);
+                for (MonitorInfo monitorInfo : monitorInfos) {
+                        if (className.equals(monitorInfo.getClassName()) &&
+                            hashCode == monitorInfo.getIdentityHashCode()) {
+                                if (monitorInfo.getLockedStackFrame() == null)
+                                        return;
+                                verify(methodName.equals(monitorInfo.getLockedStackFrame().getMethodName()), "Invalid method name: " + monitorInfo.getLockedStackFrame().getMethodName() + " expected: " + methodName);
+                                return;
+                        }
+                }
+                throw new TestFailure("Expected monitor not found: methodName: " + methodName + " lock: " + lock);
+        }
+
+        /**
+         * Check that monitor info for given method name corresponds to one of locks.
+         *
+         * @param monitorInfo monitor info
+         * @param methodName method name
+         * @param locks lock array
+         */
+        protected void checkMonitorInfo(MonitorInfo monitorInfo, String methodName, Object[] locks) {
+                for (Object lock : locks) {
+                        String className = lock.getClass().getName();
+                        int hashCode = System.identityHashCode(lock);
+                        if (className.equals(monitorInfo.getClassName()) &&
+                            hashCode == monitorInfo.getIdentityHashCode() &&
+                            methodName.equals(monitorInfo.getLockedStackFrame().getMethodName()))
+                                return;
+                }
+                throw new TestFailure("Lock for MonitorInfo not found: " + ThreadUtils.strMonitorInfo(monitorInfo));
+        }
+
+        /**
+         * Check that lock info corresponds to given locks.
+         *
+         * We can only check number of items here.
+         *
+         * @param lockInfos lock info array
+         * @param lockMap lock map
+         */
+        protected void checkSynchronizers(LockInfo[] lockInfos, Map<String, Lock[]> lockMap) {
+                if (lockMap == null || !lockedSynchronizersAvailable)
+                        verify(lockInfos.length == 0, "Unexpected LockInfo[] objects: " + ThreadUtils.strLockInfoArr(lockInfos));
+                else {
+                        // Only check length
+                        int n = 0;
+                        for (Map.Entry<String, Lock[]> entry : lockMap.entrySet()) {
+                                Lock[] locks = entry.getValue();
+                                n += locks.length;
+                        }
+                        verify(lockInfos.length == n, "Unexpected LockInfo[] length: " + lockInfos.length + " expected: " + n);
+                }
+        }
+
+        /**
+         * Obtain full method name for given stack trace element.
+         *
+         * @param element stack trace element
+         * @return full method name, i.e. className.methodName
+         */
+        protected String getMethodName(StackTraceElement element) {
+                return element.getClassName() + '.' + element.getMethodName();
+        }
+
+        /**
+         * Verify condition and throw TestFailure if it does not hold.
+         *
+         * @param condition boolean condition
+         * @param message TestFailure message
+         */
+        protected void verify(boolean condition, String message) {
+                if (!condition)
+                        throw new TestFailure(message + " in: " + this);
+        }
+
+        public final void setLog(Log log) {
+                this.log = log;
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/ThreadMonitoringScenarioFactory.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package nsk.monitoring.share.thread;
+
+/**
+ * ThreadMonitoringScenarioFactory is factory for creating ThreadMonitoringScenario's.
+ */
+public interface ThreadMonitoringScenarioFactory {
+        /**
+         * Obtain recommended scenario count for given basic threads count
+         * (which is usually number of processors).
+         *
+         * @param basicCount
+         */
+        public int getScenarioCount(int basicThreadCount);
+
+        /**
+         * Create scenarios for given scenario count.
+         *
+         * @param count scenario count
+         * @return array of scenarios
+         */
+        public ThreadMonitoringScenario[] createScenarios(int count);
+
+        /**
+         * Create scenario by type name.
+         *
+         * @param scenarioType type of scenario
+         * @return created scenario
+         */
+        public ThreadMonitoringScenario createScenario(String scenarioType);
+
+        /**
+         * Clean up resources held by created scenarios. This should be called
+         * after finish() is also called for all created scenarios.
+         */
+        public void finish();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/ThreadUtils.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,264 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.share.thread;
+
+import nsk.share.log.Log;
+import nsk.share.TestFailure;
+import java.lang.management.LockInfo;
+import java.lang.management.MonitorInfo;
+import java.lang.management.ThreadInfo;
+
+public final class ThreadUtils {
+        private ThreadUtils() {
+        }
+
+        /**
+         * Obtain human readable string representation of lock info.
+         *
+         * @param info lock ingo
+         * @return string representation of info
+         */
+        public static String strLockInfo(LockInfo info) {
+                if (info == null)
+                        return "LockInfo: " + null;
+                else
+                        return "LockInfo: className: " + info.getClassName() + " identityHashCode: " + info.getIdentityHashCode();
+        }
+
+        /**
+         * Obtain human readable string representation of monitor info.
+         *
+         * @param info monitor info
+         * @return string representation of info
+         */
+        public static String strMonitorInfo(MonitorInfo info) {
+                if (info == null)
+                        return "MonitorInfo: null";
+                else
+                        return "MonitorInfo: lockedStackDepth: " + info.getLockedStackDepth() + " lockedStackFrame: " + info.getLockedStackFrame() + strLockInfo(info);
+        }
+
+
+        /**
+         * Obtain human readable string representation of array of lock info.
+         *
+         * @param infos array of lock info
+         * @return string representation of infos
+         */
+        public static String strLockInfoArr(LockInfo[] infos) {
+                String s = "";
+                for (LockInfo info : infos)
+                        s += strLockInfo(info) + " ";
+                return s;
+        }
+
+        /**
+         * Obtain human readable string representation of array of monitor info.
+         *
+         * @param infos array of monitor info
+         * @return string representation of infos
+         */
+        public static String strMonitorInfoArr(MonitorInfo[] infos) {
+                String s = "";
+                for (MonitorInfo info : infos)
+                        s += strMonitorInfo(info) + " ";
+                return s;
+        }
+
+        /**
+         * Print monitor information.
+         *
+         * @param log log
+         * @param monitorInfo monitor info
+         */
+        public static void printMonitorInfo(Log log, MonitorInfo monitorInfo) {
+                log.info(strMonitorInfo(monitorInfo));
+        }
+
+        /**
+         * Print monitor information array.
+         *
+         * @param log log
+         * @param monitorInfos array of monitor info
+         */
+        public static void printMonitorInfo(Log log, MonitorInfo[] monitorInfos) {
+                for (MonitorInfo monitorInfo : monitorInfos)
+                        printMonitorInfo(log, monitorInfo);
+        }
+
+        /**
+         * Print lock information.
+         *
+         * @param log log
+         * @param lockInfo lock info
+         */
+        public static void printLockInfo(Log log, LockInfo lockInfo) {
+                log.info(strLockInfo(lockInfo));
+        }
+
+        /**
+         * Print lock information array.
+         *
+         * @param log log
+         * @param lockInfo array of lock info
+         */
+        public static void printLockInfo(Log log, LockInfo[] lockInfos) {
+                for (LockInfo lockInfo : lockInfos)
+                        printLockInfo(log, lockInfo);
+        }
+
+        public static final String INDENT = "   ";
+
+        /**
+         * Print all thread information for given ThreadInfo.
+         *
+         * @param log log
+         * @param ti thread info
+         */
+        public static void threadInfo(Log log, ThreadInfo info) {
+                //log.info("Thread info: thread " + info.getThreadId() + " " + info.getThreadName() " state: " + info.getThreadState());
+                threadDump(log, info);
+                log.info("Blocked count: " + info.getBlockedCount() + " time: " + info.getBlockedTime());
+                log.info("Waited count: " + info.getWaitedCount() + " time: " + info.getWaitedTime());
+                LockInfo lockInfo = info.getLockInfo();
+                log.info("Lock: " + strLockInfo(lockInfo));
+                log.info("Lock name: " + info.getLockName() + " ownerId: " + info.getLockOwnerId() + " ownerName: " + info.getLockOwnerName());
+                MonitorInfo[] monitorInfo = info.getLockedMonitors();
+                log.info("Locked monitors: total " + monitorInfo.length);
+                printMonitorInfo(log, info.getLockedMonitors());
+                LockInfo[] lockInfos = info.getLockedSynchronizers();
+                log.info("Locked synchronizers: total " + lockInfos.length);
+                printLockInfo(log, lockInfos);
+        }
+
+        /**
+         * Print thread dump information for given ThreadInfo.
+         *
+         * @param log log
+         * @param ti thread info
+         */
+        public static void threadDump(Log log, ThreadInfo ti) {
+                String s = "";
+                s += "\"";
+                s += ti.getThreadName();
+                s += "\"";
+                s += " Id=" + ti.getThreadId();
+                s += " in " + ti.getThreadState();
+                if (ti.getLockName() != null) {
+                        s += " on lock=" + ti.getLockName();
+                }
+                if (ti.isSuspended()) {
+                        s += " (suspended)";
+                }
+                if (ti.isInNative()) {
+                        s += " (running in native)";
+                }
+                if (ti.getLockOwnerName() != null)
+                        s += " owned by " + ti.getLockOwnerName() + " Id=" + ti.getLockOwnerId();
+                log.info(s);
+                printStackTrace(log, ti);
+        }
+
+        /**
+         * Print stack trace information.
+         *
+         * @param log log
+         * @param ti thread info
+         */
+        public static void printStackTrace(Log log, ThreadInfo ti) {
+                StackTraceElement[] stacktrace = ti.getStackTrace();
+                MonitorInfo[] monitors = ti.getLockedMonitors();
+                for (int i = 0; i < stacktrace.length; i++) {
+                        StackTraceElement ste = stacktrace[i];
+                        log.info(INDENT + "at " + ste.toString());
+
+                        for (MonitorInfo mi : monitors) {
+                                if (mi.getLockedStackDepth() == i) {
+                                        log.info(INDENT + "  - locked " + mi);
+                                }
+                        }
+                }
+                System.out.println();
+
+        }
+
+        /**
+         * Dump information about threads.
+         *
+         * @param log log
+         * @param tinfos array of thread information
+         */
+        public static void threadDump(Log log, ThreadInfo[] tinfos) {
+                log.info("Java thread dump");
+                for (ThreadInfo ti : tinfos) {
+                        threadDump(log, ti);
+                        LockInfo[] syncs = ti.getLockedSynchronizers();
+                        printLockInfo(log, syncs);
+                }
+        }
+
+        public final static int waitThreadStateRetries = 10;
+        public final static long waitThreadStateSleepTime = 100;
+
+        public static void waitThreadState(Thread thread, Thread.State state) {
+                int retries = 0;
+                long ctime = System.currentTimeMillis();
+                while (thread.getState() != state) {
+                        if (retries++ > waitThreadStateRetries)
+                                throw new TestFailure("Thread " + thread + " with current state " + thread.getState() + " did not reach state " + state + " with number of  retries: " + retries + ", time: " + (System.currentTimeMillis() - ctime));
+                        try {
+                                Thread.sleep(waitThreadStateSleepTime);
+                        } catch (InterruptedException e) {
+                        }
+                }
+        }
+
+        /**
+         * Verify condition and throw TestFailure if it does not hold.
+         *
+         * @param condition boolean condition
+         * @param message TestFailure message
+         */
+        public static void verify(boolean condition, String message) {
+                if (!condition)
+                        throw new TestFailure(message);
+        }
+
+        /**
+         * Obtain human readable string representation of array of thread ids.
+         *
+         * @param ids array of ids
+         * @return string representation of ids
+         */
+        public static String strIds(long[] ids) {
+                if (ids == null)
+                        return null;
+                String s = "";
+                for (int i = 0; i < ids.length; ++i) {
+                        s += ids[i];
+                        s += ' ';
+                }
+                return s;
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/TimedWaitingThread.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package nsk.monitoring.share.thread;
+
+import nsk.share.log.Log;
+import java.lang.management.ThreadInfo;
+import java.lang.management.MonitorInfo;
+import java.lang.management.LockInfo;
+import nsk.share.test.LocalRandom;
+import nsk.share.TestBug;
+
+/**
+ * TimedWaitingThread is RecursiveMonitoringThread that is waiting on a lock.
+ */
+public class TimedWaitingThread extends RecursiveMonitoringThread {
+        private String lock = new String("a lock");
+        private volatile boolean ready = false;
+        private Object readyLock = new Object();
+        private int count = LocalRandom.nextInt(100) + 1;
+        private volatile int n = 0;
+        private static final String[] expectedMethods = {
+                "java.lang.Object.wait",
+                "nsk.monitoring.share.thread.TimedWaitingThread.runInside"
+        };
+
+        public TimedWaitingThread(Log log, RunType recursionType, int maxDepth) {
+                super(log, recursionType, maxDepth);
+        }
+
+        public void checkThreadInfo(ThreadInfo info) {
+                super.checkThreadInfo(info);
+                verify(info.getThreadState() == Thread.State.TIMED_WAITING, "ThreadInfo.getThreadState() = " + info.getThreadState() + " != " + Thread.State.TIMED_WAITING);
+                //verify(info.getBlockedTime() == 0 || info.getBlockedTime() == -1, "ThreadInfo.getBlockedTime() == " + info.getBlockedTime());
+                //verify(info.getBlockedCount() == count, "ThreadInfo.getBlockedCount() = " + info.getBlockedCount() + " != " + count);
+                verify(info.getWaitedTime() == 0 || info.getWaitedTime() == -1, "ThreadInfo.getWaitedTime() == " + info.getWaitedTime());
+                verify(info.getWaitedCount() == count + 1, "ThreadInfo.getWaitedCount() = " + info.getWaitedCount() + " != " + (count + 1));
+                checkLockInfo(info.getLockInfo());
+                verify(info.getLockName().equals(info.getLockInfo().toString()), "ThreadInfo.getLockName() = " + info.getLockName() + " != ThreadInfo.getLockInfo().toString() = " + info.getLockInfo().toString());
+                verify(info.getLockOwnerId() == -1, "ThreadInfo.getLockOwnerId() = " + info.getLockOwnerId() + " != -1");
+                verify(info.getLockOwnerName() == null, "ThreadInfo.getLockOwnerName() = " + info.getLockOwnerName() + " != null");
+                checkMonitorInfo(info.getLockedMonitors(), null);
+                checkSynchronizers(info.getLockedSynchronizers(), null);
+        }
+
+        private void checkLockInfo(LockInfo lockInfo) {
+                verify(lockInfo.getClassName().equals(lock.getClass().getName()), "LockInfo.getClassName() = " + lockInfo.getClassName() + " differs from lock.getClass().getName() = " + lock.getClass().getName());
+                verify(lockInfo.getIdentityHashCode() == System.identityHashCode(lock), "LockInfo.getIdentityHashCode() = " + lockInfo.getIdentityHashCode() + " differs from System.identityHashCode(lock) = " + System.identityHashCode(lock));
+                String expectedToString = lock.getClass().getName() + '@' + Integer.toHexString(System.identityHashCode(lock));
+                verify(lockInfo.toString().equals(expectedToString), "LockInfo.toString() = " + lockInfo.toString() + " differs from expected toString() = " + expectedToString);
+        }
+
+        public void waitState() {
+                synchronized (readyLock) {
+                        while (!ready) {
+                                try {
+                                        readyLock.wait();
+                                } catch (InterruptedException e) {
+                                        log.warn(e);
+                                }
+                        }
+                }
+                waitThreadState(Thread.State.TIMED_WAITING);
+        }
+
+        public void finish() {
+                ready = false;
+                synchronized (lock) {
+                        lock.notify();
+                }
+        }
+
+        protected void runInside() {
+                synchronized (lock) {
+                        do {
+                                try {
+                                        for (int i = 0; i < count; ++i)
+                                                lock.wait(1);
+                                        synchronized (readyLock) {
+                                                ready = true;
+                                                readyLock.notifyAll();
+                                        }
+                                        lock.wait(10000000);
+                                } catch (InterruptedException e) {
+                                        throw new TestBug(e);
+                                }
+                        } while (ready);
+                }
+        }
+
+        protected boolean isStackTraceElementExpected(StackTraceElement element) {
+                return super.isStackTraceElementExpected(element) || checkStackTraceElement(element, expectedMethods);
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/WaitingThread.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package nsk.monitoring.share.thread;
+
+import nsk.share.log.Log;
+import java.lang.management.ThreadInfo;
+import java.lang.management.MonitorInfo;
+import java.lang.management.LockInfo;
+
+/**
+ * WaitingThread is RecursiveMonitoringThread that is waiting on a lock.
+ */
+public class WaitingThread extends RecursiveMonitoringThread {
+        private String lock = new String("a lock");
+        private volatile boolean ready = false;
+        private Object readyLock = new Object();
+        private static final String[] expectedMethods = {
+                "nsk.monitoring.share.thread.WaitingThread.runInside",
+                "java.lang.Object.wait"
+        };
+
+        public WaitingThread(Log log, RunType recursionType, int maxDepth) {
+                super(log, recursionType, maxDepth);
+        }
+
+        public void checkThreadInfo(ThreadInfo info) {
+                super.checkThreadInfo(info);
+                verify(info.getThreadState() == Thread.State.WAITING, "ThreadInfo.getThreadState() = " + info.getThreadState() + " != " + Thread.State.WAITING);
+                verify(info.getBlockedTime() == 0 || info.getBlockedTime() == -1, "ThreadInfo.getBlockedTime() == " + info.getBlockedTime());
+                verify(info.getBlockedCount() >= 0, "ThreadInfo.getBlockedCount() = " + info.getBlockedCount() + " != 1");
+                verify(info.getWaitedTime() > 0 || info.getWaitedTime() == -1, "ThreadInfo.getWaitedTime() == " + info.getWaitedTime());
+                verify(info.getWaitedCount() == 1, "ThreadInfo.getWaitedCount() = " + info.getWaitedCount() + " != 1");
+                checkLockInfo(info.getLockInfo());
+                verify(info.getLockName().equals(info.getLockInfo().toString()), "ThreadInfo.getLockName() = " + info.getLockName() + " != ThreadInfo.getLockInfo().toString() = " + info.getLockInfo().toString());
+                verify(info.getLockOwnerId() == -1, "ThreadInfo.getLockOwnerId() = " + info.getLockOwnerId() + " != -1");
+                verify(info.getLockOwnerName() == null , "ThreadInfo.getLockOwnerName() = " + info.getLockOwnerName() + " != null");
+                checkMonitorInfo(info.getLockedMonitors(), null);
+                checkSynchronizers(info.getLockedSynchronizers(), null);
+        }
+
+        private void checkLockInfo(LockInfo lockInfo) {
+                verify(lockInfo.getClassName().equals(lock.getClass().getName()), "LockInfo.getClassName() = " + lockInfo.getClassName() + " differs from lock.getClass().getName() = " + lock.getClass().getName());
+                verify(lockInfo.getIdentityHashCode() == System.identityHashCode(lock), "LockInfo.getIdentityHashCode() = " + lockInfo.getIdentityHashCode() + " differs from System.identityHashCode(lock) = " + System.identityHashCode(lock));
+                String expectedToString = lock.getClass().getName() + '@' + Integer.toHexString(System.identityHashCode(lock));
+                verify(lockInfo.toString().equals(expectedToString), "LockInfo.toString() = " + lockInfo.toString() + " differs from expected toString() = " + expectedToString);
+        }
+
+        public void waitState() {
+                synchronized (readyLock) {
+                        while (!ready) {
+                                try {
+                                        readyLock.wait();
+                                } catch (InterruptedException e) {
+                                        log.warn(e);
+                                }
+                        }
+                }
+                waitThreadState(Thread.State.WAITING);
+        }
+
+        public void finish() {
+                ready = false;
+                synchronized (lock) {
+                        lock.notifyAll();
+                }
+        }
+
+        protected void runInside() {
+                synchronized (readyLock) {
+                        ready = true;
+                        readyLock.notifyAll();
+                }
+                while (ready) {
+                        synchronized (lock) {
+                                try {
+                                        lock.wait();
+                                } catch (InterruptedException e) {
+                                        log.warn(e);
+                                }
+                        }
+                }
+        }
+
+        protected boolean isStackTraceElementExpected(StackTraceElement element) {
+                return super.isStackTraceElementExpected(element) || checkStackTraceElement(element, expectedMethods);
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/libDeadlock.c	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include "Deadlock.c"
+#include "jni_tools.c"
+#include "nsk_tools.c"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/libLockingThreads.c	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include "LockingThreads.c"
+#include "jni_tools.c"
+#include "nsk_tools.c"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/libNativeBlockedThread.c	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include <jni.h>
+
+/*
+ * Class:     nsk_monitoring_share_thread_NativeBlockedThread
+ * Method:    nativeBlock
+ * Signature: (Ljava/lang/Object;)V
+ */
+JNIEXPORT void JNICALL Java_nsk_monitoring_share_thread_NativeBlockedThread_nativeBlock
+(JNIEnv *env, jobject this, jobject lock) {
+        if ((*env)->MonitorEnter(env, lock) != JNI_OK) {
+                (*env)->FatalError(env, "MonitorEnter call failed");
+        }
+        (*env)->MonitorExit(env, lock);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/libRecursiveMonitoringThread.c	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include "RecursiveMonitoringThread.c"
+#include "jni_tools.c"
+#include "nsk_tools.c"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/GenClassesBuilder.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.stress.classload;
+
+import jdk.test.lib.JDKToolLauncher;
+import jdk.test.lib.Utils;
+import jdk.test.lib.process.ProcessTools;
+import nsk.monitoring.share.Generator;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.stream.Stream;
+
+public class GenClassesBuilder {
+    public static void main(String[] args) {
+        Path srcDst = Paths.get(
+                "genSrc",
+                "nsk",
+                "monitoring",
+                "share",
+                "newclass").toAbsolutePath();
+        Path classesDir = Paths.get("classes").toAbsolutePath();
+        generateSource(srcDst);
+        compileSource(srcDst, classesDir);
+    }
+
+    private static void compileSource(Path srcDst, Path classesDir) {
+        JDKToolLauncher javac = JDKToolLauncher.create("javac")
+                                               .addToolArg("-d")
+                                               .addToolArg(classesDir.toString())
+                                               .addToolArg("-cp")
+                                               .addToolArg(Utils.TEST_CLASS_PATH);
+        try (Stream<Path> stream = Files.walk(srcDst)) {
+            stream.map(Path::toAbsolutePath)
+                  .map(Path::toString)
+                  .filter(s -> s.endsWith(".java"))
+                  .forEach(javac::addToolArg);
+        } catch (IOException e) {
+            throw new Error("traverse source dir " + srcDst, e);
+        }
+        String[] command = javac.getCommand();
+        try {
+            ProcessTools.executeCommand(command)
+                        .shouldHaveExitValue(0);
+        } catch (Error | RuntimeException e) {
+            throw e;
+        } catch (Throwable e) {
+            throw new Error("execution of javac(" + Arrays.toString(command) + ") failed", e);
+        }
+    }
+
+    private static void generateSource(Path dir) {
+        try {
+            Files.createDirectories(dir);
+        } catch (IOException e) {
+            throw new Error("can't create dirs for" + dir, e);
+        }
+        Path pattern = testRoot().resolve("vmTestbase")
+                                 .resolve("nsk")
+                                 .resolve("monitoring")
+                                 .resolve("share")
+                                 .resolve("LoadableClass.pattern")
+                                 .toAbsolutePath();
+        if (Files.notExists(pattern)) {
+            throw new Error("can't find pattern file: " + pattern);
+        }
+        try {
+            Generator.main(new String[]{pattern.toString(), dir.toString()});
+        } catch (Exception e) {
+            throw new Error("can't generate classes", e);
+        }
+    }
+
+    private static Path testRoot() {
+        Path p = Paths.get(Utils.TEST_SRC);
+        while (!Files.exists(p.resolve("TEST.ROOT"))) {
+            p = p.getParent();
+        }
+        return p;
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,193 @@
+/*
+ * Copyright (c) 2003, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.stress.classload;
+
+import java.io.*;
+import java.util.*;
+import java.lang.management.*;
+
+import nsk.share.log.Log;
+import nsk.share.test.*;
+import nsk.share.Consts;
+import nsk.monitoring.share.*;
+
+/**
+ * The test checks up <code>getAllClasses()</code>,
+ * <code>getLoadedClassCount()</code>, <code>getTotalLoadedClassCount()</code>,
+ * <code>getUnloadedClassCount()</code> methods after loading classes for
+ * specified parameters such as:
+ * <ul>
+ *      <li>
+ *          <code>${COMMON_CLASSES_LOCATION}/newclass</code> - path that
+ *          contains precompiled loadable classes for which class loading is
+ *          performed. The newclass path should not be included into
+ *          <code>CLASSPATH</code> to avoid spontaneous loading of these
+ *          classes.
+ *      <li>
+ *          <code>loadedClassCount</code> - number of loadable classes.
+ *      <li>
+ *          <code>loaderCount</code> - number of class loaders.
+ * </ul>
+ *
+ * <p>The other parameters which may have an influence on running test are:
+ * <ul>
+ *      <li>
+ *          <code>testMode</code> defines an execution mode either for
+ *          the <code>ClassLoadingMBean</code> interface or for the
+ *          <code>ClassLoadingMetrics</code> interface.
+ *      <li>
+ *          <code>MBeanServer</code> defines a MBean server implemetation
+ *          under which test is executed.
+ *      <li>
+ *          <code>singleClassloaderClass</code> specifies whether class loaders
+ *          are instances of the same class.
+ * </ul>
+ * For details about arguments, see the {@link
+ * nsk.monitoring.share.ArgumentHamdler ArgumentHamdler} description .
+ *
+ * <p>The test makes an initial snapshot of class loading metrics and loads
+ * classes according to specified parameters. After classes have been loaded,
+ * the test makes snapshot of class loading metrics again and compare them
+ * with initial values.
+ *
+ * <p>It is expected that <code>getLoadedClassCount()</code> and
+ * <code>getTotalLoadedClassCount()</code> must be increased by
+ * <code>loadedClassCount * loaderCount</code> after loading.
+ *
+ * <p>The test also fails if a list returned by <code>getAllClasses()</code>
+ * does not contain any pair of names (loadable class name, class loader name)
+ * or size of this list is not equal to <code>getLoadedClassCount()</code>.
+ *
+ */
+public class load001 extends MonitoringTestBase implements Initializable {
+        private ClassLoadingMXBean classLoading;
+        private ClassLoadingController controller;
+        private long currentlyLoadedClassCount = 0;
+        private long initialClassCount;
+        private long initialTotalClassCount;
+        private long initialUnloadedClassCount;
+        private int loadedClassCount;
+        private int loaderCount;
+        private final String ERR = "Unexpected value:: ";
+
+        Stresser stresser;
+
+        public load001(Stresser stresser) {
+            this.stresser = stresser;
+        }
+
+        public void initialize() {
+                argHandler.dump(log);
+                classLoading = monitoringFactory.getClassLoadingMXBean();
+        }
+
+        public void run() {
+                boolean result = true;
+                loadedClassCount = argHandler.getLoadableClassesCount();
+                loaderCount = argHandler.getLoadersCount();
+
+                stresser.start(loaderCount);
+                controller = new ClassLoadingController(log, argHandler, stresser);
+
+                //extra request for metrics to exclude undesirable class loading
+                //during test execution.
+                initialClassCount = classLoading.getLoadedClassCount();
+                initialTotalClassCount = classLoading.getTotalLoadedClassCount();
+                initialUnloadedClassCount = classLoading.getUnloadedClassCount();
+
+                log.info("\nTEST STARTED");
+                initialClassCount = classLoading.getLoadedClassCount();
+                initialTotalClassCount = classLoading.getTotalLoadedClassCount();
+                initialUnloadedClassCount = classLoading.getUnloadedClassCount();
+
+                log.info("\nInitial values:");
+                log.info("---------------");
+                showValues(initialClassCount, initialTotalClassCount,
+                                initialUnloadedClassCount);
+
+                log.info("\nclass loading...");
+                currentlyLoadedClassCount = controller.loadClasses();
+                if (currentlyLoadedClassCount == 0) {
+                        result = false;
+                }
+
+                long classCount = classLoading.getLoadedClassCount();
+                long totalClassCount = classLoading.getTotalLoadedClassCount();
+                long unloadedClassCount = classLoading.getUnloadedClassCount();
+
+                log.info("\nAmount of currently loaded classes:");
+                log.info("-----------------------------------");
+                showValues(classCount, totalClassCount, unloadedClassCount);
+
+                log.info("\nchecking loaded classes...");
+                result = result & checkValues(classCount,  totalClassCount, unloadedClassCount);
+
+                if (result)
+                        log.info("\nTest PASSED");
+                else {
+                        log.info("\nTest FAILED");
+                        setFailed(true);
+                }
+        }
+
+        private void showValues(long classCount,  long totalClassCount, long unloadedClassCount) {
+                log.info("\ttotal loaded class count = " + totalClassCount);
+                log.info("\tcurrently loaded class count = " + classCount);
+                log.info("\tunloaded class count = " + unloadedClassCount);
+        }
+
+        private boolean checkValues(long classCount, long totalClassCount, long unloadedClassCount) {
+                boolean res = true;
+
+                long expectedValue = initialTotalClassCount + currentlyLoadedClassCount;
+                if (totalClassCount < expectedValue) {
+                        log.error(ERR + "total loaded class count=" + totalClassCount
+                                        + " Expected value: "
+                                        + expectedValue);
+                        res = false;
+                }
+
+                expectedValue = initialClassCount + currentlyLoadedClassCount;
+                if (classCount < expectedValue) {
+                        log.error(ERR + "loaded class count=" + classCount
+                                        + " Expected value: "
+                                        + expectedValue);
+                        res = false;
+                }
+
+                expectedValue = classCount + unloadedClassCount;
+                if (totalClassCount != expectedValue) {
+                        log.error(ERR + "total loaded class count=" + totalClassCount
+                                        + " Expected value(classCount + unloadedClassCount): "
+                                        + expectedValue);
+                        res = false;
+                }
+
+                return res;
+        }
+
+        public static void main(String[] args) {
+                Monitoring.runTest(new load001(new Stresser(args)), args);
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load001/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/classload/load001.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks up getAllClasses(), getLoadedClassCount(),
+ *     getTotalLoadedClassCount(), getUnloadedClassCount() methods when one
+ *     class is loaded by 100 loaders, which are the instances of two
+ *     ClassLoader classes.
+ *     Access to the management metrics is accomplished by directly calling
+ *     the methods in the MBean.
+ * COMMENTS
+ *     Fixed the bug
+ *     4976274 Regression: "OutOfMemoryError: Java heap space" when -XX:+UseParallelGC
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @comment generate and compile LoadableClassXXX classes
+ * @run driver nsk.monitoring.stress.classload.GenClassesBuilder
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.classload.load001
+ *      classes
+ *      -loadableClassCount=1
+ *      -loadersCount=100
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load002/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/classload/load002.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks up getAllClasses(), getLoadedClassCount(),
+ *     getTotalLoadedClassCount(), getUnloadedClassCount() methods when one
+ *     class is loaded by 100 loaders, which are the instances of two
+ *     ClassLoader class.
+ *     Access to the management metrics is accomplished through the MBeanServer.
+ *     Executable class of the test is the same as for the load001 test.
+ *     In contrast to the load001 test, the load002 test is performed for
+ *     the ClassLoadingMBean interface under DEFAULT implementation of
+ *     MBean server.
+ * COMMENTS
+ *     Fixed the bug
+ *     4976274 Regression: "OutOfMemoryError: Java heap space" when -XX:+UseParallelGC
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @comment generate and compile LoadableClassXXX classes
+ * @run driver nsk.monitoring.stress.classload.GenClassesBuilder
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.classload.load001
+ *      classes
+ *      -testMode=server
+ *      -loadableClassCount=1
+ *      -loadersCount=100
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load003/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/classload/load003.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks up getAllClasses(), getLoadedClassCount(),
+ *     getTotalLoadedClassCount(), getUnloadedClassCount() methods when one
+ *     class is loaded by 100 loaders, which are the instances of two
+ *     ClassLoader class.
+ *     Access to the management metrics is accomplished through the MBeanServer.
+ *     Executable class of the test is the same as for the load001 test.
+ *     In contrast to the load001 test, the load003 test is performed for
+ *     the ClassLoadingMBean interface under CUSTOM implementation of
+ *     MBean server.
+ * COMMENTS
+ *     Fixed the bug
+ *     4976274 Regression: "OutOfMemoryError: Java heap space" when -XX:+UseParallelGC
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @comment generate and compile LoadableClassXXX classes
+ * @run driver nsk.monitoring.stress.classload.GenClassesBuilder
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.classload.load001
+ *      classes
+ *      -testMode=server
+ *      -MBeanServer=custom
+ *      -loadableClassCount=1
+ *      -loadersCount=100
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load004/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/classload/load004.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks up getAllClasses(), getLoadedClassCount(),
+ *     getTotalLoadedClassCount(), getUnloadedClassCount() methods when one
+ *     class is loaded by 100 loaders, which are the instances of the same
+ *     custom ClassLoader class.
+ *     Access to the management metrics is accomplished by directly calling
+ *     the methods in the MBean.
+ *     Executable class of the test is the same as for the load001 test.
+ *     In contrast to the load001 test, the load004 test is performed for
+ *     the case when class loaders are the instances of the same custom
+ *     ClassLoader class.
+ * COMMENTS
+ *     Fixed the bug
+ *     4976274 Regression: "OutOfMemoryError: Java heap space" when -XX:+UseParallelGC
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @comment generate and compile LoadableClassXXX classes
+ * @run driver nsk.monitoring.stress.classload.GenClassesBuilder
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.classload.load001
+ *      classes
+ *      -singleClassloaderClass
+ *      -loadableClassCount=1
+ *      -loadersCount=100
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load005/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/classload/load005.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks up getAllClasses(), getLoadedClassCount(),
+ *     getTotalLoadedClassCount(), getUnloadedClassCount() methods when one
+ *     class is loaded by 100 loaders, which are the instances of the same
+ *     custom ClassLoader class.
+ *     Access to the management metrics is accomplished through the MBeanServer.
+ *     The load005 test is performed for the ClassLoadingMBean interface under
+ *     DEFAULT implementation of MBean server.
+ * COMMENTS
+ *     Fixed the bug
+ *     4976274 Regression: "OutOfMemoryError: Java heap space" when -XX:+UseParallelGC
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @comment generate and compile LoadableClassXXX classes
+ * @run driver nsk.monitoring.stress.classload.GenClassesBuilder
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.classload.load001
+ *      classes
+ *      -testMode=server
+ *      -singleClassloaderClass
+ *      -loadableClassCount=1
+ *      -loadersCount=100
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load006/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load006/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/classload/load006.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks up getAllClasses(), getLoadedClassCount(),
+ *     getTotalLoadedClassCount(), getUnloadedClassCount() methods when one
+ *     class is loaded by 100 loaders, which are the instances of the same
+ *     custom ClassLoader class.
+ *     Access to the management metrics is accomplished through the MBeanServer.
+ *     The load005 test is performed for the ClassLoadingMBean interface under
+ *     CUSTOM implementation of MBean server.
+ * COMMENTS
+ *     Fixed the bug
+ *     4976274 Regression: "OutOfMemoryError: Java heap space" when -XX:+UseParallelGC
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @comment generate and compile LoadableClassXXX classes
+ * @run driver nsk.monitoring.stress.classload.GenClassesBuilder
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.classload.load001
+ *      classes
+ *      -testMode=server
+ *      -MBeanServer=custom
+ *      -singleClassloaderClass
+ *      -loadableClassCount=1
+ *      -loadersCount=100
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load007/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load007/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/classload/load007.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks up getAllClasses(), getLoadedClassCount(),
+ *     getTotalLoadedClassCount(), getUnloadedClassCount() methods when 100
+ *     classes are loaded by 100 loaders, which are the instances of two
+ *     custom ClassLoader classes.
+ *     Access to the management metrics is accomplished by directly calling
+ *     the methods in the MBean.
+ *     Executable class of the test is the same as for the load001 test.
+ *     In contrast to the load001 test, the load007 test is performed for
+ *     the case when 100 loaders execute loading.
+ * COMMENTS
+ *     Fixed the bug
+ *     4976274 Regression: "OutOfMemoryError: Java heap space" when -XX:+UseParallelGC
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @comment generate and compile LoadableClassXXX classes
+ * @run driver nsk.monitoring.stress.classload.GenClassesBuilder
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.classload.load001
+ *      classes
+ *      -loadableClassCount=100
+ *      -loadersCount=100
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load008/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load008/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/classload/load008.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks up getAllClasses(), getLoadedClassCount(),
+ *     getTotalLoadedClassCount(), getUnloadedClassCount() methods when 100
+ *     classes are loaded by 100 loaders, which are the instances of two
+ *     custom ClassLoader classes.
+ *     Access to the management metrics is accomplished through the MBeanServer.
+ *     The load008 test is performed for the ClassLoadingMBean interface under
+ *     DEFAULT implementation of MBean server.
+ * COMMENTS
+ *     Fixed the bug
+ *     4976274 Regression: "OutOfMemoryError: Java heap space" when -XX:+UseParallelGC
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @comment generate and compile LoadableClassXXX classes
+ * @run driver nsk.monitoring.stress.classload.GenClassesBuilder
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.classload.load001
+ *      classes
+ *      -testMode=server
+ *      -loadableClassCount=100
+ *      -loadersCount=100
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load009/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load009/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/classload/load009.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks up getAllClasses(), getLoadedClassCount(),
+ *     getTotalLoadedClassCount(), getUnloadedClassCount() methods when 100
+ *     classes are loaded by 100 loaders, which are the instances of two
+ *     custom ClassLoader classes.
+ *     Access to the management metrics is accomplished through the MBeanServer.
+ *     The load009 test is performed for the ClassLoadingMBean interface under
+ *     CUSTOM implementation of MBean server.
+ * COMMENTS
+ *     Fixed the bug
+ *     4976274 Regression: "OutOfMemoryError: Java heap space" when -XX:+UseParallelGC
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @comment generate and compile LoadableClassXXX classes
+ * @run driver nsk.monitoring.stress.classload.GenClassesBuilder
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.classload.load001
+ *      classes
+ *      -testMode=server
+ *      -MBeanServer=custom
+ *      -loadableClassCount=100
+ *      -loadersCount=100
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load010/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load010/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/classload/load010.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks up getAllClasses(), getLoadedClassCount(),
+ *     getTotalLoadedClassCount(), getUnloadedClassCount() methods when 100
+ *     classes are loaded by 100 loaders, which are the instances of the
+ *     same ClassLoader class.
+ *     Access to the management metrics is accomplished by directly calling
+ *     the methods in the MBean.
+ *     Executable class of the test is the same as for the load004 test.
+ *     In contrast to the load004 test, the load010 test is performed for
+ *     the case when 100 classes are loaded.
+ * COMMENTS
+ *     Fixed the bug
+ *     4976274 Regression: "OutOfMemoryError: Java heap space" when -XX:+UseParallelGC
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @comment generate and compile LoadableClassXXX classes
+ * @run driver nsk.monitoring.stress.classload.GenClassesBuilder
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.classload.load001
+ *      classes
+ *      -singleClassloaderClass
+ *      -loadableClassCount=100
+ *      -loadersCount=100
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load011/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load011/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/classload/load011.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks up getAllClasses(), getLoadedClassCount(),
+ *     getTotalLoadedClassCount(), getUnloadedClassCount() methods when 100
+ *     classes are loaded by 100 loaders, which are the instances of the
+ *     same ClassLoader class.
+ *     Access to the management metrics is accomplished through the MBeanServer.
+ *     The load011 test is performed for the ClassLoadingMBean interface under
+ *     DEFAULT implementation of MBean server.
+ * COMMENTS
+ *     Fixed the bug
+ *     4976274 Regression: "OutOfMemoryError: Java heap space" when -XX:+UseParallelGC
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @comment generate and compile LoadableClassXXX classes
+ * @run driver nsk.monitoring.stress.classload.GenClassesBuilder
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.classload.load001
+ *      classes
+ *      -testMode=server
+ *      -singleClassloaderClass
+ *      -loadableClassCount=100
+ *      -loadersCount=100
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load012/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/load012/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/classload/load012.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks up getAllClasses(), getLoadedClassCount(),
+ *     getTotalLoadedClassCount(), getUnloadedClassCount() methods when 100
+ *     classes are loaded by 100 loaders, which are the instances of the
+ *     same ClassLoader class.
+ *     Access to the management metrics is accomplished through the MBeanServer.
+ *     The load012 test is performed for the ClassLoadingMBean interface under
+ *     CUSTOM implementation of MBean server.
+ * COMMENTS
+ *     Fixed the bug
+ *     4976274 Regression: "OutOfMemoryError: Java heap space" when -XX:+UseParallelGC
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @comment generate and compile LoadableClassXXX classes
+ * @run driver nsk.monitoring.stress.classload.GenClassesBuilder
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.classload.load001
+ *      classes
+ *      -testMode=server
+ *      -MBeanServer=custom
+ *      -singleClassloaderClass
+ *      -loadableClassCount=100
+ *      -loadersCount=100
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) 2003, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.stress.classload;
+
+import java.io.*;
+import java.util.*;
+import java.lang.management.*;
+
+import nsk.share.test.*;
+import nsk.share.*;
+import nsk.monitoring.share.*;
+
+/**
+ * The test checks up <code>getAllClasses()</code>,
+ * <code>getLoadedClassCount()</code>, <code>getTotalLoadedClassCount()</code>,
+ * <code>getUnloadedClassCount()</code> methods after unloading classes for
+ * specified parameters such as:
+ * <ul>
+ *      <li>
+ *          <code>${COMMON_CLASSES_LOCATION}/newclass</code> - path that
+ *          contains precompiled loadable classes for which class
+ *          loading/unloading is performed. The newclass path should not be
+ *          included into <code>CLASSPATH</code> to avoid spontaneous loading
+ *          of these classes.
+ *      <li>
+ *          <code>loadedClassCount</code> - number of loadable classes.
+ *      <li>
+ *          <code>loaderCount</code> - number of class loaders.
+ * </ul>
+ *
+ * <p>The other parameters which may have an influence on running test are:
+ * <ul>
+ *      <li>
+ *          <code>testMode</code> defines an execution mode either for
+ *          the <code>ClassLoadingMBean</code> interface or for the
+ *          <code>ClassLoadingMetrics</code> interface.
+ *      <li>
+ *          <code>MBeanServer</code> defines a MBean server implemetation
+ *          under which test is executed.
+ *      <li>
+ *          <code>singleClassloaderClass</code> specifies whether class loaders
+ *          are instances of the same class.
+ * </ul>
+ * For details about arguments, see the {@link
+ * nsk.monitoring.share.ArgumentHamdler ArgumentHamdler} description .
+ *
+ * <p>The test loads classes according to specified parameters. After classes
+ * have been loaded, the test makes an initial snapshot of class loading metrics
+ * and tries to unload these classes. Then it makes snapshot of class loading
+ * metrics again and compare them with initial values.
+ *
+ * <p>It is expected that <code>getLoadedClassCount()</code> and
+ * <code>getTotalLoadedClassCount()</code> must be decreased by
+ * <code>loadedClassCount * loaderCount</code> after unloading.
+ *
+ * <p>The test also fails if a list returned by <code>getAllClasses()</code>
+ * contains any pair of names (loadable class name, class loader name) or size
+ * of this list is not equal to <code>getLoadedClassCount()</code>.
+ *
+ */
+public class unload001 extends MonitoringTestBase implements Initializable {
+        private ClassLoadingMXBean classLoading;
+        private ClassLoadingController controller;
+        private int loadedClassCount;
+        private int loaderCount;
+        private final String ERR = "Unexpected value:: ";
+        private long currentlyUnLoadedClassCount = 0;
+        private long initialClassCount;
+        private long initialTotalClassCount;
+        private long initialUnloadedClassCount;
+
+        private Stresser stresser;
+
+        public unload001(Stresser stresser) {
+            this.stresser = stresser;
+        }
+
+        public void initialize() {
+                argHandler.dump(log);
+                classLoading = monitoringFactory.getClassLoadingMXBean();
+        }
+
+        public void run() {
+                boolean result = true;
+                loadedClassCount = argHandler.getLoadableClassesCount();
+                loaderCount = argHandler.getLoadersCount();
+
+                stresser.start(loaderCount);
+                controller =  new ClassLoadingController(log, argHandler, stresser);
+
+                log.info("\nclass loading...");
+                controller.loadClasses();
+
+                //extra request for metrics to exclude undesirable class loading
+                //during test execution.
+                initialClassCount = classLoading.getLoadedClassCount();
+                initialTotalClassCount = classLoading.getTotalLoadedClassCount();
+                initialUnloadedClassCount = classLoading.getUnloadedClassCount();
+
+                log.info("\nTEST STARTED");
+                initialClassCount = classLoading.getLoadedClassCount();
+                initialTotalClassCount = classLoading.getTotalLoadedClassCount();
+                initialUnloadedClassCount = classLoading.getUnloadedClassCount();
+
+                log.info("\nInitial values:");
+                log.info("---------------");
+                showValues(initialClassCount, initialTotalClassCount,
+                                initialUnloadedClassCount);
+
+                log.info("\nclass unloading...");
+                currentlyUnLoadedClassCount = controller.unloadClasses();
+
+                long classCount = classLoading.getLoadedClassCount();
+                long totalClassCount = classLoading.getTotalLoadedClassCount();
+                long unloadedClassCount = classLoading.getUnloadedClassCount();
+
+                log.info("\nAmount of currently loaded classes:");
+                log.info("-----------------------------------");
+                showValues(/*classNames, */classCount, totalClassCount,
+                                unloadedClassCount);
+
+                log.info("\nchecking loaded classes...");
+                result = result & checkValues(classCount, totalClassCount, unloadedClassCount);
+
+                if (result) {
+                        log.info("Test PASSED");
+                } else {
+                        log.info("Test FAILED");
+                        setFailed(true);
+                }
+
+        }
+
+        public static void main(String[] args) {
+            Monitoring.runTest(new unload001(new Stresser(args)), args);
+        }
+
+        private void showValues(long classCount,  long totalClassCount, long unloadedClassCount) {
+                log.info("\ttotal loaded class count = " + totalClassCount);
+                log.info("\tcurrently loaded class count = " + classCount);
+                log.info("\tunloaded class count = " + unloadedClassCount);
+        }
+
+        private boolean checkValues(long classCount, long totalClassCount, long unloadedClassCount) {
+                boolean res = true;
+
+                // We don't check for inequality here because totalClassCount can be greater than
+                // initialTotalClassCount due to Lambda classes generation in controller.unloadClasses()
+                long expectedValue = initialTotalClassCount;
+                if (totalClassCount < expectedValue) {
+                        log.error(ERR + "total loaded class count=" + totalClassCount
+                                        + " Expected value: "
+                                        + expectedValue);
+                        res = false;
+                }
+
+                expectedValue = classCount + unloadedClassCount;
+                if (totalClassCount != expectedValue) {
+                        log.error(ERR + "total loaded class count=" + totalClassCount
+                                        + " Expected value(classCount + "
+                                        + "unloadedClassCount): " + expectedValue);
+                        res = false;
+                }
+
+                if (currentlyUnLoadedClassCount > unloadedClassCount) {
+                        log.error(ERR + "unloaded class count=" + unloadedClassCount
+                                        + " Expected value at least "
+                                        + currentlyUnLoadedClassCount);
+                        res = false;
+                }
+
+                return res;
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload001/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/classload/unload001.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent, noJFR]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks up getAllClasses(), getLoadedClassCount(),
+ *     getTotalLoadedClassCount(), getUnloadedClassCount() methods when one
+ *     class is unloaded by 100 loaders, which are the instances of two
+ *     ClassLoader classes.
+ *     Access to the management metrics is accomplished by directly calling
+ *     the methods in the MBean.
+ * COMMENTS
+ *     Fixed the bug
+ *     4930540 TEST_BUG: classunload tests incorrectly calculate class amount
+ *     Fixed the bug
+ *     4976274 Regression: Retrung "OutOfMemoryError: Java heap space" when -XX:+UseParallelGC
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @comment generate and compile LoadableClassXXX classes
+ * @run driver nsk.monitoring.stress.classload.GenClassesBuilder
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.classload.unload001
+ *      classes
+ *      -loadableClassCount=1
+ *      -loadersCount=100
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload002/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/classload/unload002.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent, noJFR]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks up getAllClasses(), getLoadedClassCount(),
+ *     getTotalLoadedClassCount(), getUnloadedClassCount() methods when one
+ *     class is unloaded by 100 loaders, which are the instances of two
+ *     ClassLoader classes.
+ *     Access to the management metrics is accomplished through the MBeanServer.
+ *     Executable class of the test is the same as for the unload001 test.
+ *     In contrast to the unload001 test, the unload002 test is performed for
+ *     the ClassLoadingMBean interface under DEFAULT implementation of
+ *     MBean server.
+ * COMMENTS
+ *     Fixed the bug
+ *     4976274 Regression: "OutOfMemoryError: Java heap space" when -XX:+UseParallelGC
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @comment generate and compile LoadableClassXXX classes
+ * @run driver nsk.monitoring.stress.classload.GenClassesBuilder
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.classload.unload001
+ *      classes
+ *      -testMode=server
+ *      -loadableClassCount=1
+ *      -loadersCount=100
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload003/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/classload/unload003.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent, noJFR]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks up getAllClasses(), getLoadedClassCount(),
+ *     getTotalLoadedClassCount(), getUnloadedClassCount() methods when one
+ *     class is unloaded by 100 loaders, which are the instances of two
+ *     ClassLoader classes.
+ *     Access to the management metrics is accomplished through the MBeanServer.
+ *     Executable class of the test is the same as for the unload001 test.
+ *     In contrast to the unload001 test, the unload003 test is performed for
+ *     the ClassLoadingMBean interface under CUSTOM implementation of
+ *     MBean server.
+ * COMMENTS
+ *     Fixed the bug
+ *     4976274 Regression: "OutOfMemoryError: Java heap space" when -XX:+UseParallelGC
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @comment generate and compile LoadableClassXXX classes
+ * @run driver nsk.monitoring.stress.classload.GenClassesBuilder
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.classload.unload001
+ *      classes
+ *      -testMode=server
+ *      -MBeanServer=custom
+ *      -loadableClassCount=1
+ *      -loadersCount=100
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload004/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/classload/unload004.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent, noJFR]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks up getAllClasses(), getLoadedClassCount(),
+ *     getTotalLoadedClassCount(), getUnloadedClassCount() methods when one
+ *     class is unloaded by 100 loaders, which are the instances of the same
+ *     ClassLoader class.
+ *     Access to the management metrics is accomplished by directly calling
+ *     the methods in the MBean.
+ *     Executable class of the test is the same as for the unload001 test.
+ *     In contrast to the unload001 test, the unload004 test is performed for
+ *     the case when class loaders are the instances of the same custom
+ *     ClassLoader class.
+ * COMMENTS
+ *     Fixed the bug
+ *     4976274 Regression: "OutOfMemoryError: Java heap space" when -XX:+UseParallelGC
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @comment generate and compile LoadableClassXXX classes
+ * @run driver nsk.monitoring.stress.classload.GenClassesBuilder
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.classload.unload001
+ *      classes
+ *      -singleClassloaderClass
+ *      -loadableClassCount=1
+ *      -loadersCount=100
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload005/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/classload/unload005.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent, noJFR]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks up getAllClasses(), getLoadedClassCount(),
+ *     getTotalLoadedClassCount(), getUnloadedClassCount() methods when one
+ *     class is unloaded by 100 loaders, which are the instances of the same
+ *     ClassLoader class.
+ *     Access to the management metrics is accomplished through the MBeanServer.
+ *     The unload005 test is performed for the ClassLoadingMBean interface under
+ *     DEFAULT implementation of MBean server.
+ * COMMENTS
+ *     Fixed the bug
+ *     4976274 Regression: "OutOfMemoryError: Java heap space" when -XX:+UseParallelGC
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @comment generate and compile LoadableClassXXX classes
+ * @run driver nsk.monitoring.stress.classload.GenClassesBuilder
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.classload.unload001
+ *      classes
+ *      -testMode=server
+ *      -singleClassloaderClass
+ *      -loadableClassCount=1
+ *      -loadersCount=100
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload006/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload006/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/classload/unload006.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent, noJFR]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks up getAllClasses(), getLoadedClassCount(),
+ *     getTotalLoadedClassCount(), getUnloadedClassCount() methods when one
+ *     class is unloaded by 100 loaders, which are the instances of the same
+ *     ClassLoader class.
+ *     Access to the management metrics is accomplished through the MBeanServer.
+ *     The unload006 test is performed for the ClassLoadingMBean interface under
+ *     CUSTOM implementation of MBean server.
+ * COMMENTS
+ *     Fixed the bug
+ *     4976274 Regression: "OutOfMemoryError: Java heap space" when -XX:+UseParallelGC
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @comment generate and compile LoadableClassXXX classes
+ * @run driver nsk.monitoring.stress.classload.GenClassesBuilder
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.classload.unload001
+ *      classes
+ *      -testMode=server
+ *      -MBeanServer=custom
+ *      -singleClassloaderClass
+ *      -loadableClassCount=1
+ *      -loadersCount=100
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload007/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload007/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/classload/unload007.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent, noJFR]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks up getAllClasses(), getLoadedClassCount(),
+ *     getTotalLoadedClassCount(), getUnloadedClassCount() methods when 100
+ *     classes are unloaded by 100 loaders, which are the instances of two
+ *     custom ClassLoader classes.
+ *     Access to the management metrics is accomplished by directly calling
+ *     the methods in the MBean.
+ *     Executable class of the test is the same as for the unload001 test.
+ *     In contrast to the unload001 test, the unload007 test is performed for
+ *     the case when 100 loaders execute unloading.
+ * COMMENTS
+ *     Fixed the bug
+ *     4929234 TEST_BUG: classunload tests fail because of time out
+ *     Fixed the bug
+ *     4976274 Regression: "OutOfMemoryError: Java heap space" when -XX:+UseParallelGC
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @comment generate and compile LoadableClassXXX classes
+ * @run driver nsk.monitoring.stress.classload.GenClassesBuilder
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.classload.unload001
+ *      classes
+ *      -loadableClassCount=100
+ *      -loadersCount=12
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload008/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload008/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/classload/unload008.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent, noJFR]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks up getAllClasses(), getLoadedClassCount(),
+ *     getTotalLoadedClassCount(), getUnloadedClassCount() methods when 100
+ *     classes are unloaded by 100 loaders, which are the instances of two
+ *     custom ClassLoader classes.
+ *     Access to the management metrics is accomplished through the MBeanServer.
+ *     The unload008 test is performed for the ClassLoadingMBean interface under
+ *     DEFAULT implementation of MBean server.
+ * COMMENTS
+ *     Fixed the bug
+ *     4929234 TEST_BUG: classunload tests fail because of time out
+ *     Fixed the bug
+ *     4976274 Regression: "OutOfMemoryError: Java heap space" when -XX:+UseParallelGC
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @comment generate and compile LoadableClassXXX classes
+ * @run driver nsk.monitoring.stress.classload.GenClassesBuilder
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.classload.unload001
+ *      classes
+ *      -testMode=server
+ *      -loadableClassCount=100
+ *      -loadersCount=12
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload009/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload009/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/classload/unload009.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent, noJFR]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks up getAllClasses(), getLoadedClassCount(),
+ *     getTotalLoadedClassCount(), getUnloadedClassCount() methods when 100
+ *     classes are unloaded by 100 loaders, which are the instances of two
+ *     custom ClassLoader classes.
+ *     Access to the management metrics is accomplished through the MBeanServer.
+ *     The unload009 test is performed for the ClassLoadingMBean interface under
+ *     CUSTOM implementation of MBean server.
+ * COMMENTS
+ *     Fixed the bug
+ *     4929234 TEST_BUG: classunload tests fail because of time out
+ *     Fixed the bug
+ *     4976274 Regression: "OutOfMemoryError: Java heap space" when -XX:+UseParallelGC
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @comment generate and compile LoadableClassXXX classes
+ * @run driver nsk.monitoring.stress.classload.GenClassesBuilder
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.classload.unload001
+ *      classes
+ *      -testMode=server
+ *      -MBeanServer=custom
+ *      -loadableClassCount=100
+ *      -loadersCount=12
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload010/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload010/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/classload/unload010.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent, noJFR]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks up getAllClasses(), getLoadedClassCount(),
+ *     getTotalLoadedClassCount(), getUnloadedClassCount() methods when 100
+ *     classes are unloaded by 100 loaders, which are the instances of the
+ *     same ClassLoader class.
+ *     Access to the management metrics is accomplished by directly calling
+ *     the methods in the MBean.
+ *     Executable class of the test is the same as for the unload004 test.
+ *     In contrast to the unload004 test, the unload010 test is performed for
+ *     the case when 100 classes are unloaded.
+ * COMMENTS
+ *     Fixed the bug
+ *     4929234 TEST_BUG: classunload tests fail because of time out
+ *     Fixed the bug
+ *     4976274 Regression: "OutOfMemoryError: Java heap space" when -XX:+UseParallelGC
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @comment generate and compile LoadableClassXXX classes
+ * @run driver nsk.monitoring.stress.classload.GenClassesBuilder
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.classload.unload001
+ *      classes
+ *      -singleClassloaderClass
+ *      -loadableClassCount=100
+ *      -loadersCount=12
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload011/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload011/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/classload/unload011.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent, noJFR]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks up getAllClasses(), getLoadedClassCount(),
+ *     getTotalLoadedClassCount(), getUnloadedClassCount() methods when 100
+ *     classes are unloaded by 100 loaders, which are the instances of the
+ *     same ClassLoader class.
+ *     Access to the management metrics is accomplished through the MBeanServer.
+ *     The unload011 test is performed for the ClassLoadingMBean interface under
+ *     DEFAULT implementation of MBean server.
+ * COMMENTS
+ *     Fixed the bug
+ *     4929234 TEST_BUG: classunload tests fail because of time out
+ *     Fixed the bug
+ *     4976274 Regression: "OutOfMemoryError: Java heap space" when -XX:+UseParallelGC
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @comment generate and compile LoadableClassXXX classes
+ * @run driver nsk.monitoring.stress.classload.GenClassesBuilder
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.classload.unload001
+ *      classes
+ *      -testMode=server
+ *      -singleClassloaderClass
+ *      -loadableClassCount=100
+ *      -loadersCount=12
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload012/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/unload012/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/classload/unload012.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent, noJFR]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks up getAllClasses(), getLoadedClassCount(),
+ *     getTotalLoadedClassCount(), getUnloadedClassCount() methods when 100
+ *     classes are unloaded by 100 loaders, which are the instances of the
+ *     same ClassLoader class.
+ *     Access to the management metrics is accomplished through the MBeanServer.
+ *     The unload012 test is performed for the ClassLoadingMBean interface under
+ *     CUSTOM implementation of MBean server.
+ * COMMENTS
+ *     Fixed the bug
+ *     4929234 TEST_BUG: classunload tests fail because of time out
+ *     Fixed the bug
+ *     4976274 Regression: "OutOfMemoryError: Java heap space" when -XX:+UseParallelGC
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @comment generate and compile LoadableClassXXX classes
+ * @run driver nsk.monitoring.stress.classload.GenClassesBuilder
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.classload.unload001
+ *      classes
+ *      -testMode=server
+ *      -MBeanServer=custom
+ *      -singleClassloaderClass
+ *      -loadableClassCount=100
+ *      -loadersCount=12
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,211 @@
+/*
+ * Copyright (c) 2003, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package nsk.monitoring.stress.lowmem;
+
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryMXBean;
+import java.lang.management.MemoryType;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
+import nsk.share.Log;
+import nsk.share.TestFailure;
+import nsk.share.gc.GC;
+import nsk.share.gc.ThreadedGCTest;
+import nsk.share.gc.gp.GarbageProducer;
+import nsk.share.gc.gp.array.ByteArrayProducer;
+import nsk.share.gc.gp.classload.GeneratedClassProducer;
+import nsk.monitoring.share.*;
+import nsk.share.test.ExecutionController;
+
+public class lowmem001 extends ThreadedGCTest {
+
+    // The max heap usage after whih we free memory and restart
+    static final int MAX_HEAP_USAGE = 70;
+    // isOOM is used to stop allocation and free resources
+    // immediately after first OOME
+    // really it could be only if we didn't check usage in time
+    static AtomicBoolean isOOM = new AtomicBoolean(false);
+    static ArgumentHandler argHandler;
+    MemoryMonitor monitor;
+
+    public static void main(String[] args) {
+        argHandler = new ArgumentHandler(args);
+        GC.runTest(new lowmem001(), args);
+    }
+
+    @Override
+    public void run() {
+        Log log = new Log(System.out, true);
+        // System.err is duplicated into buffer
+        // it should be empty
+        MyStream stream = new MyStream(System.err);
+        System.setErr(new PrintStream(stream));
+
+        monitor = Monitor.getMemoryMonitor(log, argHandler);
+        try {
+            monitor.enableMonitoring();
+            monitor.updateThresholds();
+            super.run();
+            monitor.disableMonitoring();
+        } catch (Exception e) {
+            throw new TestFailure(e);
+        }
+        if (isOOM.get() == true) {
+            log.display("The OOME happened during test");
+            // We control memory at 70 %
+            // each time when we want to eat 512 bytes
+            // if we got OOME it is really ugly
+            throw new TestFailure("OOME should not happened.");
+        }
+        if (!monitor.getPassedStatus()) {
+            throw new TestFailure("MemoryMonitor fails. See log.");
+        }
+        if (!stream.isEmpty()) {
+            String string = stream.getString();
+            if (string.contains("java.lang.OutOfMemoryError")) {
+                log.display("WARNING: The System.err contains OutOfMemory.");
+                // the OOME is not error
+                log.complain(string);
+                return;
+            }
+            log.complain(string);
+            throw new TestFailure("Error stream is not empty.");
+        }
+
+    }
+
+    @Override
+    protected Runnable createRunnable(int i) {
+        String memory = argHandler.getTestedMemory();
+        if (memory.equals(MemoryMonitor.HEAP_TYPE)) {
+            return new HeapStresser();
+        }
+        if (memory.equals(MemoryMonitor.NONHEAP_TYPE)) {
+            return new ClassStresser();
+        }
+        // mixed type
+        return i % 2 == 0 ? new HeapStresser() : new ClassStresser();
+    }
+
+    /*
+     * Simple ClassLoader is used for non-heap stressing
+     * should be revised after permgen removal
+     */
+    class ClassStresser extends Thread {
+
+        @Override
+        public void run() {
+            ExecutionController stresser = getExecutionController();
+            GeneratedClassProducer gp = new GeneratedClassProducer();
+            while (stresser.continueExecution()) {
+                try {
+                    gp.create(0);
+                } catch (OutOfMemoryError e) {
+                    // drop 'gc', reset Thresholds and start new iteration
+                    monitor.resetThresholds(MemoryType.NON_HEAP);
+                    return;
+                }
+            }
+        }
+    };
+
+    class HeapStresser extends Thread {
+
+        final long chunkSize = 512;
+        List storage;
+        GarbageProducer gp = new ByteArrayProducer();
+
+
+        @Override
+        public void run() {
+            storage = new LinkedList();
+            ExecutionController stresser = getExecutionController();
+            MemoryMXBean bean = ManagementFactory.getMemoryMXBean();
+
+            while (stresser.continueExecution()) {
+                try {
+                   storage.add(gp.create(chunkSize + new Object().hashCode() % 31));
+                   storage.add(gp.create(chunkSize));
+                   storage.remove(0);
+                    if (isOOM.get() == true || !stresser.continueExecution()) {
+                        stresser.finish();
+                        storage = null;
+                        return;
+                    }
+                    if (Thread.currentThread().isInterrupted()) {
+                        break;
+                    }
+                    // If memory is low free resources and restart
+                    if (bean.getHeapMemoryUsage().getUsed()
+                            > bean.getHeapMemoryUsage().getMax() * MAX_HEAP_USAGE / 100) {
+                        storage = new LinkedList();
+                        monitor.resetThresholds(MemoryType.HEAP);
+                    }
+                } catch (OutOfMemoryError e) {
+                    // Let finish, the managment/memorymonitor could be
+                    // corrupted after OOME
+                    storage = null;
+                    isOOM.set(true);
+                    stresser.finish();
+                    return;
+                }
+            }
+        }
+    }
+
+    static class MyStream extends OutputStream {
+
+        PrintStream err;
+
+        public MyStream(PrintStream err) {
+            this.err = err;
+        }
+        private final static int SIZE = 100000;
+        private char[] value = new char[SIZE];
+        private int count = 0;
+
+        // No additional memory allocation during write
+        @Override
+        public synchronized void write(int b) {
+            if (count < SIZE) {
+                value[count++] = (char) b;
+            }
+            try {
+                err.write(b);
+            } catch (OutOfMemoryError oome) {
+                isOOM.set(true);
+            }
+        }
+
+        public String getString() {
+            return new String(value, 0, count);
+        }
+
+        public boolean isEmpty() {
+            return count == 0;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem001/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/lowmem/lowmem001.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that enabling of low memory detection does not lead to
+ *     unexpected behaviour: crashes of the VM and undocumented exceptions.
+ *     The test enables low memory detection: it adds NotificationListener
+ *     to the MemoryMBean for notification mechanism of monitoring, or starts
+ *     a special thread for polling mechanism. After that, it starts eating memory.
+ *     Objects are allocated, if "heap" memory is tested; classes are loaded,
+ *     if "nonheap" memory is tested; objects are allocated and classes are
+ *     loaded, if "mixed" memory is tested.
+ *     Notifications are received by the listener in notification mechanism and
+ *     crossing of thresholds are detected in polling mechanism. The thresholds
+ *     are updated as soon as notification is received, or crossing of a threshold
+ *     is detected.
+ *     The test also checks stderr to be empty. Otherwise, it fails. The test
+ *     exits as soon as OutOfMemoryError is caught (if heap memory is tested) or
+ *     all classes are loaded (if nonheap or mixed memory is tested).
+ *     All options of the test are specified in *.cfg file. this particular test
+ *         - performs directly access to the MBeans' methods;
+ *         - fills heap memory;
+ *         - implements notifcation mechanism of monitoring;
+ *         - tests usage thresholds.
+ * COMMENTS
+ *     Fixed the bug
+ *     4969687 TEST_BUG: The spec is updated accoring to 4956978, 4957000, 4959889
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm -XX:-UseGCOverheadLimit nsk.monitoring.stress.lowmem.lowmem001 -memory=heap
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem002/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/lowmem/lowmem002.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that enabling of low memory detection does not lead to
+ *     unexpected behaviour: crashes of the VM and undocumented exceptions.
+ *     The test enables low memory detection: it adds NotificationListener
+ *     to the MemoryMBean for notification mechanism of monitoring, or starts
+ *     a special thread for polling mechanism. After that, it starts eating memory.
+ *     Objects are allocated, if "heap" memory is tested; classes are loaded,
+ *     if "nonheap" memory is tested; objects are allocated and classes are
+ *     loaded, if "mixed" memory is tested.
+ *     Notifications are received by the listener in notification mechanism and
+ *     crossing of thresholds are detected in polling mechanism. The thresholds
+ *     are updated as soon as notification is received, or crossing of a threshold
+ *     is detected.
+ *     The test also checks stderr to be empty. Otherwise, it fails. The test
+ *     exits as soon as OutOfMemoryError is caught (if heap memory is tested) or
+ *     all classes are loaded (if nonheap or mixed memory is tested).
+ *     All options of the test are specified in *.cfg file. this particular test
+ *         - performs access to the MBeans' method through default MBeanServer;
+ *         - fills heap memory;
+ *         - implements notifcation mechanism of monitoring;
+ *         - tests usage thresholds.
+ * COMMENTS
+ *     Fixed the bug
+ *     4969687 TEST_BUG: The spec is updated accoring to 4956978, 4957000, 4959889
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.lowmem.lowmem001
+ *      -memory=heap
+ *      -testMode=server
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem003/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/lowmem/lowmem003.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that enabling of low memory detection does not lead to
+ *     unexpected behaviour: crashes of the VM and undocumented exceptions.
+ *     The test enables low memory detection: it adds NotificationListener
+ *     to the MemoryMBean for notification mechanism of monitoring, or starts
+ *     a special thread for polling mechanism. After that, it starts eating memory.
+ *     Objects are allocated, if "heap" memory is tested; classes are loaded,
+ *     if "nonheap" memory is tested; objects are allocated and classes are
+ *     loaded, if "mixed" memory is tested.
+ *     Notifications are received by the listener in notification mechanism and
+ *     crossing of thresholds are detected in polling mechanism. The thresholds
+ *     are updated as soon as notification is received, or crossing of a threshold
+ *     is detected.
+ *     The test also checks stderr to be empty. Otherwise, it fails. The test
+ *     exits as soon as OutOfMemoryError is caught (if heap memory is tested) or
+ *     all classes are loaded (if nonheap or mixed memory is tested).
+ *     All options of the test are specified in *.cfg file. this particular test
+ *         - performs access to the MBeans' method through custom MBeanServer;
+ *         - fills heap memory;
+ *         - implements notifcation mechanism of monitoring;
+ *         - tests usage thresholds.
+ * COMMENTS
+ *     Fixed the bug
+ *     4969687 TEST_BUG: The spec is updated accoring to 4956978, 4957000, 4959889
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.lowmem.lowmem001
+ *      -memory=heap
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem004/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/lowmem/lowmem004.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that enabling of low memory detection does not lead to
+ *     unexpected behaviour: crashes of the VM and undocumented exceptions.
+ *     The test enables low memory detection: it adds NotificationListener
+ *     to the MemoryMBean for notification mechanism of monitoring, or starts
+ *     a special thread for polling mechanism. After that, it starts eating memory.
+ *     Objects are allocated, if "heap" memory is tested; classes are loaded,
+ *     if "nonheap" memory is tested; objects are allocated and classes are
+ *     loaded, if "mixed" memory is tested.
+ *     Notifications are received by the listener in notification mechanism and
+ *     crossing of thresholds are detected in polling mechanism. The thresholds
+ *     are updated as soon as notification is received, or crossing of a threshold
+ *     is detected.
+ *     The test also checks stderr to be empty. Otherwise, it fails. The test
+ *     exits as soon as OutOfMemoryError is caught (if heap memory is tested) or
+ *     all classes are loaded (if nonheap or mixed memory is tested).
+ *     All options of the test are specified in *.cfg file. this particular test
+ *         - performs directly access to the MBeans' methods;
+ *         - fills nonheap memory;
+ *         - implements notifcation mechanism of monitoring;
+ *         - tests usage thresholds.
+ * COMMENTS
+ *     Fixed the bug
+ *     4969687 TEST_BUG: The spec is updated accoring to 4956978, 4957000, 4959889
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm -XX:-UseGCOverheadLimit nsk.monitoring.stress.lowmem.lowmem001 -memory=nonheap
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem005/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/lowmem/lowmem005.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that enabling of low memory detection does not lead to
+ *     unexpected behaviour: crashes of the VM and undocumented exceptions.
+ *     The test enables low memory detection: it adds NotificationListener
+ *     to the MemoryMBean for notification mechanism of monitoring, or starts
+ *     a special thread for polling mechanism. After that, it starts eating memory.
+ *     Objects are allocated, if "heap" memory is tested; classes are loaded,
+ *     if "nonheap" memory is tested; objects are allocated and classes are
+ *     loaded, if "mixed" memory is tested.
+ *     Notifications are received by the listener in notification mechanism and
+ *     crossing of thresholds are detected in polling mechanism. The thresholds
+ *     are updated as soon as notification is received, or crossing of a threshold
+ *     is detected.
+ *     The test also checks stderr to be empty. Otherwise, it fails. The test
+ *     exits as soon as OutOfMemoryError is caught (if heap memory is tested) or
+ *     all classes are loaded (if nonheap or mixed memory is tested).
+ *     All options of the test are specified in *.cfg file. this particular test
+ *         - performs access to the MBeans' method through default MBeanServer;
+ *         - fills nonheap memory;
+ *         - implements notifcation mechanism of monitoring;
+ *         - tests usage thresholds.
+ * COMMENTS
+ *     Fixed the bug
+ *     4969687 TEST_BUG: The spec is updated accoring to 4956978, 4957000, 4959889
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.lowmem.lowmem001
+ *      -memory=nonheap
+ *      -testMode=server
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem006/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem006/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/lowmem/lowmem006.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that enabling of low memory detection does not lead to
+ *     unexpected behaviour: crashes of the VM and undocumented exceptions.
+ *     The test enables low memory detection: it adds NotificationListener
+ *     to the MemoryMBean for notification mechanism of monitoring, or starts
+ *     a special thread for polling mechanism. After that, it starts eating memory.
+ *     Objects are allocated, if "heap" memory is tested; classes are loaded,
+ *     if "nonheap" memory is tested; objects are allocated and classes are
+ *     loaded, if "mixed" memory is tested.
+ *     Notifications are received by the listener in notification mechanism and
+ *     crossing of thresholds are detected in polling mechanism. The thresholds
+ *     are updated as soon as notification is received, or crossing of a threshold
+ *     is detected.
+ *     The test also checks stderr to be empty. Otherwise, it fails. The test
+ *     exits as soon as OutOfMemoryError is caught (if heap memory is tested) or
+ *     all classes are loaded (if nonheap or mixed memory is tested).
+ *     All options of the test are specified in *.cfg file. this particular test
+ *         - performs access to the MBeans' method through custom MBeanServer;
+ *         - fills nonheap memory;
+ *         - implements notifcation mechanism of monitoring;
+ *         - tests usage thresholds.
+ * COMMENTS
+ *     Fixed the bug
+ *     4969687 TEST_BUG: The spec is updated accoring to 4956978, 4957000, 4959889
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.lowmem.lowmem001
+ *      -memory=nonheap
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem007/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem007/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/lowmem/lowmem007.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that enabling of low memory detection does not lead to
+ *     unexpected behaviour: crashes of the VM and undocumented exceptions.
+ *     The test enables low memory detection: it adds NotificationListener
+ *     to the MemoryMBean for notification mechanism of monitoring, or starts
+ *     a special thread for polling mechanism. After that, it starts eating memory.
+ *     Objects are allocated, if "heap" memory is tested; classes are loaded,
+ *     if "nonheap" memory is tested; objects are allocated and classes are
+ *     loaded, if "mixed" memory is tested.
+ *     Notifications are received by the listener in notification mechanism and
+ *     crossing of thresholds are detected in polling mechanism. The thresholds
+ *     are updated as soon as notification is received, or crossing of a threshold
+ *     is detected.
+ *     The test also checks stderr to be empty. Otherwise, it fails. The test
+ *     exits as soon as OutOfMemoryError is caught (if heap memory is tested) or
+ *     all classes are loaded (if nonheap or mixed memory is tested).
+ *     All options of the test are specified in *.cfg file. this particular test
+ *         - performs directly access to the MBeans' methods;
+ *         - fills both heap and nonheap memory;
+ *         - implements notifcation mechanism of monitoring;
+ *         - tests usage thresholds.
+ * COMMENTS
+ *     Fixed the bug
+ *     4969687 TEST_BUG: The spec is updated accoring to 4956978, 4957000, 4959889
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm -XX:-UseGCOverheadLimit nsk.monitoring.stress.lowmem.lowmem001 -memory=mixed
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem008/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem008/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/lowmem/lowmem008.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that enabling of low memory detection does not lead to
+ *     unexpected behaviour: crashes of the VM and undocumented exceptions.
+ *     The test enables low memory detection: it adds NotificationListener
+ *     to the MemoryMBean for notification mechanism of monitoring, or starts
+ *     a special thread for polling mechanism. After that, it starts eating memory.
+ *     Objects are allocated, if "heap" memory is tested; classes are loaded,
+ *     if "nonheap" memory is tested; objects are allocated and classes are
+ *     loaded, if "mixed" memory is tested.
+ *     Notifications are received by the listener in notification mechanism and
+ *     crossing of thresholds are detected in polling mechanism. The thresholds
+ *     are updated as soon as notification is received, or crossing of a threshold
+ *     is detected.
+ *     The test also checks stderr to be empty. Otherwise, it fails. The test
+ *     exits as soon as OutOfMemoryError is caught (if heap memory is tested) or
+ *     all classes are loaded (if nonheap or mixed memory is tested).
+ *     All options of the test are specified in *.cfg file. this particular test
+ *         - performs access to the MBeans' method through default MBeanServer;
+ *         - fills both heap and nonheap memory;
+ *         - implements notifcation mechanism of monitoring;
+ *         - tests usage thresholds.
+ * COMMENTS
+ *     Fixed the bug
+ *     4969687 TEST_BUG: The spec is updated accoring to 4956978, 4957000, 4959889
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.lowmem.lowmem001
+ *      -memory=mixed
+ *      -testMode=server
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem009/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem009/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/lowmem/lowmem009.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that enabling of low memory detection does not lead to
+ *     unexpected behaviour: crashes of the VM and undocumented exceptions.
+ *     The test enables low memory detection: it adds NotificationListener
+ *     to the MemoryMBean for notification mechanism of monitoring, or starts
+ *     a special thread for polling mechanism. After that, it starts eating memory.
+ *     Objects are allocated, if "heap" memory is tested; classes are loaded,
+ *     if "nonheap" memory is tested; objects are allocated and classes are
+ *     loaded, if "mixed" memory is tested.
+ *     Notifications are received by the listener in notification mechanism and
+ *     crossing of thresholds are detected in polling mechanism. The thresholds
+ *     are updated as soon as notification is received, or crossing of a threshold
+ *     is detected.
+ *     The test also checks stderr to be empty. Otherwise, it fails. The test
+ *     exits as soon as OutOfMemoryError is caught (if heap memory is tested) or
+ *     all classes are loaded (if nonheap or mixed memory is tested).
+ *     All options of the test are specified in *.cfg file. this particular test
+ *         - performs access to the MBeans' method through custom MBeanServer;
+ *         - fills both heap and nonheap memory;
+ *         - implements notifcation mechanism of monitoring;
+ *         - tests usage thresholds.
+ * COMMENTS
+ *     Fixed the bug
+ *     4969687 TEST_BUG: The spec is updated accoring to 4956978, 4957000, 4959889
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.lowmem.lowmem001
+ *      -memory=mixed
+ *      -testMode=server
+ *      -MBeanServer=custom
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem010/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem010/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/lowmem/lowmem010.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that enabling of low memory detection does not lead to
+ *     unexpected behaviour: crashes of the VM and undocumented exceptions.
+ *     The test enables low memory detection: it adds NotificationListener
+ *     to the MemoryMBean for notification mechanism of monitoring, or starts
+ *     a special thread for polling mechanism. After that, it starts eating memory.
+ *     Objects are allocated, if "heap" memory is tested; classes are loaded,
+ *     if "nonheap" memory is tested; objects are allocated and classes are
+ *     loaded, if "mixed" memory is tested.
+ *     Notifications are received by the listener in notification mechanism and
+ *     crossing of thresholds are detected in polling mechanism. The thresholds
+ *     are updated as soon as notification is received, or crossing of a threshold
+ *     is detected.
+ *     The test also checks stderr to be empty. Otherwise, it fails. The test
+ *     exits as soon as OutOfMemoryError is caught (if heap memory is tested) or
+ *     all classes are loaded (if nonheap or mixed memory is tested).
+ *     All options of the test are specified in *.cfg file. this particular test
+ *         - performs directly access to the MBeans' methods;
+ *         - fills heap memory;
+ *         - implements polling mechanism of monitoring;
+ *         - tests usage thresholds.
+ * COMMENTS
+ *     Fixed the bug
+ *     4969687 TEST_BUG: The spec is updated accoring to 4956978, 4957000, 4959889
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.lowmem.lowmem001
+ *      -testMode=directly
+ *      -memory=heap
+ *      -monitoring=polling
+ *      -threshold=usage
+ *      -timeout=30
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem011/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem011/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/lowmem/lowmem011.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that enabling of low memory detection does not lead to
+ *     unexpected behaviour: crashes of the VM and undocumented exceptions.
+ *     The test enables low memory detection: it adds NotificationListener
+ *     to the MemoryMBean for notification mechanism of monitoring, or starts
+ *     a special thread for polling mechanism. After that, it starts eating memory.
+ *     Objects are allocated, if "heap" memory is tested; classes are loaded,
+ *     if "nonheap" memory is tested; objects are allocated and classes are
+ *     loaded, if "mixed" memory is tested.
+ *     Notifications are received by the listener in notification mechanism and
+ *     crossing of thresholds are detected in polling mechanism. The thresholds
+ *     are updated as soon as notification is received, or crossing of a threshold
+ *     is detected.
+ *     The test also checks stderr to be empty. Otherwise, it fails. The test
+ *     exits as soon as OutOfMemoryError is caught (if heap memory is tested) or
+ *     all classes are loaded (if nonheap or mixed memory is tested).
+ *     All options of the test are specified in *.cfg file. this particular test
+ *         - performs access to the MBeans' method through default MBeanServer;
+ *         - fills heap memory;
+ *         - implements polling mechanism of monitoring;
+ *         - tests usage thresholds.
+ * COMMENTS
+ *     Fixed the bug
+ *     4969687 TEST_BUG: The spec is updated accoring to 4956978, 4957000, 4959889
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.lowmem.lowmem001
+ *      -testMode=server
+ *      -memory=heap
+ *      -monitoring=polling
+ *      -threshold=usage
+ *      -timeout=30
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem012/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem012/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/lowmem/lowmem012.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that enabling of low memory detection does not lead to
+ *     unexpected behaviour: crashes of the VM and undocumented exceptions.
+ *     The test enables low memory detection: it adds NotificationListener
+ *     to the MemoryMBean for notification mechanism of monitoring, or starts
+ *     a special thread for polling mechanism. After that, it starts eating memory.
+ *     Objects are allocated, if "heap" memory is tested; classes are loaded,
+ *     if "nonheap" memory is tested; objects are allocated and classes are
+ *     loaded, if "mixed" memory is tested.
+ *     Notifications are received by the listener in notification mechanism and
+ *     crossing of thresholds are detected in polling mechanism. The thresholds
+ *     are updated as soon as notification is received, or crossing of a threshold
+ *     is detected.
+ *     The test also checks stderr to be empty. Otherwise, it fails. The test
+ *     exits as soon as OutOfMemoryError is caught (if heap memory is tested) or
+ *     all classes are loaded (if nonheap or mixed memory is tested).
+ *     All options of the test are specified in *.cfg file. this particular test
+ *         - performs access to the MBeans' method through custom MBeanServer;
+ *         - fills heap memory;
+ *         - implements polling mechanism of monitoring;
+ *         - tests usage thresholds.
+ * COMMENTS
+ *     Fixed the bug
+ *     4969687 TEST_BUG: The spec is updated accoring to 4956978, 4957000, 4959889
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.lowmem.lowmem001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ *      -memory=heap
+ *      -monitoring=polling
+ *      -threshold=usage
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem013/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem013/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/lowmem/lowmem013.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that enabling of low memory detection does not lead to
+ *     unexpected behaviour: crashes of the VM and undocumented exceptions.
+ *     The test enables low memory detection: it adds NotificationListener
+ *     to the MemoryMBean for notification mechanism of monitoring, or starts
+ *     a special thread for polling mechanism. After that, it starts eating memory.
+ *     Objects are allocated, if "heap" memory is tested; classes are loaded,
+ *     if "nonheap" memory is tested; objects are allocated and classes are
+ *     loaded, if "mixed" memory is tested.
+ *     Notifications are received by the listener in notification mechanism and
+ *     crossing of thresholds are detected in polling mechanism. The thresholds
+ *     are updated as soon as notification is received, or crossing of a threshold
+ *     is detected.
+ *     The test also checks stderr to be empty. Otherwise, it fails. The test
+ *     exits as soon as OutOfMemoryError is caught (if heap memory is tested) or
+ *     all classes are loaded (if nonheap or mixed memory is tested).
+ *     All options of the test are specified in *.cfg file. this particular test
+ *         - performs directly access to the MBeans' methods;
+ *         - fills nonheap memory;
+ *         - implements polling mechanism of monitoring;
+ *         - tests usage thresholds.
+ * COMMENTS
+ *     Fixed the bug
+ *     4969687 TEST_BUG: The spec is updated accoring to 4956978, 4957000, 4959889
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.lowmem.lowmem001
+ *      -testMode=directly
+ *      -memory=nonheap
+ *      -monitoring=polling
+ *      -threshold=usage
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem014/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem014/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/lowmem/lowmem014.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that enabling of low memory detection does not lead to
+ *     unexpected behaviour: crashes of the VM and undocumented exceptions.
+ *     The test enables low memory detection: it adds NotificationListener
+ *     to the MemoryMBean for notification mechanism of monitoring, or starts
+ *     a special thread for polling mechanism. After that, it starts eating memory.
+ *     Objects are allocated, if "heap" memory is tested; classes are loaded,
+ *     if "nonheap" memory is tested; objects are allocated and classes are
+ *     loaded, if "mixed" memory is tested.
+ *     Notifications are received by the listener in notification mechanism and
+ *     crossing of thresholds are detected in polling mechanism. The thresholds
+ *     are updated as soon as notification is received, or crossing of a threshold
+ *     is detected.
+ *     The test also checks stderr to be empty. Otherwise, it fails. The test
+ *     exits as soon as OutOfMemoryError is caught (if heap memory is tested) or
+ *     all classes are loaded (if nonheap or mixed memory is tested).
+ *     All options of the test are specified in *.cfg file. this particular test
+ *         - performs access to the MBeans' method through default MBeanServer;
+ *         - fills nonheap memory;
+ *         - implements polling mechanism of monitoring;
+ *         - tests usage thresholds.
+ * COMMENTS
+ *     Fixed the bug
+ *     4969687 TEST_BUG: The spec is updated accoring to 4956978, 4957000, 4959889
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.lowmem.lowmem001
+ *      -testMode=server
+ *      -memory=nonheap
+ *      -monitoring=polling
+ *      -threshold=usage
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem015/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem015/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/lowmem/lowmem015.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that enabling of low memory detection does not lead to
+ *     unexpected behaviour: crashes of the VM and undocumented exceptions.
+ *     The test enables low memory detection: it adds NotificationListener
+ *     to the MemoryMBean for notification mechanism of monitoring, or starts
+ *     a special thread for polling mechanism. After that, it starts eating memory.
+ *     Objects are allocated, if "heap" memory is tested; classes are loaded,
+ *     if "nonheap" memory is tested; objects are allocated and classes are
+ *     loaded, if "mixed" memory is tested.
+ *     Notifications are received by the listener in notification mechanism and
+ *     crossing of thresholds are detected in polling mechanism. The thresholds
+ *     are updated as soon as notification is received, or crossing of a threshold
+ *     is detected.
+ *     The test also checks stderr to be empty. Otherwise, it fails. The test
+ *     exits as soon as OutOfMemoryError is caught (if heap memory is tested) or
+ *     all classes are loaded (if nonheap or mixed memory is tested).
+ *     All options of the test are specified in *.cfg file. this particular test
+ *         - performs access to the MBeans' method through custom MBeanServer;
+ *         - fills nonheap memory;
+ *         - implements polling mechanism of monitoring;
+ *         - tests usage thresholds.
+ * COMMENTS
+ *     Fixed the bug
+ *     4969687 TEST_BUG: The spec is updated accoring to 4956978, 4957000, 4959889
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.lowmem.lowmem001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ *      -memory=nonheap
+ *      -monitoring=polling
+ *      -threshold=usage
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem016/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem016/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/lowmem/lowmem016.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that enabling of low memory detection does not lead to
+ *     unexpected behaviour: crashes of the VM and undocumented exceptions.
+ *     The test enables low memory detection: it adds NotificationListener
+ *     to the MemoryMBean for notification mechanism of monitoring, or starts
+ *     a special thread for polling mechanism. After that, it starts eating memory.
+ *     Objects are allocated, if "heap" memory is tested; classes are loaded,
+ *     if "nonheap" memory is tested; objects are allocated and classes are
+ *     loaded, if "mixed" memory is tested.
+ *     Notifications are received by the listener in notification mechanism and
+ *     crossing of thresholds are detected in polling mechanism. The thresholds
+ *     are updated as soon as notification is received, or crossing of a threshold
+ *     is detected.
+ *     The test also checks stderr to be empty. Otherwise, it fails. The test
+ *     exits as soon as OutOfMemoryError is caught (if heap memory is tested) or
+ *     all classes are loaded (if nonheap or mixed memory is tested).
+ *     All options of the test are specified in *.cfg file. this particular test
+ *         - performs directly access to the MBeans' methods;
+ *         - fills mixed memory;
+ *         - implements polling mechanism of monitoring;
+ *         - tests usage thresholds.
+ * COMMENTS
+ *     Fixed the bug
+ *     4969687 TEST_BUG: The spec is updated accoring to 4956978, 4957000, 4959889
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.lowmem.lowmem001
+ *      -testMode=directly
+ *      -memory=mixed
+ *      -monitoring=polling
+ *      -threshold=usage
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem017/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem017/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/lowmem/lowmem017.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that enabling of low memory detection does not lead to
+ *     unexpected behaviour: crashes of the VM and undocumented exceptions.
+ *     The test enables low memory detection: it adds NotificationListener
+ *     to the MemoryMBean for notification mechanism of monitoring, or starts
+ *     a special thread for polling mechanism. After that, it starts eating memory.
+ *     Objects are allocated, if "heap" memory is tested; classes are loaded,
+ *     if "nonheap" memory is tested; objects are allocated and classes are
+ *     loaded, if "mixed" memory is tested.
+ *     Notifications are received by the listener in notification mechanism and
+ *     crossing of thresholds are detected in polling mechanism. The thresholds
+ *     are updated as soon as notification is received, or crossing of a threshold
+ *     is detected.
+ *     The test also checks stderr to be empty. Otherwise, it fails. The test
+ *     exits as soon as OutOfMemoryError is caught (if heap memory is tested) or
+ *     all classes are loaded (if nonheap or mixed memory is tested).
+ *     All options of the test are specified in *.cfg file. this particular test
+ *         - performs access to the MBeans' method through default MBeanServer;
+ *         - fills mixed memory;
+ *         - implements polling mechanism of monitoring;
+ *         - tests usage thresholds.
+ * COMMENTS
+ *     Fixed the bug
+ *     4969687 TEST_BUG: The spec is updated accoring to 4956978, 4957000, 4959889
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.lowmem.lowmem001
+ *      -testMode=server
+ *      -memory=mixed
+ *      -monitoring=polling
+ *      -threshold=usage
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem018/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem018/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/lowmem/lowmem018.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that enabling of low memory detection does not lead to
+ *     unexpected behaviour: crashes of the VM and undocumented exceptions.
+ *     The test enables low memory detection: it adds NotificationListener
+ *     to the MemoryMBean for notification mechanism of monitoring, or starts
+ *     a special thread for polling mechanism. After that, it starts eating memory.
+ *     Objects are allocated, if "heap" memory is tested; classes are loaded,
+ *     if "nonheap" memory is tested; objects are allocated and classes are
+ *     loaded, if "mixed" memory is tested.
+ *     Notifications are received by the listener in notification mechanism and
+ *     crossing of thresholds are detected in polling mechanism. The thresholds
+ *     are updated as soon as notification is received, or crossing of a threshold
+ *     is detected.
+ *     The test also checks stderr to be empty. Otherwise, it fails. The test
+ *     exits as soon as OutOfMemoryError is caught (if heap memory is tested) or
+ *     all classes are loaded (if nonheap or mixed memory is tested).
+ *     All options of the test are specified in *.cfg file. this particular test
+ *         - performs access to the MBeans' method through custom MBeanServer;
+ *         - fills mixed memory;
+ *         - implements polling mechanism of monitoring;
+ *         - tests usage thresholds.
+ * COMMENTS
+ *     Fixed the bug
+ *     4969687 TEST_BUG: The spec is updated accoring to 4956978, 4957000, 4959889
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.lowmem.lowmem001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ *      -memory=mixed
+ *      -monitoring=polling
+ *      -threshold=usage
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem019/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem019/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/lowmem/lowmem019.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that enabling of low memory detection does not lead to
+ *     unexpected behaviour: crashes of the VM and undocumented exceptions.
+ *     The test enables low memory detection: it adds NotificationListener
+ *     to the MemoryMBean for notification mechanism of monitoring, or starts
+ *     a special thread for polling mechanism. After that, it starts eating memory.
+ *     Objects are allocated, if "heap" memory is tested; classes are loaded,
+ *     if "nonheap" memory is tested; objects are allocated and classes are
+ *     loaded, if "mixed" memory is tested.
+ *     Notifications are received by the listener in notification mechanism and
+ *     crossing of thresholds are detected in polling mechanism. The thresholds
+ *     are updated as soon as notification is received, or crossing of a threshold
+ *     is detected.
+ *     The test also checks stderr to be empty. Otherwise, it fails. The test
+ *     exits as soon as OutOfMemoryError is caught (if heap memory is tested) or
+ *     all classes are loaded (if nonheap or mixed memory is tested).
+ *     All options of the test are specified in *.cfg file. this particular test
+ *         - performs directly access to the MBeans' methods;
+ *         - fills heap memory;
+ *         - implements notifcation mechanism of monitoring;
+ *         - tests collection usage thresholds.
+ * COMMENTS
+ *     Fixed the bug
+ *     4969687 TEST_BUG: The spec is updated accoring to 4956978, 4957000, 4959889
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.lowmem.lowmem001
+ *      -testMode=directly
+ *      -memory=heap
+ *      -monitoring=notification
+ *      -threshold=collection
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem020/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem020/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/lowmem/lowmem020.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that enabling of low memory detection does not lead to
+ *     unexpected behaviour: crashes of the VM and undocumented exceptions.
+ *     The test enables low memory detection: it adds NotificationListener
+ *     to the MemoryMBean for notification mechanism of monitoring, or starts
+ *     a special thread for polling mechanism. After that, it starts eating memory.
+ *     Objects are allocated, if "heap" memory is tested; classes are loaded,
+ *     if "nonheap" memory is tested; objects are allocated and classes are
+ *     loaded, if "mixed" memory is tested.
+ *     Notifications are received by the listener in notification mechanism and
+ *     crossing of thresholds are detected in polling mechanism. The thresholds
+ *     are updated as soon as notification is received, or crossing of a threshold
+ *     is detected.
+ *     The test also checks stderr to be empty. Otherwise, it fails. The test
+ *     exits as soon as OutOfMemoryError is caught (if heap memory is tested) or
+ *     all classes are loaded (if nonheap or mixed memory is tested).
+ *     All options of the test are specified in *.cfg file. this particular test
+ *         - performs access to the MBeans' method through default MBeanServer;
+ *         - fills heap memory;
+ *         - implements notifcation mechanism of monitoring;
+ *         - tests collection usage thresholds.
+ * COMMENTS
+ *     Fixed the bug
+ *     4969687 TEST_BUG: The spec is updated accoring to 4956978, 4957000, 4959889
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.lowmem.lowmem001
+ *      -testMode=server
+ *      -memory=heap
+ *      -monitoring=notification
+ *      -threshold=collection
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem021/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem021/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/lowmem/lowmem021.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that enabling of low memory detection does not lead to
+ *     unexpected behaviour: crashes of the VM and undocumented exceptions.
+ *     The test enables low memory detection: it adds NotificationListener
+ *     to the MemoryMBean for notification mechanism of monitoring, or starts
+ *     a special thread for polling mechanism. After that, it starts eating memory.
+ *     Objects are allocated, if "heap" memory is tested; classes are loaded,
+ *     if "nonheap" memory is tested; objects are allocated and classes are
+ *     loaded, if "mixed" memory is tested.
+ *     Notifications are received by the listener in notification mechanism and
+ *     crossing of thresholds are detected in polling mechanism. The thresholds
+ *     are updated as soon as notification is received, or crossing of a threshold
+ *     is detected.
+ *     The test also checks stderr to be empty. Otherwise, it fails. The test
+ *     exits as soon as OutOfMemoryError is caught (if heap memory is tested) or
+ *     all classes are loaded (if nonheap or mixed memory is tested).
+ *     All options of the test are specified in *.cfg file. this particular test
+ *         - performs access to the MBeans' method through custom MBeanServer;
+ *         - fills heap memory;
+ *         - implements notifcation mechanism of monitoring;
+ *         - tests collection usage thresholds.
+ * COMMENTS
+ *     Fixed the bug
+ *     4969687 TEST_BUG: The spec is updated accoring to 4956978, 4957000, 4959889
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.lowmem.lowmem001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ *      -memory=heap
+ *      -monitoring=notification
+ *      -threshold=collection
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem022/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem022/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/lowmem/lowmem022.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that enabling of low memory detection does not lead to
+ *     unexpected behaviour: crashes of the VM and undocumented exceptions.
+ *     The test enables low memory detection: it adds NotificationListener
+ *     to the MemoryMBean for notification mechanism of monitoring, or starts
+ *     a special thread for polling mechanism. After that, it starts eating memory.
+ *     Objects are allocated, if "heap" memory is tested; classes are loaded,
+ *     if "nonheap" memory is tested; objects are allocated and classes are
+ *     loaded, if "mixed" memory is tested.
+ *     Notifications are received by the listener in notification mechanism and
+ *     crossing of thresholds are detected in polling mechanism. The thresholds
+ *     are updated as soon as notification is received, or crossing of a threshold
+ *     is detected.
+ *     The test also checks stderr to be empty. Otherwise, it fails. The test
+ *     exits as soon as OutOfMemoryError is caught (if heap memory is tested) or
+ *     all classes are loaded (if nonheap or mixed memory is tested).
+ *     All options of the test are specified in *.cfg file. this particular test
+ *         - performs directly access to the MBeans' methods;
+ *         - fills nonheap memory;
+ *         - implements notifcation mechanism of monitoring;
+ *         - tests collection usage thresholds.
+ * COMMENTS
+ *     Fixed the bug
+ *     4969687 TEST_BUG: The spec is updated accoring to 4956978, 4957000, 4959889
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.lowmem.lowmem001
+ *      -testMode=directly
+ *      -memory=nonheap
+ *      -monitoring=notification
+ *      -threshold=collection
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem023/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem023/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/lowmem/lowmem023.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that enabling of low memory detection does not lead to
+ *     unexpected behaviour: crashes of the VM and undocumented exceptions.
+ *     The test enables low memory detection: it adds NotificationListener
+ *     to the MemoryMBean for notification mechanism of monitoring, or starts
+ *     a special thread for polling mechanism. After that, it starts eating memory.
+ *     Objects are allocated, if "heap" memory is tested; classes are loaded,
+ *     if "nonheap" memory is tested; objects are allocated and classes are
+ *     loaded, if "mixed" memory is tested.
+ *     Notifications are received by the listener in notification mechanism and
+ *     crossing of thresholds are detected in polling mechanism. The thresholds
+ *     are updated as soon as notification is received, or crossing of a threshold
+ *     is detected.
+ *     The test also checks stderr to be empty. Otherwise, it fails. The test
+ *     exits as soon as OutOfMemoryError is caught (if heap memory is tested) or
+ *     all classes are loaded (if nonheap or mixed memory is tested).
+ *     All options of the test are specified in *.cfg file. this particular test
+ *         - performs access to the MBeans' method through default MBeanServer;
+ *         - fills nonheap memory;
+ *         - implements notifcation mechanism of monitoring;
+ *         - tests collection usage thresholds.
+ * COMMENTS
+ *     Fixed the bug
+ *     4969687 TEST_BUG: The spec is updated accoring to 4956978, 4957000, 4959889
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.lowmem.lowmem001
+ *      -testMode=server
+ *      -memory=nonheap
+ *      -monitoring=notification
+ *      -threshold=collection
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem024/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem024/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/lowmem/lowmem024.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that enabling of low memory detection does not lead to
+ *     unexpected behaviour: crashes of the VM and undocumented exceptions.
+ *     The test enables low memory detection: it adds NotificationListener
+ *     to the MemoryMBean for notification mechanism of monitoring, or starts
+ *     a special thread for polling mechanism. After that, it starts eating memory.
+ *     Objects are allocated, if "heap" memory is tested; classes are loaded,
+ *     if "nonheap" memory is tested; objects are allocated and classes are
+ *     loaded, if "mixed" memory is tested.
+ *     Notifications are received by the listener in notification mechanism and
+ *     crossing of thresholds are detected in polling mechanism. The thresholds
+ *     are updated as soon as notification is received, or crossing of a threshold
+ *     is detected.
+ *     The test also checks stderr to be empty. Otherwise, it fails. The test
+ *     exits as soon as OutOfMemoryError is caught (if heap memory is tested) or
+ *     all classes are loaded (if nonheap or mixed memory is tested).
+ *     All options of the test are specified in *.cfg file. this particular test
+ *         - performs access to the MBeans' method through custom MBeanServer;
+ *         - fills nonheap memory;
+ *         - implements notifcation mechanism of monitoring;
+ *         - tests collection usage thresholds.
+ * COMMENTS
+ *     Fixed the bug
+ *     4969687 TEST_BUG: The spec is updated accoring to 4956978, 4957000, 4959889
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.lowmem.lowmem001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ *      -memory=nonheap
+ *      -monitoring=notification
+ *      -threshold=collection
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem025/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem025/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/lowmem/lowmem025.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that enabling of low memory detection does not lead to
+ *     unexpected behaviour: crashes of the VM and undocumented exceptions.
+ *     The test enables low memory detection: it adds NotificationListener
+ *     to the MemoryMBean for notification mechanism of monitoring, or starts
+ *     a special thread for polling mechanism. After that, it starts eating memory.
+ *     Objects are allocated, if "heap" memory is tested; classes are loaded,
+ *     if "nonheap" memory is tested; objects are allocated and classes are
+ *     loaded, if "mixed" memory is tested.
+ *     Notifications are received by the listener in notification mechanism and
+ *     crossing of thresholds are detected in polling mechanism. The thresholds
+ *     are updated as soon as notification is received, or crossing of a threshold
+ *     is detected.
+ *     The test also checks stderr to be empty. Otherwise, it fails. The test
+ *     exits as soon as OutOfMemoryError is caught (if heap memory is tested) or
+ *     all classes are loaded (if nonheap or mixed memory is tested).
+ *     All options of the test are specified in *.cfg file. this particular test
+ *         - performs directly access to the MBeans' methods;
+ *         - fills mixed memory;
+ *         - implements notifcation mechanism of monitoring;
+ *         - tests collection usage thresholds.
+ * COMMENTS
+ *     Fixed the bug
+ *     4969687 TEST_BUG: The spec is updated accoring to 4956978, 4957000, 4959889
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.lowmem.lowmem001
+ *      -testMode=directly
+ *      -memory=mixed
+ *      -monitoring=notification
+ *      -threshold=collection
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem026/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem026/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/lowmem/lowmem026.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that enabling of low memory detection does not lead to
+ *     unexpected behaviour: crashes of the VM and undocumented exceptions.
+ *     The test enables low memory detection: it adds NotificationListener
+ *     to the MemoryMBean for notification mechanism of monitoring, or starts
+ *     a special thread for polling mechanism. After that, it starts eating memory.
+ *     Objects are allocated, if "heap" memory is tested; classes are loaded,
+ *     if "nonheap" memory is tested; objects are allocated and classes are
+ *     loaded, if "mixed" memory is tested.
+ *     Notifications are received by the listener in notification mechanism and
+ *     crossing of thresholds are detected in polling mechanism. The thresholds
+ *     are updated as soon as notification is received, or crossing of a threshold
+ *     is detected.
+ *     The test also checks stderr to be empty. Otherwise, it fails. The test
+ *     exits as soon as OutOfMemoryError is caught (if heap memory is tested) or
+ *     all classes are loaded (if nonheap or mixed memory is tested).
+ *     All options of the test are specified in *.cfg file. this particular test
+ *         - performs access to the MBeans' method through default MBeanServer;
+ *         - fills mixed memory;
+ *         - implements notifcation mechanism of monitoring;
+ *         - tests collection usage thresholds.
+ * COMMENTS
+ *     Fixed the bug
+ *     4969687 TEST_BUG: The spec is updated accoring to 4956978, 4957000, 4959889
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.lowmem.lowmem001
+ *      -testMode=server
+ *      -memory=mixed
+ *      -monitoring=notification
+ *      -threshold=collection
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem027/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem027/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/lowmem/lowmem027.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that enabling of low memory detection does not lead to
+ *     unexpected behaviour: crashes of the VM and undocumented exceptions.
+ *     The test enables low memory detection: it adds NotificationListener
+ *     to the MemoryMBean for notification mechanism of monitoring, or starts
+ *     a special thread for polling mechanism. After that, it starts eating memory.
+ *     Objects are allocated, if "heap" memory is tested; classes are loaded,
+ *     if "nonheap" memory is tested; objects are allocated and classes are
+ *     loaded, if "mixed" memory is tested.
+ *     Notifications are received by the listener in notification mechanism and
+ *     crossing of thresholds are detected in polling mechanism. The thresholds
+ *     are updated as soon as notification is received, or crossing of a threshold
+ *     is detected.
+ *     The test also checks stderr to be empty. Otherwise, it fails. The test
+ *     exits as soon as OutOfMemoryError is caught (if heap memory is tested) or
+ *     all classes are loaded (if nonheap or mixed memory is tested).
+ *     All options of the test are specified in *.cfg file. this particular test
+ *         - performs access to the MBeans' method through custom MBeanServer;
+ *         - fills mixed memory;
+ *         - implements notifcation mechanism of monitoring;
+ *         - tests collection usage thresholds.
+ * COMMENTS
+ *     Fixed the bug
+ *     4969687 TEST_BUG: The spec is updated accoring to 4956978, 4957000, 4959889
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.lowmem.lowmem001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ *      -memory=mixed
+ *      -monitoring=notification
+ *      -threshold=collection
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem028/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem028/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/lowmem/lowmem028.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that enabling of low memory detection does not lead to
+ *     unexpected behaviour: crashes of the VM and undocumented exceptions.
+ *     The test enables low memory detection: it adds NotificationListener
+ *     to the MemoryMBean for notification mechanism of monitoring, or starts
+ *     a special thread for polling mechanism. After that, it starts eating memory.
+ *     Objects are allocated, if "heap" memory is tested; classes are loaded,
+ *     if "nonheap" memory is tested; objects are allocated and classes are
+ *     loaded, if "mixed" memory is tested.
+ *     Notifications are received by the listener in notification mechanism and
+ *     crossing of thresholds are detected in polling mechanism. The thresholds
+ *     are updated as soon as notification is received, or crossing of a threshold
+ *     is detected.
+ *     The test also checks stderr to be empty. Otherwise, it fails. The test
+ *     exits as soon as OutOfMemoryError is caught (if heap memory is tested) or
+ *     all classes are loaded (if nonheap or mixed memory is tested).
+ *     All options of the test are specified in *.cfg file. this particular test
+ *         - performs directly access to the MBeans' methods;
+ *         - fills heap memory;
+ *         - implements polling mechanism of monitoring;
+ *         - tests collection usage thresholds.
+ * COMMENTS
+ *     Fixed the bug
+ *     4969687 TEST_BUG: The spec is updated accoring to 4956978, 4957000, 4959889
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.lowmem.lowmem001
+ *      -testMode=directly
+ *      -memory=heap
+ *      -monitoring=polling
+ *      -threshold=collection
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem029/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem029/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/lowmem/lowmem029.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that enabling of low memory detection does not lead to
+ *     unexpected behaviour: crashes of the VM and undocumented exceptions.
+ *     The test enables low memory detection: it adds NotificationListener
+ *     to the MemoryMBean for notification mechanism of monitoring, or starts
+ *     a special thread for polling mechanism. After that, it starts eating memory.
+ *     Objects are allocated, if "heap" memory is tested; classes are loaded,
+ *     if "nonheap" memory is tested; objects are allocated and classes are
+ *     loaded, if "mixed" memory is tested.
+ *     Notifications are received by the listener in notification mechanism and
+ *     crossing of thresholds are detected in polling mechanism. The thresholds
+ *     are updated as soon as notification is received, or crossing of a threshold
+ *     is detected.
+ *     The test also checks stderr to be empty. Otherwise, it fails. The test
+ *     exits as soon as OutOfMemoryError is caught (if heap memory is tested) or
+ *     all classes are loaded (if nonheap or mixed memory is tested).
+ *     All options of the test are specified in *.cfg file. this particular test
+ *         - performs access to the MBeans' method through default MBeanServer;
+ *         - fills heap memory;
+ *         - implements polling mechanism of monitoring;
+ *         - tests collection usage thresholds.
+ * COMMENTS
+ *     Fixed the bug
+ *     4969687 TEST_BUG: The spec is updated accoring to 4956978, 4957000, 4959889
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.lowmem.lowmem001
+ *      -testMode=server
+ *      -memory=heap
+ *      -monitoring=polling
+ *      -threshold=collection
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem030/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem030/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/lowmem/lowmem030.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that enabling of low memory detection does not lead to
+ *     unexpected behaviour: crashes of the VM and undocumented exceptions.
+ *     The test enables low memory detection: it adds NotificationListener
+ *     to the MemoryMBean for notification mechanism of monitoring, or starts
+ *     a special thread for polling mechanism. After that, it starts eating memory.
+ *     Objects are allocated, if "heap" memory is tested; classes are loaded,
+ *     if "nonheap" memory is tested; objects are allocated and classes are
+ *     loaded, if "mixed" memory is tested.
+ *     Notifications are received by the listener in notification mechanism and
+ *     crossing of thresholds are detected in polling mechanism. The thresholds
+ *     are updated as soon as notification is received, or crossing of a threshold
+ *     is detected.
+ *     The test also checks stderr to be empty. Otherwise, it fails. The test
+ *     exits as soon as OutOfMemoryError is caught (if heap memory is tested) or
+ *     all classes are loaded (if nonheap or mixed memory is tested).
+ *     All options of the test are specified in *.cfg file. this particular test
+ *         - performs access to the MBeans' method through custom MBeanServer;
+ *         - fills heap memory;
+ *         - implements polling mechanism of monitoring;
+ *         - tests collection usage thresholds.
+ * COMMENTS
+ *     Fixed the bug
+ *     4969687 TEST_BUG: The spec is updated accoring to 4956978, 4957000, 4959889
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.lowmem.lowmem001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ *      -memory=heap
+ *      -monitoring=polling
+ *      -threshold=collection
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem031/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem031/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/lowmem/lowmem031.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that enabling of low memory detection does not lead to
+ *     unexpected behaviour: crashes of the VM and undocumented exceptions.
+ *     The test enables low memory detection: it adds NotificationListener
+ *     to the MemoryMBean for notification mechanism of monitoring, or starts
+ *     a special thread for polling mechanism. After that, it starts eating memory.
+ *     Objects are allocated, if "heap" memory is tested; classes are loaded,
+ *     if "nonheap" memory is tested; objects are allocated and classes are
+ *     loaded, if "mixed" memory is tested.
+ *     Notifications are received by the listener in notification mechanism and
+ *     crossing of thresholds are detected in polling mechanism. The thresholds
+ *     are updated as soon as notification is received, or crossing of a threshold
+ *     is detected.
+ *     The test also checks stderr to be empty. Otherwise, it fails. The test
+ *     exits as soon as OutOfMemoryError is caught (if heap memory is tested) or
+ *     all classes are loaded (if nonheap or mixed memory is tested).
+ *     All options of the test are specified in *.cfg file. this particular test
+ *         - performs directly access to the MBeans' methods;
+ *         - fills nonheap memory;
+ *         - implements polling mechanism of monitoring;
+ *         - tests collection usage thresholds.
+ * COMMENTS
+ *     Fixed the bug
+ *     4969687 TEST_BUG: The spec is updated accoring to 4956978, 4957000, 4959889
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.lowmem.lowmem001
+ *      -testMode=directly
+ *      -memory=nonheap
+ *      -monitoring=polling
+ *      -threshold=collection
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem032/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem032/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/lowmem/lowmem032.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that enabling of low memory detection does not lead to
+ *     unexpected behaviour: crashes of the VM and undocumented exceptions.
+ *     The test enables low memory detection: it adds NotificationListener
+ *     to the MemoryMBean for notification mechanism of monitoring, or starts
+ *     a special thread for polling mechanism. After that, it starts eating memory.
+ *     Objects are allocated, if "heap" memory is tested; classes are loaded,
+ *     if "nonheap" memory is tested; objects are allocated and classes are
+ *     loaded, if "mixed" memory is tested.
+ *     Notifications are received by the listener in notification mechanism and
+ *     crossing of thresholds are detected in polling mechanism. The thresholds
+ *     are updated as soon as notification is received, or crossing of a threshold
+ *     is detected.
+ *     The test also checks stderr to be empty. Otherwise, it fails. The test
+ *     exits as soon as OutOfMemoryError is caught (if heap memory is tested) or
+ *     all classes are loaded (if nonheap or mixed memory is tested).
+ *     All options of the test are specified in *.cfg file. this particular test
+ *         - performs access to the MBeans' method through default MBeanServer;
+ *         - fills nonheap memory;
+ *         - implements polling mechanism of monitoring;
+ *         - tests collection usage thresholds.
+ * COMMENTS
+ *     Fixed the bug
+ *     4969687 TEST_BUG: The spec is updated accoring to 4956978, 4957000, 4959889
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.lowmem.lowmem001
+ *      -testMode=server
+ *      -memory=nonheap
+ *      -monitoring=polling
+ *      -threshold=collection
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem033/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem033/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/lowmem/lowmem033.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that enabling of low memory detection does not lead to
+ *     unexpected behaviour: crashes of the VM and undocumented exceptions.
+ *     The test enables low memory detection: it adds NotificationListener
+ *     to the MemoryMBean for notification mechanism of monitoring, or starts
+ *     a special thread for polling mechanism. After that, it starts eating memory.
+ *     Objects are allocated, if "heap" memory is tested; classes are loaded,
+ *     if "nonheap" memory is tested; objects are allocated and classes are
+ *     loaded, if "mixed" memory is tested.
+ *     Notifications are received by the listener in notification mechanism and
+ *     crossing of thresholds are detected in polling mechanism. The thresholds
+ *     are updated as soon as notification is received, or crossing of a threshold
+ *     is detected.
+ *     The test also checks stderr to be empty. Otherwise, it fails. The test
+ *     exits as soon as OutOfMemoryError is caught (if heap memory is tested) or
+ *     all classes are loaded (if nonheap or mixed memory is tested).
+ *     All options of the test are specified in *.cfg file. this particular test
+ *         - performs access to the MBeans' method through custom MBeanServer;
+ *         - fills nonheap memory;
+ *         - implements polling mechanism of monitoring;
+ *         - tests collection usage thresholds.
+ * COMMENTS
+ *     Fixed the bug
+ *     4969687 TEST_BUG: The spec is updated accoring to 4956978, 4957000, 4959889
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.lowmem.lowmem001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ *      -memory=nonheap
+ *      -monitoring=polling
+ *      -threshold=collection
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem034/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem034/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/lowmem/lowmem034.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that enabling of low memory detection does not lead to
+ *     unexpected behaviour: crashes of the VM and undocumented exceptions.
+ *     The test enables low memory detection: it adds NotificationListener
+ *     to the MemoryMBean for notification mechanism of monitoring, or starts
+ *     a special thread for polling mechanism. After that, it starts eating memory.
+ *     Objects are allocated, if "heap" memory is tested; classes are loaded,
+ *     if "nonheap" memory is tested; objects are allocated and classes are
+ *     loaded, if "mixed" memory is tested.
+ *     Notifications are received by the listener in notification mechanism and
+ *     crossing of thresholds are detected in polling mechanism. The thresholds
+ *     are updated as soon as notification is received, or crossing of a threshold
+ *     is detected.
+ *     The test also checks stderr to be empty. Otherwise, it fails. The test
+ *     exits as soon as OutOfMemoryError is caught (if heap memory is tested) or
+ *     all classes are loaded (if nonheap or mixed memory is tested).
+ *     All options of the test are specified in *.cfg file. this particular test
+ *         - performs directly access to the MBeans' methods;
+ *         - fills both heap and nonheap memory;
+ *         - implements polling mechanism of monitoring;
+ *         - tests collection usage thresholds.
+ * COMMENTS
+ *     Fixed the bug
+ *     4969687 TEST_BUG: The spec is updated accoring to 4956978, 4957000, 4959889
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.lowmem.lowmem001
+ *      -testMode=directly
+ *      -memory=mixed
+ *      -monitoring=polling
+ *      -threshold=collection
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem035/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem035/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/lowmem/lowmem035.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that enabling of low memory detection does not lead to
+ *     unexpected behaviour: crashes of the VM and undocumented exceptions.
+ *     The test enables low memory detection: it adds NotificationListener
+ *     to the MemoryMBean for notification mechanism of monitoring, or starts
+ *     a special thread for polling mechanism. After that, it starts eating memory.
+ *     Objects are allocated, if "heap" memory is tested; classes are loaded,
+ *     if "nonheap" memory is tested; objects are allocated and classes are
+ *     loaded, if "mixed" memory is tested.
+ *     Notifications are received by the listener in notification mechanism and
+ *     crossing of thresholds are detected in polling mechanism. The thresholds
+ *     are updated as soon as notification is received, or crossing of a threshold
+ *     is detected.
+ *     The test also checks stderr to be empty. Otherwise, it fails. The test
+ *     exits as soon as OutOfMemoryError is caught (if heap memory is tested) or
+ *     all classes are loaded (if nonheap or mixed memory is tested).
+ *     All options of the test are specified in *.cfg file. this particular test
+ *         - performs access to the MBeans' method through default MBeanServer;
+ *         - fills both heap and nonheap memory;
+ *         - implements polling mechanism of monitoring;
+ *         - tests collection usage thresholds.
+ * COMMENTS
+ *     Fixed the bug
+ *     4969687 TEST_BUG: The spec is updated accoring to 4956978, 4957000, 4959889
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.lowmem.lowmem001
+ *      -testMode=server
+ *      -memory=mixed
+ *      -monitoring=polling
+ *      -threshold=collection
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem036/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem036/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/lowmem/lowmem036.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that enabling of low memory detection does not lead to
+ *     unexpected behaviour: crashes of the VM and undocumented exceptions.
+ *     The test enables low memory detection: it adds NotificationListener
+ *     to the MemoryMBean for notification mechanism of monitoring, or starts
+ *     a special thread for polling mechanism. After that, it starts eating memory.
+ *     Objects are allocated, if "heap" memory is tested; classes are loaded,
+ *     if "nonheap" memory is tested; objects are allocated and classes are
+ *     loaded, if "mixed" memory is tested.
+ *     Notifications are received by the listener in notification mechanism and
+ *     crossing of thresholds are detected in polling mechanism. The thresholds
+ *     are updated as soon as notification is received, or crossing of a threshold
+ *     is detected.
+ *     The test also checks stderr to be empty. Otherwise, it fails. The test
+ *     exits as soon as OutOfMemoryError is caught (if heap memory is tested) or
+ *     all classes are loaded (if nonheap or mixed memory is tested).
+ *     All options of the test are specified in *.cfg file. this particular test
+ *         - performs access to the MBeans' method through custom MBeanServer;
+ *         - fills both heap and nonheap memory;
+ *         - implements polling mechanism of monitoring;
+ *         - tests collection usage thresholds.
+ * COMMENTS
+ *     Fixed the bug
+ *     4969687 TEST_BUG: The spec is updated accoring to 4956978, 4957000, 4959889
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      -XX:-UseGCOverheadLimit
+ *      nsk.monitoring.stress.lowmem.lowmem001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ *      -memory=mixed
+ *      -monitoring=polling
+ *      -threshold=collection
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/cmon001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,227 @@
+/*
+ * Copyright (c) 2003, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.stress.thread;
+
+import java.lang.management.*;
+import java.io.*;
+
+import nsk.share.*;
+import nsk.monitoring.share.*;
+
+public class cmon001 {
+    final static long CONST_BARRIER_TIME = 200;
+    final static long ITERATIONS = 50;
+
+    // Precision of value returned by ThreadInfo.getWaitedTime().
+    // System.nanoTime() and ThreadInfo.getWaitedTime() may use
+    // different methods to sample time, so PRECISION is essential to
+    // compare those two times.
+    final static long PRECISION = 3; // Milliseconds
+
+    // Ratio between nano and milli
+    final static long NANO_MILLI = 1000000;
+
+    private static volatile boolean testFailed = false;
+    private static Integer calculated;
+    private static Object common = new Object();
+    private static Object[] finishBarriers;
+    private static long[] startTime;
+    private static long[] endTime;
+    private static long[] waitedTime;
+
+    public static void main(String[] argv) {
+        System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE);
+    }
+
+    public static int run(String[] argv, PrintStream out) {
+        ArgumentHandler argHandler = new ArgumentHandler(argv);
+        Log log = new Log(out, argHandler);
+        ThreadMonitor monitor = Monitor.getThreadMonitor(log, argHandler);
+
+        // The test passes, if thread contention monitoring is not supported
+        if (!monitor.isThreadContentionMonitoringSupported()) {
+            log.display("Thread contention monitoring is not supported.");
+            log.display("TEST PASSED.");
+            return Consts.TEST_PASSED;
+        }
+
+        // Enable thread contention monitoring, if it is supported
+        monitor.setThreadContentionMonitoringEnabled(true);
+
+        int threadCount = argHandler.getThreadCount();
+        MyThread threads[] = new MyThread[threadCount];
+        finishBarriers = new Object[threadCount];
+        startTime = new long[threadCount];
+        endTime = new long[threadCount];
+        waitedTime = new long[threadCount];
+
+        for (int i = 0; i < threadCount; i++)
+            finishBarriers[i] = new Object();
+
+        // Begin a loop which will start a number of threads
+        for (int time = 0; time < ITERATIONS; time++) {
+            log.display("Iteration: " + time);
+
+            calculated = new Integer(0);
+
+            // Start all threads. Half of them are user threads,
+            // others - daemon.
+            for (int i = 0; i < threadCount; i++) {
+                threads[i] = new MyThread(i, time, log, monitor);
+                threads[i].setDaemon(i % 2 == 0);
+                threads[i].start();
+            }
+
+            // Wait for all threads to access "calculated" variable
+            while (calculated.intValue() < threadCount)
+                Thread.currentThread().yield();
+            log.display("All threads have finished calculation: " + calculated);
+
+            // Notify all threads to finish
+            for (int i = 0; i < threadCount; i++)
+                synchronized (finishBarriers[i]) {
+                    finishBarriers[i].notify();
+                }
+
+            // Wait for all threads to die
+            for (int i = 0; i < threadCount; i++)
+                try {
+                    threads[i].join();
+                } catch (InterruptedException e) {
+                    log.complain("Unexpected exception");
+                    e.printStackTrace(log.getOutStream());
+                    testFailed = true;
+                }
+            log.display("All threads have died.");
+
+            // Perform checks
+
+            // All threads must increase "calculated" value by one, so
+            // "calculated" must be equal to number of started threads.
+            if (calculated.intValue() != threadCount) {
+                log.complain("Number of threads that accessed the variable: "
+                           + calculated.intValue() + ", expected: "
+                           + threadCount);
+                testFailed = true;
+            }
+
+            // Waited time of each thread must not be greater than overall
+            // time of execution of the thread.
+            // Precision must be taken into account in this case.
+            for (int i = 0; i < threadCount; i++) {
+                long liveNano = endTime[i] - startTime[i];
+                long liveMilli = liveNano / NANO_MILLI;
+                long leastWaitedTime = 2 * CONST_BARRIER_TIME + time;
+
+                if (leastWaitedTime - 2 * PRECISION > waitedTime[i]) {
+                    // that is not a bug. see 5070997 for details
+                    log.display("Thread " + i + " was waiting for a monitor "
+                               + "for at least " + leastWaitedTime
+                               + " milliseconds, but "
+                               + "ThreadInfo.getWaitedTime() returned value "
+                               + waitedTime[i]);
+                }
+
+                if (liveMilli + PRECISION < waitedTime[i]) {
+                    log.complain("Life time of thread " + i + " is " + liveMilli
+                               + " milliseconds, but "
+                               + "ThreadInfo.getWaitedTime() returned value "
+                               + waitedTime[i]);
+                    testFailed = true;
+                }
+            }
+        } // for time
+
+        if (testFailed)
+            log.complain("TEST FAILED.");
+        return (testFailed) ? Consts.TEST_FAILED : Consts.TEST_PASSED;
+    } // run()
+
+    private static class MyThread extends Thread {
+        int num;
+        int time;
+        Log log;
+        ThreadMonitor monitor;
+        Object constBarrier = new Object();
+        Object varBarrier = new Object();
+
+        MyThread(int num, int time, Log log, ThreadMonitor monitor) {
+            this.num = num;
+            this.time = time;
+            this.log = log;
+            this.monitor = monitor;
+        }
+
+        public void run() {
+            startTime[num] = System.nanoTime();
+
+            // constBarrier does not receive notification, so the thread will
+            // be waiting for CONST_BARRIER_TIME milliseconds
+            synchronized (constBarrier) {
+                try {
+                    constBarrier.wait(CONST_BARRIER_TIME);
+                } catch (InterruptedException e) {
+                    log.complain("Unexpected exception");
+                    e.printStackTrace(log.getOutStream());
+                    testFailed = true;
+                }
+            }
+
+            // varBarrier does not receive notification, so the thread will
+            // be waiting for (CONST_BARRIER_TIME + time) milliseconds. This
+            // time is different for each iteration.
+            synchronized (varBarrier) {
+                try {
+                    varBarrier.wait(CONST_BARRIER_TIME + time);
+                } catch (InterruptedException e) {
+                    log.complain("Unexpected exception");
+                    e.printStackTrace(log.getOutStream());
+                    testFailed = true;
+                }
+            }
+
+            // Increase "calculated" value by one
+            synchronized (common) {
+                synchronized (calculated) {
+                    calculated = new Integer(calculated.intValue() + 1);
+                }
+            }
+
+            synchronized (finishBarriers[num]) {
+                try {
+                    finishBarriers[num].wait(10 * CONST_BARRIER_TIME);
+                } catch (InterruptedException e) {
+                    log.complain("Unexpected exception");
+                    e.printStackTrace(log.getOutStream());
+                    testFailed = true;
+                }
+            }
+
+            // Save all time stats for the thread
+            ThreadInfo info = monitor.getThreadInfo(this.getId(), 0);
+            waitedTime[num] = info.getWaitedTime();
+            endTime[num] = System.nanoTime();
+        }
+    } // class MyThread
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/cmon001/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/cmon001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/thread/cmon001.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that waited time returned by ThreadInfo.getWaitedTime() is
+ *     not greater than overall time of execution of a thread. Also, the test
+ *     checks that waited time is not less than minimal time that each thread
+ *     waits without notifications on Object.wait(long).
+ *     Main thread starts a number of threads that is specified in "-threadCount"
+ *     option. Each thread has three Object.wait(long) blocks; two of them do
+ *     not receieve notifications, therefore a thread will be waiting for at least
+ *     a few milliseconds. All threads access the same Integer variable
+ *     ("calculated") and increase its value by one. Main thread waits until
+ *     "calculated" becomes equal to number of started threads and then perform
+ *     three checks.
+ *     The test fails if "calculated" value is not equal to number of started
+ *     threads. It also fails if value returned by ThreadInfo.getWaitedTime() in
+ *     any thread is greater than overall time of execution of the thread. Also,
+ *     the test fails if waited time is less than time waited in first and second
+ *     Object.wait(long) methods (those objects do not receive notifications).
+ *     Then the test repeats the procedure with starting threads and performing
+ *     checks ITERATIONS times.
+ *     All comparisions of time are made with precision specified in PRECISION
+ *     constant. Values returned by ThreadInfo.getWaitedTime() and
+ *     System.nanoTime() and may use different methods to sample time, so
+ *     PRECISION is essential to compare those two times and is set to 3
+ *     (milliseconds) by default.
+ *     This particular test performs directly access to the MBeans' methods.
+ * COMMENTS
+ *     Fixed the bug
+ *     4983682 TEST BUG: cmon001/2/3 should call System.nanoTime for time
+ *             comparison
+ *     5070997: TEST_BUG: incorrect below-checking of thread waiting time
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.stress.thread.cmon001 -threadCount=400
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/cmon002/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/cmon002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/thread/cmon002.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that waited time returned by ThreadInfo.getWaitedTime() is
+ *     not greater than overall time of execution of a thread. Also, the test
+ *     checks that waited time is not less than minimal time that each thread
+ *     waits without notifications on Object.wait(long).
+ *     Main thread starts a number of threads that is specified in "-threadCount"
+ *     option. Each thread has three Object.wait(long) blocks; two of them do
+ *     not receieve notifications, therefore a thread will be waiting for at least
+ *     a few milliseconds. All threads access the same Integer variable
+ *     ("calculated") and increase its value by one. Main thread waits until
+ *     "calculated" becomes equal to number of started threads and then perform
+ *     three checks.
+ *     The test fails if "calculated" value is not equal to number of started
+ *     threads. It also fails if value returned by ThreadInfo.getWaitedTime() in
+ *     any thread is greater than overall time of execution of the thread. Also,
+ *     the test fails if waited time is less than time waited in first and second
+ *     Object.wait(long) methods (those objects do not receive notifications).
+ *     Then the test repeats the procedure with starting threads and performing
+ *     checks ITERATIONS times.
+ *     All comparisions of time are made with precision specified in PRECISION
+ *     constant. Values returned by ThreadInfo.getWaitedTime() and
+ *     System.nanoTime() and may use different methods to sample time, so
+ *     PRECISION is essential to compare those two times and is set to 3
+ *     (milliseconds) by default.
+ *     This particular test performs access to the MBeans' methods through default
+ *     MBeanServer.
+ * COMMENTS
+ *     Fixed the bug
+ *     4983682 TEST BUG: cmon001/2/3 should call System.nanoTime for time
+ *             comparison
+ *     5070997: TEST_BUG: incorrect below-checking of thread waiting time
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.stress.thread.cmon001 -testMode=server -threadCount=400
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/cmon003/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/cmon003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/thread/cmon003.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that waited time returned by ThreadInfo.getWaitedTime() is
+ *     not greater than overall time of execution of a thread. Also, the test
+ *     checks that waited time is not less than minimal time that each thread
+ *     waits without notifications on Object.wait(long).
+ *     Main thread starts a number of threads that is specified in "-threadCount"
+ *     option. Each thread has three Object.wait(long) blocks; two of them do
+ *     not receieve notifications, therefore a thread will be waiting for at least
+ *     a few milliseconds. All threads access the same Integer variable
+ *     ("calculated") and increase its value by one. Main thread waits until
+ *     "calculated" becomes equal to number of started threads and then perform
+ *     three checks.
+ *     The test fails if "calculated" value is not equal to number of started
+ *     threads. It also fails if value returned by ThreadInfo.getWaitedTime() in
+ *     any thread is greater than overall time of execution of the thread. Also,
+ *     the test fails if waited time is less than time waited in first and second
+ *     Object.wait(long) methods (those objects do not receive notifications).
+ *     Then the test repeats the procedure with starting threads and performing
+ *     checks ITERATIONS times.
+ *     All comparisions of time are made with precision specified in PRECISION
+ *     constant. Values returned by ThreadInfo.getWaitedTime() and
+ *     System.nanoTime() and may use different methods to sample time, so
+ *     PRECISION is essential to compare those two times and is set to 3
+ *     (milliseconds) by default.
+ *     This particular test performs access to the MBeans' methods through custom
+ *     MBeanServer.
+ * COMMENTS
+ *     Fixed the bug
+ *     4983682 TEST BUG: cmon001/2/3 should call System.nanoTime for time
+ *             comparison
+ *     5070997: TEST_BUG: incorrect below-checking of thread waiting time
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.stress.thread.cmon001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ *      -threadCount=400
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace001.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,399 @@
+/*
+ * Copyright (c) 2003, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.stress.thread;
+
+import java.lang.management.*;
+import java.io.*;
+import nsk.share.*;
+import nsk.monitoring.share.*;
+
+public class strace001 {
+    public final static String LIB_NAME = "StackTraceController";
+    private final static String THREAD_NAME
+        = "nsk.monitoring.stress.thread.RunningThread";
+    private final static int ITERATIONS = 50;
+
+    public static volatile boolean finish;
+    public static volatile boolean testFailed = false;
+    public static Object common = new Object();
+    public static Integer activeThreads;
+    private static Log log;
+    private static int depth;
+    private static int threadCount;
+    private static String[] expectedTrace;
+    private static ThreadMonitor monitor;
+    private static ThreadController controller;
+
+    public static void main(String[] argv) {
+        System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE);
+    }
+
+    public static int run(String[] argv, PrintStream out) {
+        ArgumentHandler argHandler = new ArgumentHandler(argv);
+        log = new Log(out, argHandler);
+        monitor = Monitor.getThreadMonitor(log, argHandler);
+        threadCount = argHandler.getThreadCount();
+        depth = argHandler.getThreadDepth();
+        controller = new ThreadController(log, threadCount, depth,
+                                          argHandler.getInvocationType());
+        RunningThread threads[] = new RunningThread[threadCount];
+
+        // Fill expectedTrace array according to invocation type that is set in
+        // test options
+        if ( !fillTrace() ) {
+            log.complain("Unknown invocation type: "
+                       + controller.getInvocationType());
+            return Consts.TEST_FAILED;
+        }
+
+        for (int i = 0; i < ITERATIONS; i++) {
+            log.display("\nIteration: " + i);
+            activeThreads = new Integer(0);
+            finish = false;
+
+            // Start all threads. Half of them are user threads,
+            // others - deamon
+            for (int j = 0; j < threadCount; j++) {
+                threads[j] = new RunningThread(j, controller, log, depth);
+                threads[j].setDaemon(i % 2 == 0);
+                threads[j].start();
+            }
+
+            // Wait for all threads to start
+            while (activeThreads.intValue() < threadCount)
+                Thread.currentThread().yield();
+            log.display("All threads started: " + activeThreads);
+
+            // Make a snapshot of stack trace for all threads and check it
+            for (int j = 0; j < threadCount; j++) {
+                boolean isAlive = threads[j].isAlive();
+                ThreadInfo info = monitor.getThreadInfo(threads[j].getId(), Integer.MAX_VALUE);
+
+                // A thread may be dead because of OutOfMemoryError or
+                // StackOverflowError
+                if (isAlive) {
+                    if (info == null) {
+                        log.complain("ThreadInfo for thread " + j + " is null, "
+                                   + "but Thread.isAlive() returned true.");
+                        testFailed = true;
+                        continue;
+                    }
+
+                    StackTraceElement[] snapshot = info.getStackTrace();
+                    if ( !checkTrace(snapshot) ) {
+                        log.display("\nSnapshot of thread: " + j);
+                        printStackTrace(snapshot);
+                        testFailed = true;
+                    }
+                } else
+                    log.display("Thread " + j + " is dead, skipping it.");
+            }
+
+            // Let all threads to complete their job
+            finish = true;
+
+            // Wait for all threads to be dead
+            for (int j = 0; j < threadCount; j++)
+                try {
+                    threads[j].join();
+                } catch (InterruptedException e) {
+                    log.complain("Unexpected exception while joining thread "
+                               + j);
+                    e.printStackTrace(log.getOutStream());
+                    testFailed = true;
+                }
+            log.display("All threads have died.");
+        } // for i
+
+        if (testFailed)
+            log.complain("TEST FAILED.");
+
+        return (testFailed) ? Consts.TEST_FAILED : Consts.TEST_PASSED;
+    }
+
+    // Fill expectedTrace array according to the invocation type that is set in
+    // test options
+    private static boolean fillTrace() {
+        switch (controller.getInvocationType()) {
+            case ThreadController.JAVA_TYPE:
+                expectedTrace = new String[] {
+                    "java.lang.Thread.sleep"
+                    , "java.lang.Thread.yield"
+                    , THREAD_NAME + ".waitForSign"
+                    , THREAD_NAME + ".recursionJava"
+                    , THREAD_NAME + ".run"
+                };
+                break;
+
+            case ThreadController.NATIVE_TYPE:
+                expectedTrace = new String[] {
+                    "java.lang.Thread.sleep"
+                    , "java.lang.Thread.yield"
+                    , THREAD_NAME + ".waitForSign"
+                    , THREAD_NAME + ".recursionNative"
+                    , THREAD_NAME + ".run"
+                };
+                break;
+
+            case ThreadController.MIXED_TYPE:
+                expectedTrace = new String[] {
+                    "java.lang.Thread.sleep"
+                    , "java.lang.Thread.yield"
+                    , THREAD_NAME + ".waitForSign"
+                    , THREAD_NAME + ".recursionNative"
+                    , THREAD_NAME + ".recursionJava"
+                    , THREAD_NAME + ".run"
+                };
+                break;
+
+            default:
+                return false;
+        }
+
+        return true;
+    }
+
+    // The method prints stack trace in style JVM does
+    private static void printStackTrace(StackTraceElement[] elements) {
+        for (int i = 0; i < elements.length; i++) {
+            String s = "\t " + i + ": " + elements[i].getClassName() + "."
+                     + elements[i].getMethodName();
+
+            if (elements[i].isNativeMethod())
+                s = s + "(Native Method)";
+            else
+                s = s + "(" + elements[i].getFileName() + ":"
+                  + elements[i].getLineNumber() + ")";
+            log.display(s);
+        }
+    }
+
+    // The method performs checks of the stack trace
+    private static boolean checkTrace(StackTraceElement[] elements) {
+        int length = elements.length;
+        int expectedLength = depth +3;
+        boolean result = true;
+
+        // Check the length of the trace. It must not be greater than
+        // expectedLength. Number of recursionJava() or recursionNative()
+        // methods must not ne greater than depth, also one Object.wait() or
+        // Thread.yield() method, one run( ) and one waitForSign().
+        if (length > expectedLength) {
+            log.complain("Length of the stack trace is " + length + ", but "
+                       + "expected to be not greater than " + expectedLength);
+            result = false;
+        }
+
+        // Check each element of the snapshot
+        for (int i = 0; i < elements.length; i++) {
+            if (i == elements.length - 1) {
+
+                // The latest method of the snapshot must be RunningThread.run()
+                if ( !checkLastElement(elements[i]) )
+                    result = false;
+            } else {
+
+                // getClassName() and getMethodName() must return correct values
+                // for each element
+                if ( !checkElement(i, elements[i]) )
+                    result = false;
+            }
+        }
+        return result;
+    }
+
+    // The method checks that StackTraceElement.getClassName() and
+    // StackTraceElement.getMethodName() return expected values
+    private static boolean checkElement(int n, StackTraceElement element) {
+        String name = element.getClassName() + "." + element.getMethodName();
+
+        // The latest element is not checked, since it must be "run()"
+        for (int i = 0; i < expectedTrace.length - 1; i++) {
+            if (expectedTrace[i].equals(name))
+                return true;
+        }
+
+        log.complain("Unexpected " + n + " element of the stack trace:\n\t"
+                   + name);
+        return false;
+    }
+
+    // The method checks that StackTraceElement.getClassName() returns
+    // "RunningThread" and StackTraceElement.getMethodName() returns "run"
+    // for the latest element of the snapshot
+    private static boolean checkLastElement(StackTraceElement element) {
+        String name = element.getClassName() + "." + element.getMethodName();
+        String last = expectedTrace[expectedTrace.length - 1];
+
+        if (!last.equals(name)) {
+            log.complain("Unexpected last element of the stack trace:\n\t"
+                   + name + "\nexpected:\n\t" + last);
+            return false;
+        }
+        return true;
+    }
+}
+
+// This thread starts a recursion until it reaches specified depth. Then the
+// thread waits until it gets a notification from main thread. Pure java
+// and native methods are used in the thread. So, the thread is definitly in
+// "running" state when main thread performs its checks.
+class RunningThread extends Thread {
+    private int num;
+    private static ThreadController controller;
+    private Log log;
+    private int depth;
+    private boolean mixed = false;
+    native int recursionNative(int maxDepth, int currentDepth, boolean returnToJava);
+
+    static {
+        try {
+            System.loadLibrary(strace001.LIB_NAME);
+        } catch (UnsatisfiedLinkError e) {
+            System.err.println("Cannot load library " + strace001.LIB_NAME);
+            System.err.println("java.library.path: "
+                             + System.getProperty("java.library.path"));
+            throw e;
+        }
+    }
+
+    RunningThread(int num, ThreadController controller, Log log, int depth) {
+        this.num = num;
+        this.controller = controller;
+        this.log = log;
+        this.depth = depth;
+    }
+
+    public void run() {
+        int result = 0;
+        int invocationType = controller.getInvocationType();
+
+        // This instance of the thread is alive
+        synchronized (strace001.common) {
+            synchronized (strace001.activeThreads) {
+                strace001.activeThreads
+                    = new Integer(strace001.activeThreads.intValue() + 1);
+            }
+        }
+
+        // Choose a method (native or java) to continue recursion
+        try {
+            switch (invocationType) {
+                case ThreadController.JAVA_TYPE:
+                    recursionJava(depth, 0);
+                    break;
+                case ThreadController.NATIVE_TYPE:
+                    result = recursionNative(depth, 0, false);
+
+                    if (result == 1) {
+                        log.display("Fatal error (OutOfMemoryError or "
+                                + "StackOverflow) is thrown in native method of "
+                                + " thread " + num);
+                        return;
+                    } else if (result == 2) {
+                        log.complain("Unexpected exception is thrown in native "
+                                + "method of thread " + num);
+                        strace001.testFailed = true;
+                        return;
+                    }
+                    break;
+                case ThreadController.MIXED_TYPE:
+                    mixed = true;
+                    result = recursionNative(depth, 0, true);
+
+                    if (result == 1) {
+                        log.display("Fatal error (OutOfMemoryError or "
+                                + "StackOverflow) is thrown in native method of "
+                                + " thread " + num);
+                        return;
+                    } else if (result == 2) {
+                        log.complain("Unexpected exception is thrown in native "
+                                + "method of thread " + num);
+                        strace001.testFailed = true;
+                        return;
+                    }
+                    break;
+                default:
+                    log.complain("Unknown invocation type: "
+                            + controller.getInvocationType());
+                    strace001.testFailed = true;
+            }
+        } catch (OutOfMemoryError e) {
+            // Recursion is too deep, so exit peacefully
+            log.display("OutOfMemoryError is thrown in thread " + num);
+        } catch (StackOverflowError e) {
+            // Recursion is too deep, so exit peacefully
+            log.display("StackOverflowError is thrown in thread " + num);
+        }
+    } // run()
+
+    private void recursionJava(int maxDepth, int currentDepth) {
+        // A short delay. Otherwise the method will reach the specified depth
+        // almost instantly
+        try {
+            sleep(1);
+        } catch (InterruptedException e) {
+            log.complain("Unexpected exception");
+            e.printStackTrace(log.getOutStream());
+            strace001.testFailed = true;
+        }
+
+        currentDepth++;
+        if (maxDepth > currentDepth) {
+            yield();
+            if (mixed) {
+                int result = recursionNative(maxDepth, currentDepth, true);
+
+                 if (result == 1) {
+                     log.display("Fatal error (OutOfMemoryError or "
+                               + "StackOverflow) is thrown in native method of "
+                               + " thread " + num);
+                     return;
+                 } else if (result == 2) {
+                     log.complain("Unexpected exception is thrown in native "
+                                + "method of thread " + num);
+                     strace001.testFailed = true;
+                     return;
+                 }
+            } else
+                recursionJava(maxDepth, currentDepth);
+        }
+
+        waitForSign();
+    } // recursionJava()
+
+    private void waitForSign() {
+        // When the depth is reached, wait for a notification from main thread
+        while (!strace001.finish) {
+            try {
+                sleep(1);
+            } catch (InterruptedException e) {
+                log.complain("Unexpected exception");
+                e.printStackTrace(log.getOutStream());
+                strace001.testFailed = true;
+                break;
+            }
+        }
+    } // waitForSign()
+} // class RunningThread
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace001/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace001/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/thread/strace001.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that ThreadInfo.getStackTrace() returns correct results for
+ *     a thread in "running" state.
+ *     Main thread starts a number of auxiliary threads. This number is specified
+ *     in "-threadCount" option. Auxiliary threads begin a recursion until they
+ *     reach specified depth ("-depth" option). Each thread may use pure java
+ *     and/or native methods based on "-invocationType" option. Then the threads
+ *     wait until they get a notification from main thread. So, those auxiliary
+ *     threads are definitly in "running" state when main thread performs their
+ *     checks.
+ *     Main thread makes a snapshot of stack trace for all threads and checks it:
+ *         1. If a thread is alive, ThreadMonitor.getThreadInfo(long, -1) must
+ *            return not null ThreadInfo.
+ *         2. The length of a trace must not be greater than (depth + 3). Number
+ *            of recursionJava() or recursionNative() methods must not be greater
+ *            than depth, also one Object.wait() or Thread.yield() method, one
+ *            run(), and one waitForSign().
+ *         3. The latest method of the stack trace must be RunningThread.run().
+ *         4. getClassName() and getMethodName() methods must return expected
+ *            values for each element of the stack trace.
+ *     If one of that testcases fail, the test also fails.
+ *     After all threads are checked, main thread notifies them to complete their
+ *     job. Then the test repeats the procedure with starting threads and
+ *     performing checks ITERATIONS times.
+ *     This particular test performs directly access to the MBeans' methods and
+ *     uses pure java methods in auxiliary threads.
+ * COMMENTS
+ *     Fixed the bug:
+ *     4953476 TEST_BUG: The spec is updated accoring to 4944573 and 4947536
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm/native nsk.monitoring.stress.thread.strace001 -threadCount=50 -depth=200
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace002/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace002/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/thread/strace002.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent, jdk_desktop]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that ThreadInfo.getStackTrace() returns correct results for
+ *     a thread in "running" state.
+ *     Main thread starts a number of auxiliary threads. This number is specified
+ *     in "-threadCount" option. Auxiliary threads begin a recursion until they
+ *     reach specified depth ("-depth" option). Each thread may use pure java
+ *     and/or native methods based on "-invocationType" option. Then the threads
+ *     wait until they get a notification from main thread. So, those auxiliary
+ *     threads are definitly in "running" state when main thread performs their
+ *     checks.
+ *     Main thread makes a snapshot of stack trace for all threads and checks it:
+ *         1. If a thread is alive, ThreadMonitor.getThreadInfo(long, -1) must
+ *            return not null ThreadInfo.
+ *         2. The length of a trace must not be greater than (depth + 3). Number
+ *            of recursionJava() or recursionNative() methods must not be greater
+ *            than depth, also one Object.wait() or Thread.yield() method, one
+ *            run(), and one waitForSign().
+ *         3. The latest method of the stack trace must be RunningThread.run().
+ *         4. getClassName() and getMethodName() methods must return expected
+ *            values for each element of the stack trace.
+ *     If one of that testcases fail, the test also fails.
+ *     After all threads are checked, main thread notifies them to complete their
+ *     job. Then the test repeats the procedure with starting threads and
+ *     performing checks ITERATIONS times.
+ *     This particular test performs access to the MBeans' methods through default
+ *     MBeanServer and uses pure java methods in auxiliary threads.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm/native
+ *      nsk.monitoring.stress.thread.strace001
+ *      -testMode=server
+ *      -threadCount=50
+ *      -depth=200
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace003/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace003/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/thread/strace003.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent, jdk_desktop]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that ThreadInfo.getStackTrace() returns correct results for
+ *     a thread in "running" state.
+ *     Main thread starts a number of auxiliary threads. This number is specified
+ *     in "-threadCount" option. Auxiliary threads begin a recursion until they
+ *     reach specified depth ("-depth" option). Each thread may use pure java
+ *     and/or native methods based on "-invocationType" option. Then the threads
+ *     wait until they get a notification from main thread. So, those auxiliary
+ *     threads are definitly in "running" state when main thread performs their
+ *     checks.
+ *     Main thread makes a snapshot of stack trace for all threads and checks it:
+ *         1. If a thread is alive, ThreadMonitor.getThreadInfo(long, -1) must
+ *            return not null ThreadInfo.
+ *         2. The length of a trace must not be greater than (depth + 3). Number
+ *            of recursionJava() or recursionNative() methods must not be greater
+ *            than depth, also one Object.wait() or Thread.yield() method, one
+ *            run(), and one waitForSign().
+ *         3. The latest method of the stack trace must be RunningThread.run().
+ *         4. getClassName() and getMethodName() methods must return expected
+ *            values for each element of the stack trace.
+ *     If one of that testcases fail, the test also fails.
+ *     After all threads are checked, main thread notifies them to complete their
+ *     job. Then the test repeats the procedure with starting threads and
+ *     performing checks ITERATIONS times.
+ *     This particular test performs access to the MBeans' methods through custom
+ *     MBeanServer and uses pure java methods in auxiliary threads.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm/native
+ *      nsk.monitoring.stress.thread.strace001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ *      -threadCount=50
+ *      -depth=200
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace004/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace004/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/thread/strace004.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that ThreadInfo.getStackTrace() returns correct results for
+ *     a thread in "running" state.
+ *     Main thread starts a number of auxiliary threads. This number is specified
+ *     in "-threadCount" option. Auxiliary threads begin a recursion until they
+ *     reach specified depth ("-depth" option). Each thread may use pure java
+ *     and/or native methods based on "-invocationType" option. Then the threads
+ *     wait until they get a notification from main thread. So, those auxiliary
+ *     threads are definitly in "running" state when main thread performs their
+ *     checks.
+ *     Main thread makes a snapshot of stack trace for all threads and checks it:
+ *         1. If a thread is alive, ThreadMonitor.getThreadInfo(long, -1) must
+ *            return not null ThreadInfo.
+ *         2. The length of a trace must not be greater than (depth + 3). Number
+ *            of recursionJava() or recursionNative() methods must not be greater
+ *            than depth, also one Object.wait() or Thread.yield() method, one
+ *            run(), and one waitForSign().
+ *         3. The latest method of the stack trace must be RunningThread.run().
+ *         4. getClassName() and getMethodName() methods must return expected
+ *            values for each element of the stack trace.
+ *     If one of that testcases fail, the test also fails.
+ *     After all threads are checked, main thread notifies them to complete their
+ *     job. Then the test repeats the procedure with starting threads and
+ *     performing checks ITERATIONS times.
+ *     This particular test performs directly access to the MBeans' methods and
+ *     uses native methods in auxiliary threads.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm/native
+ *      nsk.monitoring.stress.thread.strace001
+ *      -invocationType=native
+ *      -threadCount=50
+ *      -depth=200
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace005/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace005/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/thread/strace005.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent, jdk_desktop]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that ThreadInfo.getStackTrace() returns correct results for
+ *     a thread in "running" state.
+ *     Main thread starts a number of auxiliary threads. This number is specified
+ *     in "-threadCount" option. Auxiliary threads begin a recursion until they
+ *     reach specified depth ("-depth" option). Each thread may use pure java
+ *     and/or native methods based on "-invocationType" option. Then the threads
+ *     wait until they get a notification from main thread. So, those auxiliary
+ *     threads are definitly in "running" state when main thread performs their
+ *     checks.
+ *     Main thread makes a snapshot of stack trace for all threads and checks it:
+ *         1. If a thread is alive, ThreadMonitor.getThreadInfo(long, -1) must
+ *            return not null ThreadInfo.
+ *         2. The length of a trace must not be greater than (depth + 3). Number
+ *            of recursionJava() or recursionNative() methods must not be greater
+ *            than depth, also one Object.wait() or Thread.yield() method, one
+ *            run(), and one waitForSign().
+ *         3. The latest method of the stack trace must be RunningThread.run().
+ *         4. getClassName() and getMethodName() methods must return expected
+ *            values for each element of the stack trace.
+ *     If one of that testcases fail, the test also fails.
+ *     After all threads are checked, main thread notifies them to complete their
+ *     job. Then the test repeats the procedure with starting threads and
+ *     performing checks ITERATIONS times.
+ *     This particular test performs access to the MBeans' methods through default
+ *     MBeanServer and uses native methods in auxiliary threads.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm/native
+ *      nsk.monitoring.stress.thread.strace001
+ *      -testMode=server
+ *      -invocationType=native
+ *      -threadCount=50
+ *      -depth=200
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace006/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace006/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/thread/strace006.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent, jdk_desktop]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that ThreadInfo.getStackTrace() returns correct results for
+ *     a thread in "running" state.
+ *     Main thread starts a number of auxiliary threads. This number is specified
+ *     in "-threadCount" option. Auxiliary threads begin a recursion until they
+ *     reach specified depth ("-depth" option). Each thread may use pure java
+ *     and/or native methods based on "-invocationType" option. Then the threads
+ *     wait until they get a notification from main thread. So, those auxiliary
+ *     threads are definitly in "running" state when main thread performs their
+ *     checks.
+ *     Main thread makes a snapshot of stack trace for all threads and checks it:
+ *         1. If a thread is alive, ThreadMonitor.getThreadInfo(long, -1) must
+ *            return not null ThreadInfo.
+ *         2. The length of a trace must not be greater than (depth + 3). Number
+ *            of recursionJava() or recursionNative() methods must not be greater
+ *            than depth, also one Object.wait() or Thread.yield() method, one
+ *            run(), and one waitForSign().
+ *         3. The latest method of the stack trace must be RunningThread.run().
+ *         4. getClassName() and getMethodName() methods must return expected
+ *            values for each element of the stack trace.
+ *     If one of that testcases fail, the test also fails.
+ *     After all threads are checked, main thread notifies them to complete their
+ *     job. Then the test repeats the procedure with starting threads and
+ *     performing checks ITERATIONS times.
+ *     This particular test performs access to the MBeans' methods through custom
+ *     MBeanServer and uses native methods in auxiliary threads.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm/native
+ *      nsk.monitoring.stress.thread.strace001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ *      -invocationType=native
+ *      -threadCount=50
+ *      -depth=200
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace007/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace007/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/thread/strace007.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that ThreadInfo.getStackTrace() returns correct results for
+ *     a thread in "running" state.
+ *     Main thread starts a number of auxiliary threads. This number is specified
+ *     in "-threadCount" option. Auxiliary threads begin a recursion until they
+ *     reach specified depth ("-depth" option). Each thread may use pure java
+ *     and/or native methods based on "-invocationType" option. Then the threads
+ *     wait until they get a notification from main thread. So, those auxiliary
+ *     threads are definitly in "running" state when main thread performs their
+ *     checks.
+ *     Main thread makes a snapshot of stack trace for all threads and checks it:
+ *         1. If a thread is alive, ThreadMonitor.getThreadInfo(long, -1) must
+ *            return not null ThreadInfo.
+ *         2. The length of a trace must not be greater than (depth + 3). Number
+ *            of recursionJava() or recursionNative() methods must not be greater
+ *            than depth, also one Object.wait() or Thread.yield() method, one
+ *            run(), and one waitForSign().
+ *         3. The latest method of the stack trace must be RunningThread.run().
+ *         4. getClassName() and getMethodName() methods must return expected
+ *            values for each element of the stack trace.
+ *     If one of that testcases fail, the test also fails.
+ *     After all threads are checked, main thread notifies them to complete their
+ *     job. Then the test repeats the procedure with starting threads and
+ *     performing checks ITERATIONS times.
+ *     This particular test performs directly access to the MBeans' methods and
+ *     uses pure java methods along with native methods in auxiliary threads.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm/native
+ *      nsk.monitoring.stress.thread.strace001
+ *      -invocationType=mixed
+ *      -threadCount=50
+ *      -depth=200
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace008/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace008/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/thread/strace008.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent, jdk_desktop]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that ThreadInfo.getStackTrace() returns correct results for
+ *     a thread in "running" state.
+ *     Main thread starts a number of auxiliary threads. This number is specified
+ *     in "-threadCount" option. Auxiliary threads begin a recursion until they
+ *     reach specified depth ("-depth" option). Each thread may use pure java
+ *     and/or native methods based on "-invocationType" option. Then the threads
+ *     wait until they get a notification from main thread. So, those auxiliary
+ *     threads are definitly in "running" state when main thread performs their
+ *     checks.
+ *     Main thread makes a snapshot of stack trace for all threads and checks it:
+ *         1. If a thread is alive, ThreadMonitor.getThreadInfo(long, -1) must
+ *            return not null ThreadInfo.
+ *         2. The length of a trace must not be greater than (depth + 3). Number
+ *            of recursionJava() or recursionNative() methods must not be greater
+ *            than depth, also one Object.wait() or Thread.yield() method, one
+ *            run(), and one waitForSign().
+ *         3. The latest method of the stack trace must be RunningThread.run().
+ *         4. getClassName() and getMethodName() methods must return expected
+ *            values for each element of the stack trace.
+ *     If one of that testcases fail, the test also fails.
+ *     After all threads are checked, main thread notifies them to complete their
+ *     job. Then the test repeats the procedure with starting threads and
+ *     performing checks ITERATIONS times.
+ *     This particular test performs access to the MBeans' methods through default
+ *     MBeanServer and uses pure java methods along with native methods in
+ *     auxiliary threads.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm/native
+ *      nsk.monitoring.stress.thread.strace001
+ *      -testMode=server
+ *      -invocationType=mixed
+ *      -threadCount=50
+ *      -depth=200
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace009/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace009/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/thread/strace009.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent, jdk_desktop]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test checks that ThreadInfo.getStackTrace() returns correct results for
+ *     a thread in "running" state.
+ *     Main thread starts a number of auxiliary threads. This number is specified
+ *     in "-threadCount" option. Auxiliary threads begin a recursion until they
+ *     reach specified depth ("-depth" option). Each thread may use pure java
+ *     and/or native methods based on "-invocationType" option. Then the threads
+ *     wait until they get a notification from main thread. So, those auxiliary
+ *     threads are definitly in "running" state when main thread performs their
+ *     checks.
+ *     Main thread makes a snapshot of stack trace for all threads and checks it:
+ *         1. If a thread is alive, ThreadMonitor.getThreadInfo(long, -1) must
+ *            return not null ThreadInfo.
+ *         2. The length of a trace must not be greater than (depth + 3). Number
+ *            of recursionJava() or recursionNative() methods must not be greater
+ *            than depth, also one Object.wait() or Thread.yield() method, one
+ *            run(), and one waitForSign().
+ *         3. The latest method of the stack trace must be RunningThread.run().
+ *         4. getClassName() and getMethodName() methods must return expected
+ *            values for each element of the stack trace.
+ *     If one of that testcases fail, the test also fails.
+ *     After all threads are checked, main thread notifies them to complete their
+ *     job. Then the test repeats the procedure with starting threads and
+ *     performing checks ITERATIONS times.
+ *     This particular test performs access to the MBeans' methods through custom
+ *     MBeanServer and uses pure java methods along with native methods in
+ *     auxiliary threads.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm/native
+ *      nsk.monitoring.stress.thread.strace001
+ *      -testMode=server
+ *      -MBeanServer=custom
+ *      -invocationType=mixed
+ *      -threadCount=50
+ *      -depth=200
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace010.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,208 @@
+/*
+ * Copyright (c) 2003, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.monitoring.stress.thread;
+
+import java.io.*;
+import java.lang.management.*;
+
+import nsk.share.*;
+import nsk.monitoring.share.*;
+
+/**
+ * The test starts recursive threads, switches them  to the various
+ * state after reaching defined depth and checks up their stack traces
+ * and states gotten via the ThreadMBean interface. The test may be executed
+ * with the following parameters:
+ * <ul>
+ *      <li>
+ *          <code>depth</code> specifies depth of the recursion.
+ *      <li>
+ *          <code>threadCount</code> specifies amount of the threads.
+ * </ul>
+ *
+ * <p>The other parameters which may have an influence on running test are:
+ * <ul>
+ *      <li>
+ *          <code>testMode</code> defines modes access to MBean:
+ *          <ul>
+ *              <li><code>DIRECTLY</code> - directly access to MBean(default
+ *                  value),
+ *              <li><code>SERVER</code> - an access through MBeanServer
+ *          </ul>
+ *      <li>
+ *          <code>MBeanServer</code> defines a MBean server implemetation
+ *          under which test is executed:
+ *          <ul>
+ *              <li><code>DEFAULT</code> - default JMX implementation of
+ *                  MBeanServer (default value);
+ *              <li><code>CUSTOM</code> - implementation provided by NSK J2SE
+ *                  SQE Team
+ *          </ul>
+ *      <li>
+ *          <code>invocationType</code> defines the following kinds of recursive
+ *                method:
+ *          <ul>
+ *              <li><code>java</code> - pure java ones
+ *              <li><code>native</code> - native recursive ones
+ *          </ul>
+ *  Note:  The recursion are performed by invoking the follow kinds of methods:
+ * </ul>
+ * For details about arguments, see the {@link
+ * nsk.monitoring.share.ArgumentHandler ArgumentHamdler} description .
+ *
+ * <p>The test starts recursive threads via {@link
+ * nsk.monitoring.share.ThreadController ThreadController} according to
+ * specified parameters and switches them to the various state. The test sets
+ * every thread should be switched in one of the following states:
+ * <code>BLOCKED</code>, <code>WAITING</code>, <code>SLEEPING</code> or
+ * <code>RUNNING</code>.
+ * <p>After threads are reaching the specified state, test checks up their stack
+ * traces and states gotten via the ThreadMBean interface.
+ * <p>The test fails if state of some thread gotten via the ThreadMBean
+ * interface doesn't correspond to the state specified by the test or stack
+ * trace contains an extra element. Expected stack trace elements are specified
+ * by {@link nsk.monitoring.share.ThreadMonitor ThreadMonitor}
+ *
+ * @see ThreadMonitor
+ * @see ThreadController
+ * @see ArgumentHandler
+ *
+ */
+public class strace010 {
+
+    public static void main(String[] argv) {
+        System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE);
+    }
+
+    public static int run(String[] argv, PrintStream out) {
+        return new strace010().runIt(argv, out);
+    }
+
+    public int runIt(String [] args, PrintStream out) {
+        boolean res = true;
+
+        ArgumentHandler argHandler = new ArgumentHandler(args);
+
+        Log log = new Log(out, argHandler);
+
+        int threadCount = argHandler.getThreadCount();
+        int maxDepth = argHandler.getThreadDepth();
+
+
+        ThreadMonitor threadMonitor = Monitor.getThreadMonitor(log, argHandler);
+        ThreadController controller = new ThreadController(log, threadCount, maxDepth,
+                                                argHandler.getInvocationType());
+
+        log.display("\nStarting threads.\n");
+        controller.run();
+        log.display("\nStates of the threads are culminated.");
+
+        long[] threadIDs = threadMonitor.getAllThreadIds();
+        ThreadInfo[] info = new ThreadInfo[threadIDs.length];    //info from MBean
+
+        int kinds = controller.getThreadKindCount();
+        int[] threadCounts = new int[kinds];
+
+        for (int i = 0; i < kinds; i++) {
+            threadCounts[i] = 0;
+        }
+        for(int i = 0; i < threadIDs.length; i++) {
+            try {
+                info[i] = threadMonitor.getThreadInfo(threadIDs[i], Integer.MAX_VALUE);
+            } catch (Exception e) {
+                log.complain("\tUnexpected " + e);
+                return Consts.TEST_FAILED;
+            }
+
+            if (info[i] == null) continue;
+            int err = controller.checkThreadInfo(info[i]);
+
+            switch (err) {
+            case ThreadController.ERR_THREAD_NOTFOUND:
+                log.complain("\tThread not found:" + info[i].getThreadName());
+                res = false;
+                break;
+
+            case ThreadController.ERR_STATE:
+                log.complain("\tThread " + info[i].getThreadName()
+                                    + " wrong thread state: "
+                                    + info[i].getThreadState());
+                res = false;
+                break;
+
+            case ThreadController.ERR_STACKTRACE:
+
+                log.complain("\nWrong stack trace for thread name: "
+                                        + info[i].getThreadName());
+                log.complain("----------------------------------");
+                log.complain("\tthread ID:" + info[i].getThreadId()
+                                    + "(" + threadIDs[i] + ")");
+                StackTraceElement[] elements = info[i].getStackTrace();
+                for (int j = 0; j < (elements.length<5?elements.length:5); j++)
+                    log.complain("\t\t" + elements[j]);
+                res = false;
+                break;
+            }
+
+            if ( controller.findThread(info[i].getThreadId()) != null) {
+
+                if (info[i].getThreadState() == Thread.State.BLOCKED) {
+                    threadCounts[ThreadController.BLOCKED_IDX]++;
+
+                } else if (info[i].getThreadState() == Thread.State.WAITING) {
+                    threadCounts[ThreadController.WAITING_IDX]++;
+
+                } else if (info[i].getThreadState() == Thread.State.TIMED_WAITING) {
+                    threadCounts[ThreadController.SLEEPING_IDX]++;
+
+                } else if (info[i].getThreadState() == Thread.State.RUNNABLE) {
+                    threadCounts[ThreadController.RUNNING_IDX]++;
+                }
+            }
+        }
+        controller.reset();
+
+        log.display("");
+        for (int i = 0; i < kinds; i++) {
+            Thread.State state =  ThreadController.THREAD_KINDS[i];
+            log.display("Checked " + threadCounts[i] + " " + state + " threads");
+            if (controller.getThreadCount(state) != threadCounts[i]) {
+                log.complain("Expected amount: " + controller.getThreadCount(state)
+                           + " for " + state
+                           + " threads" + " actual: " + threadCounts[i]);
+                res = false;
+            }
+        }
+        log.display("");
+        controller.reset();
+
+        if (res) {
+            log.display("\nTest PASSED");
+            return Consts.TEST_PASSED;
+        }
+
+        log.display("\nTest FAILED");
+        return Consts.TEST_FAILED;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace010/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace010/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/thread/strace010.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test starts 50 recursive threads, switches them  to the various
+ *     state after reaching 200 depth and checks up their stack traces
+ *     and states gotten via the ThreadMBean interface.
+ *     Access to the management metrics is accomplished by DIRECTLY calling
+ *     the methods in the MBean.
+ * COMMENTS
+ *     Fixed the bug:
+ *     4953476 TEST_BUG: The spec is updated accoring to 4944573 and 4947536
+ *     Fixed the bug:
+ *     4969687 TEST_BUG: The spec is updated accoring to 4956978, 4957000, 4959889
+ *     Reduced recursion depth value up to 100 because the test fails
+ *     due to timeout in -Xint mode on solaris-sparc(Sun Ultra-10, 333 MHz, 256Mb)
+ *     Adjusted according to
+ *     5014783 Move ThreadState class from java.lang.management to java.lang
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm nsk.monitoring.stress.thread.strace010 -depth=100 -threadCount=30
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace011/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace011/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/thread/strace011.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent, jdk_desktop]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test starts 50 recursive threads, switches them  to the various
+ *     state after reaching 200 depth and checks up their stack traces
+ *     and states gotten via the ThreadMBean interface.
+ *     Executable class of the test is the same as for the strace010 test.
+ *     In contrast to the strace010 test, the strace011 test is performed for
+ *     that:
+ *     Access to the management metrics is accomplished by calling via
+ *     default MBeanServer the methods in the MBean.
+ * COMMENTS
+ *     Reduced recursion depth value up to 100 because the test fails
+ *     due to timeout in -Xint mode on solaris-sparc(Sun Ultra-10, 333 MHz, 256Mb)
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.stress.thread.strace010
+ *      -testMode=server
+ *      -depth=100
+ *      -threadCount=30
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace012/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace012/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/thread/strace012.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent, jdk_desktop]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test starts 50 recursive threads, switches them  to the various
+ *     state after reaching 200 depth and checks up their stack traces
+ *     and states gotten via the ThreadMBean interface.
+ *     Executable class of the test is the same as for the strace010 test.
+ *     In contrast to the strace010 test, the strace012 test is performed for
+ *     that:
+ *     Access to the management metrics is accomplished by calling via
+ *     custom MBeanServer the methods in the MBean.
+ * COMMENTS
+ *     Reduced recursion depth value up to 100 because the test fails
+ *     due to timeout in -Xint mode on solaris-sparc(Sun Ultra-10, 333 MHz, 256Mb)
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.stress.thread.strace010
+ *      -testMode=server
+ *      -MBeanServer=custom
+ *      -depth=100
+ *      -threadCount=30
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace013/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace013/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/thread/strace013.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test starts 50 recursive threads, switches them  to the various
+ *     state after reaching 200 depth and checks up their stack traces
+ *     and states gotten via the ThreadMBean interface.
+ *     Executable class of the test is the same as for the strace010 test.
+ *     In contrast to the strace010 test, the strace013 test is performed for
+ *     the case when recursive method is native.
+ *     Access to the management metrics is accomplished by DIRECTLY calling
+ *     the methods in the MBean.
+ * COMMENTS
+ *     Reduced recursion depth value up to 100 because the test fails
+ *     due to timeout in -Xint mode on solaris-sparc(Sun Ultra-10, 333 MHz, 256Mb)
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.stress.thread.strace010
+ *      -depth=100
+ *      -threadCount=30
+ *      -invocationType=native
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace014/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace014/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/thread/strace014.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent, jdk_desktop]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test starts 50 recursive threads, switches them  to the various
+ *     state after reaching 200 depth and checks up their stack traces
+ *     and states gotten via the ThreadMBean interface.
+ *     Executable class of the test is the same as for the strace011 test.
+ *     In contrast to the strace011 test, the strace014 test is performed for
+ *     the case when recursive method is native.
+ *     Access to the management metrics is accomplished by calling via
+ *     default MBeanServer the methods in the MBean.
+ * COMMENTS
+ *     Reduced recursion depth value up to 100 because the test fails
+ *     due to timeout in -Xint mode on solaris-sparc(Sun Ultra-10, 333 MHz, 256Mb)
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.stress.thread.strace010
+ *      -testMode=server
+ *      -depth=100
+ *      -threadCount=30
+ *      -invocationType=native
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace015/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace015/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/thread/strace015.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent, jdk_desktop]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test starts 50 recursive threads, switches them  to the various
+ *     state after reaching 200 depth and checks up their stack traces
+ *     and states gotten via the ThreadMBean interface.
+ *     Executable class of the test is the same as for the strace012 test.
+ *     In contrast to the strace012 test, the strace015 test is performed for
+ *     the case when recursive method is native.
+ *     Access to the management metrics is accomplished by calling via
+ *     custom MBeanServer the methods in the MBean.
+ * COMMENTS
+ *     Reduced recursion depth value up to 100 because the test fails
+ *     due to timeout in -Xint mode on solaris-sparc(Sun Ultra-10, 333 MHz, 256Mb)
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.stress.thread.strace010
+ *      -testMode=server
+ *      -MBeanServer=custom
+ *      -depth=100
+ *      -threadCount=30
+ *      -invocationType=native
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace016/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace016/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/thread/strace016.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test starts 50 recursive threads, switches them  to the various
+ *     state after reaching 200 depth and checks up their stack traces
+ *     and states gotten via the ThreadMBean interface.
+ *     Executable class of the test is the same as for the strace013 test.
+ *     In contrast to the strace013 test, the strace016 test is performed for
+ *     the case when recursive method is native and pure java by turn.
+ *     Access to the management metrics is accomplished by DIRECTLY calling
+ *     the methods in the MBean.
+ * COMMENTS
+ *     Reduced recursion depth value up to 100 because the test fails
+ *     due to timeout in -Xint mode on solaris-sparc(Sun Ultra-10, 333 MHz, 256Mb)
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.stress.thread.strace010
+ *      -depth=100
+ *      -threadCount=30
+ *      -invocationType=mixed
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace017/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace017/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/thread/strace017.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent, jdk_desktop]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test starts 50 recursive threads, switches them  to the various
+ *     state after reaching 200 depth and checks up their stack traces
+ *     and states gotten via the ThreadMBean interface.
+ *     Executable class of the test is the same as for the strace014 test.
+ *     In contrast to the strace014 test, the strace017 test is performed for
+ *     the case when recursive method is native and pure java by turn.
+ *     Access to the management metrics is accomplished by calling via
+ *     default MBeanServer the methods in the MBean.
+ * COMMENTS
+ *     Reduced recursion depth value up to 100 because the test fails
+ *     due to timeout in -Xint mode on solaris-sparc(Sun Ultra-10, 333 MHz, 256Mb)
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.stress.thread.strace010
+ *      -testMode=server
+ *      -depth=100
+ *      -threadCount=30
+ *      -invocationType=mixed
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace018/TEST.properties	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2017, 2018, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+exclusiveAccess.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace018/TestDescription.java	Wed May 02 16:43:56 2018 -0700
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2017, 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @key stress
+ *
+ * @summary converted from VM Testbase nsk/monitoring/stress/thread/strace018.
+ * VM Testbase keywords: [stress, monitoring, nonconcurrent, jdk_desktop]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     The test starts 50 recursive threads, switches them  to the various
+ *     state after reaching 200 depth and checks up their stack traces
+ *     and states gotten via the ThreadMBean interface.
+ *     Executable class of the test is the same as for the strace015 test.
+ *     In contrast to the strace015 test, the strace018 test is performed for
+ *     the case when recursive method is native and pure java by turn.
+ *     Access to the management metrics is accomplished by calling via
+ *     custom MBeanServer the methods in the MBean.
+ * COMMENTS
+ *     Reduced recursion depth value up to 100 because the test fails
+ *     due to timeout in -Xint mode on solaris-sparc(Sun Ultra-10, 333 MHz, 256Mb)
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @run main/othervm
+ *      nsk.monitoring.stress.thread.strace010
+ *      -testMode=server
+ *      -MBeanServer=custom
+ *      -depth=100
+ *      -threadCount=30
+ *      -invocationType=mixed
+ */
+
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/ArgumentParser.java	Wed May 02 19:24:52 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/ArgumentParser.java	Wed May 02 16:43:56 2018 -0700
@@ -100,7 +100,7 @@
  * @see nsk.share.jdwp.ArgumentHandler
  * @see nsk.share.jdi.ArgumentHandler
  * @see nsk.share.jvmti.ArgumentHandler
- * @see nsk.share.monitoring.ArgumentHandler
+ * @see nsk.monitoring.share.ArgumentHandler
  */
 public class ArgumentParser {
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/README	Wed May 02 19:24:52 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/README	Wed May 02 16:43:56 2018 -0700
@@ -100,7 +100,6 @@
         nsk.share.jdwp
         nsk.share.jdi
         nsk.share.jdb
-        nsk.share.monitoring
         nsk.share.sysdict
 
 Native functions and macroses: