本文整理汇总了Java中java.lang.management.ManagementFactory.getMemoryManagerMXBeans方法的典型用法代码示例。如果您正苦于以下问题:Java ManagementFactory.getMemoryManagerMXBeans方法的具体用法?Java ManagementFactory.getMemoryManagerMXBeans怎么用?Java ManagementFactory.getMemoryManagerMXBeans使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.lang.management.ManagementFactory
的用法示例。
在下文中一共展示了ManagementFactory.getMemoryManagerMXBeans方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: runTest
import java.lang.management.ManagementFactory; //导入方法依赖的package包/类
protected void runTest() {
List<MemoryManagerMXBean> beans
= ManagementFactory.getMemoryManagerMXBeans();
Optional<MemoryManagerMXBean> any = beans
.stream()
.filter(bean -> CC_MANAGER.equals(bean.getName()))
.findAny();
Asserts.assertTrue(any.isPresent(), "Bean not found: " + CC_MANAGER);
MemoryManagerMXBean ccManager = any.get();
Asserts.assertNotNull(ccManager, "Found null for " + CC_MANAGER);
String names[] = ccManager.getMemoryPoolNames();
for (String name : names) {
counters.put(name, counters.containsKey(name)
? counters.get(name) + 1 : 1);
}
for (BlobType btype : BlobType.getAvailable()) {
Asserts.assertEQ(counters.get(btype.getMemoryPool().getName()), 1,
"Found unexpected amount of beans for pool "
+ btype.getMemoryPool().getName());
}
Asserts.assertEQ(BlobType.getAvailable().size(),
counters.keySet().size(), "Unexpected amount of bean names");
}
示例2: verifyThatMetaspaceMemoryManagerExists
import java.lang.management.ManagementFactory; //导入方法依赖的package包/类
private static void verifyThatMetaspaceMemoryManagerExists() {
List<MemoryManagerMXBean> managers = ManagementFactory.getMemoryManagerMXBeans();
for (MemoryManagerMXBean manager : managers) {
if (manager.getName().equals("Metaspace Manager")) {
return;
}
}
throw new RuntimeException("Expected to find a metaspace memory manager");
}
示例3: loadRawDatas
import java.lang.management.ManagementFactory; //导入方法依赖的package包/类
/**
* Call ManagementFactory.getMemoryManagerMXBeans() to
* load the raw data of this table.
**/
protected List<MemoryManagerMXBean> loadRawDatas(Map<Object, Object> userData) {
return ManagementFactory.getMemoryManagerMXBeans();
}