本文整理匯總了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();
}