當前位置: 首頁>>代碼示例>>Java>>正文


Java ManagementFactory.getMemoryManagerMXBeans方法代碼示例

本文整理匯總了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");
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:24,代碼來源:MemoryPoolsPresenceTest.java

示例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");
}
 
開發者ID:arodchen,項目名稱:MaxSim,代碼行數:11,代碼來源:TestMetaspaceMemoryPool.java

示例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();
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:8,代碼來源:JvmMemManagerTableMetaImpl.java


注:本文中的java.lang.management.ManagementFactory.getMemoryManagerMXBeans方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。