Java Code Examples for java.lang.management.MemoryManagerMXBean

The following are top voted examples for showing how to use java.lang.management.MemoryManagerMXBean. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: OpenJSharp   File: JvmMemMgrPoolRelTableMetaImpl.java   Source Code and License 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
Project: OpenJSharp   File: JvmMemMgrPoolRelTableMetaImpl.java   Source Code and License 6 votes vote down vote up
protected void updateTreeMap(TreeMap<SnmpOid, Object> table, Object userData,
                             SnmpTableHandler mmHandler,
                             SnmpTableHandler mpHandler,
                             Map<String, SnmpOid> poolIndexMap) {
    if (mmHandler instanceof SnmpCachedData) {
        updateTreeMap(table,userData,(SnmpCachedData)mmHandler,
                      mpHandler,poolIndexMap);
        return;
    }

    SnmpOid mmIndex=null;
    while ((mmIndex = mmHandler.getNext(mmIndex))!=null) {
        final MemoryManagerMXBean mmm =
            (MemoryManagerMXBean)mmHandler.getData(mmIndex);
        if (mmm == null) continue;
        updateTreeMap(table,userData,mmm,mmIndex,poolIndexMap);
    }
}
 
Example 3
Project: jdk8u-jdk   File: JvmMemMgrPoolRelTableMetaImpl.java   Source Code and License 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
Project: jdk8u-jdk   File: JvmMemMgrPoolRelTableMetaImpl.java   Source Code and License 6 votes vote down vote up
protected void updateTreeMap(TreeMap<SnmpOid, Object> table, Object userData,
                             SnmpTableHandler mmHandler,
                             SnmpTableHandler mpHandler,
                             Map<String, SnmpOid> poolIndexMap) {
    if (mmHandler instanceof SnmpCachedData) {
        updateTreeMap(table,userData,(SnmpCachedData)mmHandler,
                      mpHandler,poolIndexMap);
        return;
    }

    SnmpOid mmIndex=null;
    while ((mmIndex = mmHandler.getNext(mmIndex))!=null) {
        final MemoryManagerMXBean mmm =
            (MemoryManagerMXBean)mmHandler.getData(mmIndex);
        if (mmm == null) continue;
        updateTreeMap(table,userData,mmm,mmIndex,poolIndexMap);
    }
}
 
Example 5
Project: openjdk-jdk10   File: MemoryPoolsPresenceTest.java   Source Code and License 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 6
Project: openjdk9   File: MemoryPoolsPresenceTest.java   Source Code and License 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
Project: jdk8u_jdk   File: JvmMemMgrPoolRelTableMetaImpl.java   Source Code and License 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
Project: jdk8u_jdk   File: JvmMemMgrPoolRelTableMetaImpl.java   Source Code and License 6 votes vote down vote up
protected void updateTreeMap(TreeMap<SnmpOid, Object> table, Object userData,
                             SnmpTableHandler mmHandler,
                             SnmpTableHandler mpHandler,
                             Map<String, SnmpOid> poolIndexMap) {
    if (mmHandler instanceof SnmpCachedData) {
        updateTreeMap(table,userData,(SnmpCachedData)mmHandler,
                      mpHandler,poolIndexMap);
        return;
    }

    SnmpOid mmIndex=null;
    while ((mmIndex = mmHandler.getNext(mmIndex))!=null) {
        final MemoryManagerMXBean mmm =
            (MemoryManagerMXBean)mmHandler.getData(mmIndex);
        if (mmm == null) continue;
        updateTreeMap(table,userData,mmm,mmIndex,poolIndexMap);
    }
}
 
Example 9
Project: lookaside_java-1.8.0-openjdk   File: JvmMemMgrPoolRelTableMetaImpl.java   Source Code and License 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
Project: lookaside_java-1.8.0-openjdk   File: JvmMemMgrPoolRelTableMetaImpl.java   Source Code and License 6 votes vote down vote up
protected void updateTreeMap(TreeMap<SnmpOid, Object> table, Object userData,
                             SnmpTableHandler mmHandler,
                             SnmpTableHandler mpHandler,
                             Map<String, SnmpOid> poolIndexMap) {
    if (mmHandler instanceof SnmpCachedData) {
        updateTreeMap(table,userData,(SnmpCachedData)mmHandler,
                      mpHandler,poolIndexMap);
        return;
    }

    SnmpOid mmIndex=null;
    while ((mmIndex = mmHandler.getNext(mmIndex))!=null) {
        final MemoryManagerMXBean mmm =
            (MemoryManagerMXBean)mmHandler.getData(mmIndex);
        if (mmm == null) continue;
        updateTreeMap(table,userData,mmm,mmIndex,poolIndexMap);
    }
}
 
Example 11
Project: infobip-open-jdk-8   File: JvmMemMgrPoolRelTableMetaImpl.java   Source Code and License 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
Project: infobip-open-jdk-8   File: JvmMemMgrPoolRelTableMetaImpl.java   Source Code and License 6 votes vote down vote up
protected void updateTreeMap(TreeMap<SnmpOid, Object> table, Object userData,
                             SnmpTableHandler mmHandler,
                             SnmpTableHandler mpHandler,
                             Map<String, SnmpOid> poolIndexMap) {
    if (mmHandler instanceof SnmpCachedData) {
        updateTreeMap(table,userData,(SnmpCachedData)mmHandler,
                      mpHandler,poolIndexMap);
        return;
    }

    SnmpOid mmIndex=null;
    while ((mmIndex = mmHandler.getNext(mmIndex))!=null) {
        final MemoryManagerMXBean mmm =
            (MemoryManagerMXBean)mmHandler.getData(mmIndex);
        if (mmm == null) continue;
        updateTreeMap(table,userData,mmm,mmIndex,poolIndexMap);
    }
}
 
Example 13
Project: jdk8u-dev-jdk   File: JvmMemMgrPoolRelTableMetaImpl.java   Source Code and License 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
Project: jdk8u-dev-jdk   File: JvmMemMgrPoolRelTableMetaImpl.java   Source Code and License 6 votes vote down vote up
protected void updateTreeMap(TreeMap<SnmpOid, Object> table, Object userData,
                             SnmpTableHandler mmHandler,
                             SnmpTableHandler mpHandler,
                             Map<String, SnmpOid> poolIndexMap) {
    if (mmHandler instanceof SnmpCachedData) {
        updateTreeMap(table,userData,(SnmpCachedData)mmHandler,
                      mpHandler,poolIndexMap);
        return;
    }

    SnmpOid mmIndex=null;
    while ((mmIndex = mmHandler.getNext(mmIndex))!=null) {
        final MemoryManagerMXBean mmm =
            (MemoryManagerMXBean)mmHandler.getData(mmIndex);
        if (mmm == null) continue;
        updateTreeMap(table,userData,mmm,mmIndex,poolIndexMap);
    }
}
 
Example 15
Project: jdk7-jdk   File: JvmMemMgrPoolRelTableMetaImpl.java   Source Code and License 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 16
Project: jdk7-jdk   File: JvmMemMgrPoolRelTableMetaImpl.java   Source Code and License 6 votes vote down vote up
protected void updateTreeMap(TreeMap<SnmpOid, Object> table, Object userData,
                             SnmpTableHandler mmHandler,
                             SnmpTableHandler mpHandler,
                             Map poolIndexMap) {
    if (mmHandler instanceof SnmpCachedData) {
        updateTreeMap(table,userData,(SnmpCachedData)mmHandler,
                      mpHandler,poolIndexMap);
        return;
    }

    SnmpOid mmIndex=null;
    while ((mmIndex = mmHandler.getNext(mmIndex))!=null) {
        final MemoryManagerMXBean mmm =
            (MemoryManagerMXBean)mmHandler.getData(mmIndex);
        if (mmm == null) continue;
        updateTreeMap(table,userData,mmm,mmIndex,poolIndexMap);
    }
}
 
Example 17
Project: openjdk-source-code-learn   File: JvmMemMgrPoolRelTableMetaImpl.java   Source Code and License 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 18
Project: openjdk-source-code-learn   File: JvmMemMgrPoolRelTableMetaImpl.java   Source Code and License 6 votes vote down vote up
protected void updateTreeMap(TreeMap<SnmpOid, Object> table, Object userData,
                             SnmpTableHandler mmHandler,
                             SnmpTableHandler mpHandler,
                             Map poolIndexMap) {
    if (mmHandler instanceof SnmpCachedData) {
        updateTreeMap(table,userData,(SnmpCachedData)mmHandler,
                      mpHandler,poolIndexMap);
        return;
    }

    SnmpOid mmIndex=null;
    while ((mmIndex = mmHandler.getNext(mmIndex))!=null) {
        final MemoryManagerMXBean mmm =
            (MemoryManagerMXBean)mmHandler.getData(mmIndex);
        if (mmm == null) continue;
        updateTreeMap(table,userData,mmm,mmIndex,poolIndexMap);
    }
}
 
Example 19
Project: OLD-OpenJDK8   File: JvmMemMgrPoolRelTableMetaImpl.java   Source Code and License 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 20
Project: OLD-OpenJDK8   File: JvmMemMgrPoolRelTableMetaImpl.java   Source Code and License 6 votes vote down vote up
protected void updateTreeMap(TreeMap<SnmpOid, Object> table, Object userData,
                             SnmpTableHandler mmHandler,
                             SnmpTableHandler mpHandler,
                             Map<String, SnmpOid> poolIndexMap) {
    if (mmHandler instanceof SnmpCachedData) {
        updateTreeMap(table,userData,(SnmpCachedData)mmHandler,
                      mpHandler,poolIndexMap);
        return;
    }

    SnmpOid mmIndex=null;
    while ((mmIndex = mmHandler.getNext(mmIndex))!=null) {
        final MemoryManagerMXBean mmm =
            (MemoryManagerMXBean)mmHandler.getData(mmIndex);
        if (mmm == null) continue;
        updateTreeMap(table,userData,mmm,mmIndex,poolIndexMap);
    }
}
 
Example 21
Project: cn1   File: MemoryPoolMXBeanImpl.java   Source Code and License 6 votes vote down vote up
public String[] getMemoryManagerNames() {
    /* get the memory managers and check which of them manage this pool */
    Iterator<MemoryManagerMXBean> iter = memBean.getMemoryManagerMXBeans()
            .iterator();
    List<String> result = new LinkedList<String>();
    while (iter.hasNext()) {
        MemoryManagerMXBean bean = iter.next();
        String[] managedPools = bean.getMemoryPoolNames();
        for (int i = 0; i < managedPools.length; i++) {
            if (managedPools[i].equals(name)) {
                result.add(bean.getName());
                break;
            }
        }
    }
    return result.toArray(new String[0]);
}
 
Example 22
Project: cn1   File: ManagementUtils.java   Source Code and License 6 votes vote down vote up
/**
 * Creates the metadata for the
 * {@link java.lang.management.MemoryManagerMXBean}. For this type of
 * platform bean the metadata covers :
 * <ul>
 * <li>3 attribute
 * <li>0 constructors
 * <li>0 operations
 * <li>0 notifications
 * </ul>
 * 
 * @param map
 */
private static void addMemoryManagerBeanInfo(HashMap<String, MBeanInfo> map) {
    // Attributes
    MBeanAttributeInfo[] attributes = new MBeanAttributeInfo[3];
    attributes[0] = new MBeanAttributeInfo("MemoryPoolNames",
            "[Ljava.lang.String;", "MemoryPoolNames", true, false, false);
    attributes[1] = new MBeanAttributeInfo("Name", String.class.getName(),
            "Name", true, false, false);
    attributes[2] = new MBeanAttributeInfo("Valid", Boolean.TYPE.getName(),
            "Valid", true, false, true);

    map.put(MemoryManagerMXBean.class.getName(), new MBeanInfo(
            MemoryManagerMXBeanImpl.class.getName(),
            MemoryManagerMXBeanImpl.class.getName(), attributes, null,
            null, null));
}
 
Example 23
Project: openjdk-jdk7u-jdk   File: JvmMemMgrPoolRelTableMetaImpl.java   Source Code and License 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 24
Project: openjdk-jdk7u-jdk   File: JvmMemMgrPoolRelTableMetaImpl.java   Source Code and License 6 votes vote down vote up
protected void updateTreeMap(TreeMap<SnmpOid, Object> table, Object userData,
                             SnmpTableHandler mmHandler,
                             SnmpTableHandler mpHandler,
                             Map poolIndexMap) {
    if (mmHandler instanceof SnmpCachedData) {
        updateTreeMap(table,userData,(SnmpCachedData)mmHandler,
                      mpHandler,poolIndexMap);
        return;
    }

    SnmpOid mmIndex=null;
    while ((mmIndex = mmHandler.getNext(mmIndex))!=null) {
        final MemoryManagerMXBean mmm =
            (MemoryManagerMXBean)mmHandler.getData(mmIndex);
        if (mmm == null) continue;
        updateTreeMap(table,userData,mmm,mmIndex,poolIndexMap);
    }
}
 
Example 25
Project: freeVM   File: MemoryPoolMXBeanImpl.java   Source Code and License 6 votes vote down vote up
public String[] getMemoryManagerNames() {
    /* get the memory managers and check which of them manage this pool */
    Iterator<MemoryManagerMXBean> iter = memBean.getMemoryManagerMXBeans()
            .iterator();
    List<String> result = new LinkedList<String>();
    while (iter.hasNext()) {
        MemoryManagerMXBean bean = iter.next();
        String[] managedPools = bean.getMemoryPoolNames();
        for (int i = 0; i < managedPools.length; i++) {
            if (managedPools[i].equals(name)) {
                result.add(bean.getName());
                break;
            }
        }
    }
    return result.toArray(new String[0]);
}
 
Example 26
Project: freeVM   File: ManagementUtils.java   Source Code and License 6 votes vote down vote up
/**
 * Creates the metadata for the
 * {@link java.lang.management.MemoryManagerMXBean}. For this type of
 * platform bean the metadata covers :
 * <ul>
 * <li>3 attribute
 * <li>0 constructors
 * <li>0 operations
 * <li>0 notifications
 * </ul>
 * 
 * @param map
 */
private static void addMemoryManagerBeanInfo(HashMap<String, MBeanInfo> map) {
    // Attributes
    MBeanAttributeInfo[] attributes = new MBeanAttributeInfo[3];
    attributes[0] = new MBeanAttributeInfo("MemoryPoolNames",
            "[Ljava.lang.String;", "MemoryPoolNames", true, false, false);
    attributes[1] = new MBeanAttributeInfo("Name", String.class.getName(),
            "Name", true, false, false);
    attributes[2] = new MBeanAttributeInfo("Valid", Boolean.TYPE.getName(),
            "Valid", true, false, true);

    map.put(MemoryManagerMXBean.class.getName(), new MBeanInfo(
            MemoryManagerMXBeanImpl.class.getName(),
            MemoryManagerMXBeanImpl.class.getName(), attributes, null,
            null, null));
}
 
Example 27
Project: freeVM   File: MemoryPoolMXBeanImpl.java   Source Code and License 6 votes vote down vote up
public String[] getMemoryManagerNames() {
    /* get the memory managers and check which of them manage this pool */
    Iterator<MemoryManagerMXBean> iter = memBean.getMemoryManagerMXBeans()
            .iterator();
    List<String> result = new LinkedList<String>();
    while (iter.hasNext()) {
        MemoryManagerMXBean bean = iter.next();
        String[] managedPools = bean.getMemoryPoolNames();
        for (int i = 0; i < managedPools.length; i++) {
            if (managedPools[i].equals(name)) {
                result.add(bean.getName());
                break;
            }
        }
    }
    return result.toArray(new String[0]);
}
 
Example 28
Project: freeVM   File: ManagementUtils.java   Source Code and License 6 votes vote down vote up
/**
 * Creates the metadata for the
 * {@link java.lang.management.MemoryManagerMXBean}. For this type of
 * platform bean the metadata covers :
 * <ul>
 * <li>3 attribute
 * <li>0 constructors
 * <li>0 operations
 * <li>0 notifications
 * </ul>
 * 
 * @param map
 */
private static void addMemoryManagerBeanInfo(HashMap<String, MBeanInfo> map) {
    // Attributes
    MBeanAttributeInfo[] attributes = new MBeanAttributeInfo[3];
    attributes[0] = new MBeanAttributeInfo("MemoryPoolNames",
            "[Ljava.lang.String;", "MemoryPoolNames", true, false, false);
    attributes[1] = new MBeanAttributeInfo("Name", String.class.getName(),
            "Name", true, false, false);
    attributes[2] = new MBeanAttributeInfo("Valid", Boolean.TYPE.getName(),
            "Valid", true, false, true);

    map.put(MemoryManagerMXBean.class.getName(), new MBeanInfo(
            MemoryManagerMXBeanImpl.class.getName(),
            MemoryManagerMXBeanImpl.class.getName(), attributes, null,
            null, null));
}
 
Example 29
Project: OpenJSharp   File: JvmMemMgrPoolRelTableMetaImpl.java   Source Code and License 5 votes vote down vote up
protected void updateTreeMap(TreeMap<SnmpOid, Object> table, Object userData,
                             SnmpCachedData mmHandler,
                             SnmpTableHandler mpHandler,
                             Map<String, SnmpOid> poolIndexMap) {

    final SnmpOid[] indexes = mmHandler.indexes;
    final Object[]  datas   = mmHandler.datas;
    final int size = indexes.length;
    for (int i=size-1; i>-1; i--) {
        final MemoryManagerMXBean mmm =
            (MemoryManagerMXBean)datas[i];
        if (mmm == null) continue;
        updateTreeMap(table,userData,mmm,indexes[i],poolIndexMap);
    }
}
 
Example 30
Project: OpenJSharp   File: MemoryPoolImpl.java   Source Code and License 5 votes vote down vote up
public String[] getMemoryManagerNames() {
    MemoryManagerMXBean[] mgrs = getMemoryManagers();

    String[] names = new String[mgrs.length];
    for (int i = 0; i < mgrs.length; i++) {
        names[i] = mgrs[i].getName();
    }
    return names;
}
 
Example 31
Project: MaxSim   File: TestMetaspaceMemoryPool.java   Source Code and License 5 votes vote down vote up
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 32
Project: jdk8u-jdk   File: JvmMemMgrPoolRelTableMetaImpl.java   Source Code and License 5 votes vote down vote up
protected void updateTreeMap(TreeMap<SnmpOid, Object> table, Object userData,
                             SnmpCachedData mmHandler,
                             SnmpTableHandler mpHandler,
                             Map<String, SnmpOid> poolIndexMap) {

    final SnmpOid[] indexes = mmHandler.indexes;
    final Object[]  datas   = mmHandler.datas;
    final int size = indexes.length;
    for (int i=size-1; i>-1; i--) {
        final MemoryManagerMXBean mmm =
            (MemoryManagerMXBean)datas[i];
        if (mmm == null) continue;
        updateTreeMap(table,userData,mmm,indexes[i],poolIndexMap);
    }
}
 
Example 33
Project: jdk8u-jdk   File: MemoryPoolImpl.java   Source Code and License 5 votes vote down vote up
public String[] getMemoryManagerNames() {
    MemoryManagerMXBean[] mgrs = getMemoryManagers();

    String[] names = new String[mgrs.length];
    for (int i = 0; i < mgrs.length; i++) {
        names[i] = mgrs[i].getName();
    }
    return names;
}
 
Example 34
Project: jdk8u-jdk   File: MXBeanInteropTest1.java   Source Code and License 5 votes vote down vote up
private final int doMemoryManagerMXBeanTest(MBeanServerConnection mbsc) {
    int errorCount = 0 ;
    System.out.println("---- MemoryManagerMXBean") ;

    try {
        ObjectName filterName =
                new ObjectName(ManagementFactory.MEMORY_MANAGER_MXBEAN_DOMAIN_TYPE
                + ",*");
        Set<ObjectName> onSet = mbsc.queryNames(filterName, null);

        for (Iterator<ObjectName> iter = onSet.iterator(); iter.hasNext(); ) {
            ObjectName memoryManagerName = iter.next() ;
            System.out.println("-------- " + memoryManagerName) ;
            MBeanInfo mbInfo = mbsc.getMBeanInfo(memoryManagerName);
            System.out.println("getMBeanInfo\t\t" + mbInfo);
            errorCount += checkNonEmpty(mbInfo);
            MemoryManagerMXBean memoryManager = null;

            memoryManager =
                    JMX.newMXBeanProxy(mbsc,
                    memoryManagerName,
                    MemoryManagerMXBean.class) ;
            System.out.println("getMemoryPoolNames\t\t"
                    + Arrays.deepToString(memoryManager.getMemoryPoolNames()));
            System.out.println("getName\t\t"
                    + memoryManager.getName());
            System.out.println("isValid\t\t"
                    + memoryManager.isValid());
        }

        System.out.println("---- OK\n") ;
    } catch (Exception e) {
        Utils.printThrowable(e, true) ;
        errorCount++ ;
        System.out.println("---- ERROR\n") ;
    }

    return errorCount ;
}
 
Example 35
Project: openjdk-jdk10   File: MemoryPoolImpl.java   Source Code and License 5 votes vote down vote up
public String[] getMemoryManagerNames() {
    MemoryManagerMXBean[] mgrs = getMemoryManagers();

    String[] names = new String[mgrs.length];
    for (int i = 0; i < mgrs.length; i++) {
        names[i] = mgrs[i].getName();
    }
    return names;
}
 
Example 36
Project: openjdk-jdk10   File: MXBeanInteropTest1.java   Source Code and License 5 votes vote down vote up
private final int doMemoryManagerMXBeanTest(MBeanServerConnection mbsc) {
    int errorCount = 0 ;
    System.out.println("---- MemoryManagerMXBean") ;

    try {
        ObjectName filterName =
                new ObjectName(ManagementFactory.MEMORY_MANAGER_MXBEAN_DOMAIN_TYPE
                + ",*");
        Set<ObjectName> onSet = mbsc.queryNames(filterName, null);

        for (Iterator<ObjectName> iter = onSet.iterator(); iter.hasNext(); ) {
            ObjectName memoryManagerName = iter.next() ;
            System.out.println("-------- " + memoryManagerName) ;
            MBeanInfo mbInfo = mbsc.getMBeanInfo(memoryManagerName);
            System.out.println("getMBeanInfo\t\t" + mbInfo);
            errorCount += checkNonEmpty(mbInfo);
            MemoryManagerMXBean memoryManager = null;

            memoryManager =
                    JMX.newMXBeanProxy(mbsc,
                    memoryManagerName,
                    MemoryManagerMXBean.class) ;
            System.out.println("getMemoryPoolNames\t\t"
                    + Arrays.deepToString(memoryManager.getMemoryPoolNames()));
            System.out.println("getName\t\t"
                    + memoryManager.getName());
            System.out.println("isValid\t\t"
                    + memoryManager.isValid());
        }

        System.out.println("---- OK\n") ;
    } catch (Exception e) {
        Utils.printThrowable(e, true) ;
        errorCount++ ;
        System.out.println("---- ERROR\n") ;
    }

    return errorCount ;
}
 
Example 37
Project: openjdk9   File: MemoryPoolImpl.java   Source Code and License 5 votes vote down vote up
public String[] getMemoryManagerNames() {
    MemoryManagerMXBean[] mgrs = getMemoryManagers();

    String[] names = new String[mgrs.length];
    for (int i = 0; i < mgrs.length; i++) {
        names[i] = mgrs[i].getName();
    }
    return names;
}
 
Example 38
Project: openjdk9   File: MXBeanInteropTest1.java   Source Code and License 5 votes vote down vote up
private final int doMemoryManagerMXBeanTest(MBeanServerConnection mbsc) {
    int errorCount = 0 ;
    System.out.println("---- MemoryManagerMXBean") ;

    try {
        ObjectName filterName =
                new ObjectName(ManagementFactory.MEMORY_MANAGER_MXBEAN_DOMAIN_TYPE
                + ",*");
        Set<ObjectName> onSet = mbsc.queryNames(filterName, null);

        for (Iterator<ObjectName> iter = onSet.iterator(); iter.hasNext(); ) {
            ObjectName memoryManagerName = iter.next() ;
            System.out.println("-------- " + memoryManagerName) ;
            MBeanInfo mbInfo = mbsc.getMBeanInfo(memoryManagerName);
            System.out.println("getMBeanInfo\t\t" + mbInfo);
            errorCount += checkNonEmpty(mbInfo);
            MemoryManagerMXBean memoryManager = null;

            memoryManager =
                    JMX.newMXBeanProxy(mbsc,
                    memoryManagerName,
                    MemoryManagerMXBean.class) ;
            System.out.println("getMemoryPoolNames\t\t"
                    + Arrays.deepToString(memoryManager.getMemoryPoolNames()));
            System.out.println("getName\t\t"
                    + memoryManager.getName());
            System.out.println("isValid\t\t"
                    + memoryManager.isValid());
        }

        System.out.println("---- OK\n") ;
    } catch (Exception e) {
        Utils.printThrowable(e, true) ;
        errorCount++ ;
        System.out.println("---- ERROR\n") ;
    }

    return errorCount ;
}
 
Example 39
Project: jdk8u_jdk   File: JvmMemMgrPoolRelTableMetaImpl.java   Source Code and License 5 votes vote down vote up
protected void updateTreeMap(TreeMap<SnmpOid, Object> table, Object userData,
                             SnmpCachedData mmHandler,
                             SnmpTableHandler mpHandler,
                             Map<String, SnmpOid> poolIndexMap) {

    final SnmpOid[] indexes = mmHandler.indexes;
    final Object[]  datas   = mmHandler.datas;
    final int size = indexes.length;
    for (int i=size-1; i>-1; i--) {
        final MemoryManagerMXBean mmm =
            (MemoryManagerMXBean)datas[i];
        if (mmm == null) continue;
        updateTreeMap(table,userData,mmm,indexes[i],poolIndexMap);
    }
}
 
Example 40
Project: jdk8u_jdk   File: MemoryPoolImpl.java   Source Code and License 5 votes vote down vote up
public String[] getMemoryManagerNames() {
    MemoryManagerMXBean[] mgrs = getMemoryManagers();

    String[] names = new String[mgrs.length];
    for (int i = 0; i < mgrs.length; i++) {
        names[i] = mgrs[i].getName();
    }
    return names;
}
 
Example 41
Project: jdk8u_jdk   File: MXBeanInteropTest1.java   Source Code and License 5 votes vote down vote up
private final int doMemoryManagerMXBeanTest(MBeanServerConnection mbsc) {
    int errorCount = 0 ;
    System.out.println("---- MemoryManagerMXBean") ;

    try {
        ObjectName filterName =
                new ObjectName(ManagementFactory.MEMORY_MANAGER_MXBEAN_DOMAIN_TYPE
                + ",*");
        Set<ObjectName> onSet = mbsc.queryNames(filterName, null);

        for (Iterator<ObjectName> iter = onSet.iterator(); iter.hasNext(); ) {
            ObjectName memoryManagerName = iter.next() ;
            System.out.println("-------- " + memoryManagerName) ;
            MBeanInfo mbInfo = mbsc.getMBeanInfo(memoryManagerName);
            System.out.println("getMBeanInfo\t\t" + mbInfo);
            errorCount += checkNonEmpty(mbInfo);
            MemoryManagerMXBean memoryManager = null;

            memoryManager =
                    JMX.newMXBeanProxy(mbsc,
                    memoryManagerName,
                    MemoryManagerMXBean.class) ;
            System.out.println("getMemoryPoolNames\t\t"
                    + Arrays.deepToString(memoryManager.getMemoryPoolNames()));
            System.out.println("getName\t\t"
                    + memoryManager.getName());
            System.out.println("isValid\t\t"
                    + memoryManager.isValid());
        }

        System.out.println("---- OK\n") ;
    } catch (Exception e) {
        Utils.printThrowable(e, true) ;
        errorCount++ ;
        System.out.println("---- ERROR\n") ;
    }

    return errorCount ;
}
 
Example 42
Project: ublu   File: JVMHelper.java   Source Code and License 5 votes vote down vote up
private String displayMemoryManagerMXBeanList(List<MemoryManagerMXBean> lmmmxb) {
    StringBuilder sb = new StringBuilder();
    Iterator<MemoryManagerMXBean> it = lmmmxb.iterator();
    while (it.hasNext()) {
        sb.append(displayManagementBean(it.next()));
    }
    return sb.toString();
}
 
Example 43
Project: ublu   File: JVMHelper.java   Source Code and License 5 votes vote down vote up
private String displayManagementBean(MemoryManagerMXBean mxBean) {
    StringBuilder sb = new StringBuilder();
    if (mxBean != null) {
        Generics.StringArrayList memoryPoolNames = new Generics.StringArrayList(mxBean.getMemoryPoolNames());
        sb.append("Memory Manager:\t").append(mxBean.getName()).append("\n");
        sb.append("Pool names:\t").append(memoryPoolNames).append('\n');
    }
    return sb.toString();
}
 
Example 44
Project: lookaside_java-1.8.0-openjdk   File: JvmMemMgrPoolRelTableMetaImpl.java   Source Code and License 5 votes vote down vote up
protected void updateTreeMap(TreeMap<SnmpOid, Object> table, Object userData,
                             SnmpCachedData mmHandler,
                             SnmpTableHandler mpHandler,
                             Map<String, SnmpOid> poolIndexMap) {

    final SnmpOid[] indexes = mmHandler.indexes;
    final Object[]  datas   = mmHandler.datas;
    final int size = indexes.length;
    for (int i=size-1; i>-1; i--) {
        final MemoryManagerMXBean mmm =
            (MemoryManagerMXBean)datas[i];
        if (mmm == null) continue;
        updateTreeMap(table,userData,mmm,indexes[i],poolIndexMap);
    }
}
 
Example 45
Project: lookaside_java-1.8.0-openjdk   File: MemoryPoolImpl.java   Source Code and License 5 votes vote down vote up
public String[] getMemoryManagerNames() {
    MemoryManagerMXBean[] mgrs = getMemoryManagers();

    String[] names = new String[mgrs.length];
    for (int i = 0; i < mgrs.length; i++) {
        names[i] = mgrs[i].getName();
    }
    return names;
}
 
Example 46
Project: lookaside_java-1.8.0-openjdk   File: MXBeanInteropTest1.java   Source Code and License 5 votes vote down vote up
private final int doMemoryManagerMXBeanTest(MBeanServerConnection mbsc) {
    int errorCount = 0 ;
    System.out.println("---- MemoryManagerMXBean") ;

    try {
        ObjectName filterName =
                new ObjectName(ManagementFactory.MEMORY_MANAGER_MXBEAN_DOMAIN_TYPE
                + ",*");
        Set<ObjectName> onSet = mbsc.queryNames(filterName, null);

        for (Iterator<ObjectName> iter = onSet.iterator(); iter.hasNext(); ) {
            ObjectName memoryManagerName = iter.next() ;
            System.out.println("-------- " + memoryManagerName) ;
            MBeanInfo mbInfo = mbsc.getMBeanInfo(memoryManagerName);
            System.out.println("getMBeanInfo\t\t" + mbInfo);
            errorCount += checkNonEmpty(mbInfo);
            MemoryManagerMXBean memoryManager = null;

            memoryManager =
                    JMX.newMXBeanProxy(mbsc,
                    memoryManagerName,
                    MemoryManagerMXBean.class) ;
            System.out.println("getMemoryPoolNames\t\t"
                    + Arrays.deepToString(memoryManager.getMemoryPoolNames()));
            System.out.println("getName\t\t"
                    + memoryManager.getName());
            System.out.println("isValid\t\t"
                    + memoryManager.isValid());
        }

        System.out.println("---- OK\n") ;
    } catch (Exception e) {
        Utils.printThrowable(e, true) ;
        errorCount++ ;
        System.out.println("---- ERROR\n") ;
    }

    return errorCount ;
}
 
Example 47
Project: javify   File: TestMemoryManager.java   Source Code and License 5 votes vote down vote up
public static void main(String[] args)
{
  Iterator beans = ManagementFactory.getMemoryManagerMXBeans().iterator();
  while (beans.hasNext())
    {
      MemoryManagerMXBean bean = (MemoryManagerMXBean) beans.next();
      System.out.println("Bean: " + bean);
      System.out.println("Name: " + bean.getName());
      System.out.println("Memory pool names: "
                         + Arrays.toString(bean.getMemoryPoolNames()));
      System.out.println("Is valid: "
                         + (bean.isValid() ? "yes" : "no"));
    }
}
 
Example 48
Project: jvm-stm   File: TestMemoryManager.java   Source Code and License 5 votes vote down vote up
public static void main(String[] args)
 {
   Iterator beans = ManagementFactory.getMemoryManagerMXBeans().iterator();
   while (beans.hasNext())
     {
MemoryManagerMXBean bean = (MemoryManagerMXBean) beans.next();
System.out.println("Bean: " + bean);
System.out.println("Name: " + bean.getName());
System.out.println("Memory pool names: " 
		   + Arrays.toString(bean.getMemoryPoolNames()));
System.out.println("Is valid: " 
		   + (bean.isValid() ? "yes" : "no"));
     }
 }
 
Example 49
Project: jetstream   File: JvmManagement.java   Source Code and License 5 votes vote down vote up
public JvmManagement() {
  XMLSerializationManager.registerXSerializable(MemoryManagerMXBean.class);
  XMLSerializationManager.registerXSerializable(MemoryPoolMXBean.class);
  Management.addBean("Jvm/ClassLoading", ManagementFactory.getClassLoadingMXBean());
  Management.addBean("Jvm/Compilation", ManagementFactory.getCompilationMXBean());
  Management.addBean("Jvm/GarbageCollector", ManagementFactory.getGarbageCollectorMXBeans());
  Management.addBean("Jvm/MemoryManager", ManagementFactory.getMemoryManagerMXBeans());
  Management.addBean("Jvm/Memory", ManagementFactory.getMemoryMXBean());
  Management.addBean("Jvm/MemoryPool", ManagementFactory.getMemoryPoolMXBeans());
  Management.addBean("Jvm/OS", ManagementFactory.getOperatingSystemMXBean());
  Management.addBean("Jvm/Runtime", ManagementFactory.getRuntimeMXBean());
  Management.addBean("Jvm/Threads", ManagementFactory.getThreadMXBean());
}
 
Example 50
Project: infobip-open-jdk-8   File: JvmMemMgrPoolRelTableMetaImpl.java   Source Code and License 5 votes vote down vote up
protected void updateTreeMap(TreeMap<SnmpOid, Object> table, Object userData,
                             SnmpCachedData mmHandler,
                             SnmpTableHandler mpHandler,
                             Map<String, SnmpOid> poolIndexMap) {

    final SnmpOid[] indexes = mmHandler.indexes;
    final Object[]  datas   = mmHandler.datas;
    final int size = indexes.length;
    for (int i=size-1; i>-1; i--) {
        final MemoryManagerMXBean mmm =
            (MemoryManagerMXBean)datas[i];
        if (mmm == null) continue;
        updateTreeMap(table,userData,mmm,indexes[i],poolIndexMap);
    }
}
 
Example 51
Project: infobip-open-jdk-8   File: MemoryPoolImpl.java   Source Code and License 5 votes vote down vote up
public String[] getMemoryManagerNames() {
    MemoryManagerMXBean[] mgrs = getMemoryManagers();

    String[] names = new String[mgrs.length];
    for (int i = 0; i < mgrs.length; i++) {
        names[i] = mgrs[i].getName();
    }
    return names;
}
 
Example 52
Project: jdk8u-dev-jdk   File: JvmMemMgrPoolRelTableMetaImpl.java   Source Code and License 5 votes vote down vote up
protected void updateTreeMap(TreeMap<SnmpOid, Object> table, Object userData,
                             SnmpCachedData mmHandler,
                             SnmpTableHandler mpHandler,
                             Map<String, SnmpOid> poolIndexMap) {

    final SnmpOid[] indexes = mmHandler.indexes;
    final Object[]  datas   = mmHandler.datas;
    final int size = indexes.length;
    for (int i=size-1; i>-1; i--) {
        final MemoryManagerMXBean mmm =
            (MemoryManagerMXBean)datas[i];
        if (mmm == null) continue;
        updateTreeMap(table,userData,mmm,indexes[i],poolIndexMap);
    }
}
 
Example 53
Project: jdk8u-dev-jdk   File: MemoryPoolImpl.java   Source Code and License 5 votes vote down vote up
public String[] getMemoryManagerNames() {
    MemoryManagerMXBean[] mgrs = getMemoryManagers();

    String[] names = new String[mgrs.length];
    for (int i = 0; i < mgrs.length; i++) {
        names[i] = mgrs[i].getName();
    }
    return names;
}
 
Example 54
Project: jdk7-jdk   File: JvmMemMgrPoolRelTableMetaImpl.java   Source Code and License 5 votes vote down vote up
protected void updateTreeMap(TreeMap<SnmpOid, Object> table, Object userData,
                             SnmpCachedData mmHandler,
                             SnmpTableHandler mpHandler,
                             Map poolIndexMap) {

    final SnmpOid[] indexes = mmHandler.indexes;
    final Object[]  datas   = mmHandler.datas;
    final int size = indexes.length;
    for (int i=size-1; i>-1; i--) {
        final MemoryManagerMXBean mmm =
            (MemoryManagerMXBean)datas[i];
        if (mmm == null) continue;
        updateTreeMap(table,userData,mmm,indexes[i],poolIndexMap);
    }
}
 
Example 55
Project: jdk7-jdk   File: MemoryPoolImpl.java   Source Code and License 5 votes vote down vote up
public String[] getMemoryManagerNames() {
    MemoryManagerMXBean[] mgrs = getMemoryManagers();

    String[] names = new String[mgrs.length];
    for (int i = 0; i < mgrs.length; i++) {
        names[i] = mgrs[i].getName();
    }
    return names;
}
 
Example 56
Project: openjdk-source-code-learn   File: JvmMemMgrPoolRelTableMetaImpl.java   Source Code and License 5 votes vote down vote up
protected void updateTreeMap(TreeMap<SnmpOid, Object> table, Object userData,
                             SnmpCachedData mmHandler,
                             SnmpTableHandler mpHandler,
                             Map poolIndexMap) {

    final SnmpOid[] indexes = mmHandler.indexes;
    final Object[]  datas   = mmHandler.datas;
    final int size = indexes.length;
    for (int i=size-1; i>-1; i--) {
        final MemoryManagerMXBean mmm =
            (MemoryManagerMXBean)datas[i];
        if (mmm == null) continue;
        updateTreeMap(table,userData,mmm,indexes[i],poolIndexMap);
    }
}
 
Example 57
Project: openjdk-source-code-learn   File: MemoryPoolImpl.java   Source Code and License 5 votes vote down vote up
public String[] getMemoryManagerNames() {
    MemoryManagerMXBean[] mgrs = getMemoryManagers();

    String[] names = new String[mgrs.length];
    for (int i = 0; i < mgrs.length; i++) {
        names[i] = mgrs[i].getName();
    }
    return names;
}
 
Example 58
Project: OLD-OpenJDK8   File: JvmMemMgrPoolRelTableMetaImpl.java   Source Code and License 5 votes vote down vote up
protected void updateTreeMap(TreeMap<SnmpOid, Object> table, Object userData,
                             SnmpCachedData mmHandler,
                             SnmpTableHandler mpHandler,
                             Map<String, SnmpOid> poolIndexMap) {

    final SnmpOid[] indexes = mmHandler.indexes;
    final Object[]  datas   = mmHandler.datas;
    final int size = indexes.length;
    for (int i=size-1; i>-1; i--) {
        final MemoryManagerMXBean mmm =
            (MemoryManagerMXBean)datas[i];
        if (mmm == null) continue;
        updateTreeMap(table,userData,mmm,indexes[i],poolIndexMap);
    }
}
 
Example 59
Project: OLD-OpenJDK8   File: MemoryPoolImpl.java   Source Code and License 5 votes vote down vote up
public String[] getMemoryManagerNames() {
    MemoryManagerMXBean[] mgrs = getMemoryManagers();

    String[] names = new String[mgrs.length];
    for (int i = 0; i < mgrs.length; i++) {
        names[i] = mgrs[i].getName();
    }
    return names;
}
 
Example 60
Project: cn1   File: MemoryMXBeanImpl.java   Source Code and License 5 votes vote down vote up
/**
 * Constructor intentionally private to prevent instantiation by others.
 * Sets the metadata for this bean.
 */
private MemoryMXBeanImpl() {
    setMBeanInfo(ManagementUtils
            .getMBeanInfo(java.lang.management.MemoryMXBean.class.getName()));
    memoryManagerList = new LinkedList<MemoryManagerMXBean>();
    createMemoryManagers();
}