当前位置: 首页>>代码示例>>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;未经允许,请勿转载。