Java Code Examples for java.lang.management.ManagementFactory.getMemoryManagerMXBeans()

The following are Jave code examples for showing how to use getMemoryManagerMXBeans() of the java.lang.management.ManagementFactory class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: openjdk-jdk10   File: MemoryPoolsPresenceTest.java   Source Code and License Vote up 6 votes
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");
}
 
Example 2
Project: MaxSim   File: TestMetaspaceMemoryPool.java   Source Code and License Vote up 5 votes
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");
}
 
Example 3
Project: OpenJSharp   File: JvmMemManagerTableMetaImpl.java   Source Code and License Vote up 2 votes
/**
 * Call ManagementFactory.getMemoryManagerMXBeans() to
 * load the raw data of this table.
 **/
protected List<MemoryManagerMXBean> loadRawDatas(Map<Object, Object> userData) {
    return ManagementFactory.getMemoryManagerMXBeans();
}
 
Example 4
Project: jdk8u-jdk   File: JvmMemManagerTableMetaImpl.java   Source Code and License Vote up 2 votes
/**
 * Call ManagementFactory.getMemoryManagerMXBeans() to
 * load the raw data of this table.
 **/
protected List<MemoryManagerMXBean> loadRawDatas(Map<Object, Object> userData) {
    return ManagementFactory.getMemoryManagerMXBeans();
}