Java Code Examples for java.lang.management.MemoryManagerMXBean#getMemoryPoolNames()

The following examples show how to use java.lang.management.MemoryManagerMXBean#getMemoryPoolNames() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JvmMemMgrPoolRelTableMetaImpl.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Get the list of memory pool associated with the
 * given MemoryManagerMXBean.
 **/
protected String[] getMemoryPools(Object userData,
                              MemoryManagerMXBean mmm, long mmarc) {
    final String listTag =
        "JvmMemManager." + mmarc + ".getMemoryPools";

    String[] result=null;
    if (userData instanceof Map) {
        result = (String[])((Map)userData).get(listTag);
        if (result != null) return result;
    }

    if (mmm!=null) {
        result = mmm.getMemoryPoolNames();
    }
    if ((result!=null)&&(userData instanceof Map)) {
        Map<Object, Object> map = Util.cast(userData);
        map.put(listTag,result);
    }

    return result;
}
 
Example 2
Source File: JvmMemMgrPoolRelTableMetaImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Get the list of memory pool associated with the
 * given MemoryManagerMXBean.
 **/
protected String[] getMemoryPools(Object userData,
                              MemoryManagerMXBean mmm, long mmarc) {
    final String listTag =
        "JvmMemManager." + mmarc + ".getMemoryPools";

    String[] result=null;
    if (userData instanceof Map) {
        result = (String[])((Map)userData).get(listTag);
        if (result != null) return result;
    }

    if (mmm!=null) {
        result = mmm.getMemoryPoolNames();
    }
    if ((result!=null)&&(userData instanceof Map)) {
        Map<Object, Object> map = Util.cast(userData);
        map.put(listTag,result);
    }

    return result;
}
 
Example 3
Source File: JvmMemMgrPoolRelTableMetaImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Get the list of memory pool associated with the
 * given MemoryManagerMXBean.
 **/
protected String[] getMemoryPools(Object userData,
                              MemoryManagerMXBean mmm, long mmarc) {
    final String listTag =
        "JvmMemManager." + mmarc + ".getMemoryPools";

    String[] result=null;
    if (userData instanceof Map) {
        result = (String[])((Map)userData).get(listTag);
        if (result != null) return result;
    }

    if (mmm!=null) {
        result = mmm.getMemoryPoolNames();
    }
    if ((result!=null)&&(userData instanceof Map)) {
        Map<Object, Object> map = Util.cast(userData);
        map.put(listTag,result);
    }

    return result;
}
 
Example 4
Source File: JvmMemMgrPoolRelTableMetaImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Get the list of memory pool associated with the
 * given MemoryManagerMXBean.
 **/
protected String[] getMemoryPools(Object userData,
                              MemoryManagerMXBean mmm, long mmarc) {
    final String listTag =
        "JvmMemManager." + mmarc + ".getMemoryPools";

    String[] result=null;
    if (userData instanceof Map) {
        result = (String[])((Map)userData).get(listTag);
        if (result != null) return result;
    }

    if (mmm!=null) {
        result = mmm.getMemoryPoolNames();
    }
    if ((result!=null)&&(userData instanceof Map)) {
        Map<Object, Object> map = Util.cast(userData);
        map.put(listTag,result);
    }

    return result;
}
 
Example 5
Source File: JvmMemMgrPoolRelTableMetaImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Get the list of memory pool associated with the
 * given MemoryManagerMXBean.
 **/
protected String[] getMemoryPools(Object userData,
                              MemoryManagerMXBean mmm, long mmarc) {
    final String listTag =
        "JvmMemManager." + mmarc + ".getMemoryPools";

    String[] result=null;
    if (userData instanceof Map) {
        result = (String[])((Map)userData).get(listTag);
        if (result != null) return result;
    }

    if (mmm!=null) {
        result = mmm.getMemoryPoolNames();
    }
    if ((result!=null)&&(userData instanceof Map)) {
        Map<Object, Object> map = Util.cast(userData);
        map.put(listTag,result);
    }

    return result;
}
 
Example 6
Source File: MemoryPoolsPresenceTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
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 7
Source File: JvmMemMgrPoolRelTableMetaImpl.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Get the list of memory pool associated with the
 * given MemoryManagerMXBean.
 **/
protected String[] getMemoryPools(Object userData,
                              MemoryManagerMXBean mmm, long mmarc) {
    final String listTag =
        "JvmMemManager." + mmarc + ".getMemoryPools";

    String[] result=null;
    if (userData instanceof Map) {
        result = (String[])((Map)userData).get(listTag);
        if (result != null) return result;
    }

    if (mmm!=null) {
        result = mmm.getMemoryPoolNames();
    }
    if ((result!=null)&&(userData instanceof Map)) {
        Map<Object, Object> map = Util.cast(userData);
        map.put(listTag,result);
    }

    return result;
}
 
Example 8
Source File: JvmMemMgrPoolRelTableMetaImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Get the list of memory pool associated with the
 * given MemoryManagerMXBean.
 **/
protected String[] getMemoryPools(Object userData,
                              MemoryManagerMXBean mmm, long mmarc) {
    final String listTag =
        "JvmMemManager." + mmarc + ".getMemoryPools";

    String[] result=null;
    if (userData instanceof Map) {
        result = (String[])((Map)userData).get(listTag);
        if (result != null) return result;
    }

    if (mmm!=null) {
        result = mmm.getMemoryPoolNames();
    }
    if ((result!=null)&&(userData instanceof Map)) {
        Map<Object, Object> map = Util.cast(userData);
        map.put(listTag,result);
    }

    return result;
}
 
Example 9
Source File: JvmMemMgrPoolRelTableMetaImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Get the list of memory pool associated with the
 * given MemoryManagerMXBean.
 **/
protected String[] getMemoryPools(Object userData,
                              MemoryManagerMXBean mmm, long mmarc) {
    final String listTag =
        "JvmMemManager." + mmarc + ".getMemoryPools";

    String[] result=null;
    if (userData instanceof Map) {
        result = (String[])((Map)userData).get(listTag);
        if (result != null) return result;
    }

    if (mmm!=null) {
        result = mmm.getMemoryPoolNames();
    }
    if ((result!=null)&&(userData instanceof Map)) {
        Map<Object, Object> map = Util.cast(userData);
        map.put(listTag,result);
    }

    return result;
}
 
Example 10
Source File: JvmMemMgrPoolRelTableMetaImpl.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Get the list of memory pool associated with the
 * given MemoryManagerMXBean.
 **/
protected String[] getMemoryPools(Object userData,
                              MemoryManagerMXBean mmm, long mmarc) {
    final String listTag =
        "JvmMemManager." + mmarc + ".getMemoryPools";

    String[] result=null;
    if (userData instanceof Map) {
        result = (String[])((Map)userData).get(listTag);
        if (result != null) return result;
    }

    if (mmm!=null) {
        result = mmm.getMemoryPoolNames();
    }
    if ((result!=null)&&(userData instanceof Map)) {
        Map<Object, Object> map = Util.cast(userData);
        map.put(listTag,result);
    }

    return result;
}
 
Example 11
Source File: JvmMemMgrPoolRelTableMetaImpl.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Get the list of memory pool associated with the
 * given MemoryManagerMXBean.
 **/
protected String[] getMemoryPools(Object userData,
                              MemoryManagerMXBean mmm, long mmarc) {
    final String listTag =
        "JvmMemManager." + mmarc + ".getMemoryPools";

    String[] result=null;
    if (userData instanceof Map) {
        result = (String[])((Map)userData).get(listTag);
        if (result != null) return result;
    }

    if (mmm!=null) {
        result = mmm.getMemoryPoolNames();
    }
    if ((result!=null)&&(userData instanceof Map)) {
        Map<Object, Object> map = Util.cast(userData);
        map.put(listTag,result);
    }

    return result;
}
 
Example 12
Source File: JvmMemMgrPoolRelTableMetaImpl.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Get the list of memory pool associated with the
 * given MemoryManagerMXBean.
 **/
protected String[] getMemoryPools(Object userData,
                              MemoryManagerMXBean mmm, long mmarc) {
    final String listTag =
        "JvmMemManager." + mmarc + ".getMemoryPools";

    String[] result=null;
    if (userData instanceof Map) {
        result = (String[])((Map)userData).get(listTag);
        if (result != null) return result;
    }

    if (mmm!=null) {
        result = mmm.getMemoryPoolNames();
    }
    if ((result!=null)&&(userData instanceof Map)) {
        Map<Object, Object> map = Util.cast(userData);
        map.put(listTag,result);
    }

    return result;
}
 
Example 13
Source File: JvmMemMgrPoolRelTableMetaImpl.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Get the list of memory pool associated with the
 * given MemoryManagerMXBean.
 **/
protected String[] getMemoryPools(Object userData,
                              MemoryManagerMXBean mmm, long mmarc) {
    final String listTag =
        "JvmMemManager." + mmarc + ".getMemoryPools";

    String[] result=null;
    if (userData instanceof Map) {
        result = (String[])((Map)userData).get(listTag);
        if (result != null) return result;
    }

    if (mmm!=null) {
        result = mmm.getMemoryPoolNames();
    }
    if ((result!=null)&&(userData instanceof Map)) {
        Map<Object, Object> map = Util.cast(userData);
        map.put(listTag,result);
    }

    return result;
}
 
Example 14
Source File: MemoryManagerMXBeanAttributeHandler.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
protected void executeReadAttribute(OperationContext context, ModelNode operation) throws OperationFailedException {

    final String mmName = PathAddress.pathAddress(operation.require(ModelDescriptionConstants.OP_ADDR)).getLastElement().getValue();
    final String name = operation.require(ModelDescriptionConstants.NAME).asString();

    MemoryManagerMXBean memoryManagerMXBean = null;

    for (MemoryManagerMXBean mbean : ManagementFactory.getMemoryManagerMXBeans()) {
        if (mmName.equals(escapeMBeanName(mbean.getName()))) {
            memoryManagerMXBean = mbean;
        }
    }

    if (memoryManagerMXBean == null) {
        throw PlatformMBeanLogger.ROOT_LOGGER.unknownMemoryManager(mmName);
    }

    if (PlatformMBeanConstants.OBJECT_NAME.getName().equals(name)) {
        final String objName = PlatformMBeanUtil.getObjectNameStringWithNameKey(ManagementFactory.MEMORY_MANAGER_MXBEAN_DOMAIN_TYPE, mmName);
        context.getResult().set(objName);
    } else if (ModelDescriptionConstants.NAME.equals(name)) {
        context.getResult().set(escapeMBeanName(memoryManagerMXBean.getName()));
    } else if (PlatformMBeanConstants.VALID.getName().equals(name)) {
        context.getResult().set(memoryManagerMXBean.isValid());
    } else if (PlatformMBeanConstants.MEMORY_POOL_NAMES.equals(name)) {
        final ModelNode result = context.getResult();
        result.setEmptyList();
        for (String pool : memoryManagerMXBean.getMemoryPoolNames()) {
            result.add(escapeMBeanName(pool));
        }
    } else if (MemoryManagerResourceDefinition.MEMORY_MANAGER_READ_ATTRIBUTES.contains(name)) {
        // Bug
        throw PlatformMBeanLogger.ROOT_LOGGER.badReadAttributeImpl(name);
    } else {
        // Shouldn't happen; the global handler should reject
        throw unknownAttribute(operation);
    }

}