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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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;
}