java.lang.management.MemoryManagerMXBean Java Examples
The following examples show how to use
java.lang.management.MemoryManagerMXBean.
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 openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * 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 |
/** * 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 TencentKona-8 with GNU General Public License v2.0 | 6 votes |
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 #4
Source File: JvmMemMgrPoolRelTableMetaImpl.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
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
Source File: JvmMemMgrPoolRelTableMetaImpl.java From hottub with GNU General Public License v2.0 | 6 votes |
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 #6
Source File: JvmMemMgrPoolRelTableMetaImpl.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * 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 #7
Source File: JvmMemMgrPoolRelTableMetaImpl.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
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 #8
Source File: JvmMemMgrPoolRelTableMetaImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
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
Source File: JvmMemMgrPoolRelTableMetaImpl.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
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 #10
Source File: JvmMemMgrPoolRelTableMetaImpl.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * 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: MemoryPoolsPresenceTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
protected void runTest() { List<MemoryManagerMXBean> beans = ManagementFactory.getMemoryManagerMXBeans(); Optional<MemoryManagerMXBean> any = beans .stream() .filter(bean -> CC_MANAGER.equals(bean.getName())) .findAny(); Asserts.assertTrue(any.isPresent(), "Bean not found: " + CC_MANAGER); MemoryManagerMXBean ccManager = any.get(); Asserts.assertNotNull(ccManager, "Found null for " + CC_MANAGER); String names[] = ccManager.getMemoryPoolNames(); for (String name : names) { counters.put(name, counters.containsKey(name) ? counters.get(name) + 1 : 1); } for (BlobType btype : BlobType.getAvailable()) { Asserts.assertEQ(counters.get(btype.getMemoryPool().getName()), 1, "Found unexpected amount of beans for pool " + btype.getMemoryPool().getName()); } Asserts.assertEQ(BlobType.getAvailable().size(), counters.keySet().size(), "Unexpected amount of bean names"); }
Example #12
Source File: JvmMemMgrPoolRelTableMetaImpl.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
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
Source File: JvmMemMgrPoolRelTableMetaImpl.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * 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: JvmMemMgrPoolRelTableMetaImpl.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
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 #15
Source File: MemoryManagerMXBeanResource.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Override ResourceEntry getChildEntry(String name) { for (MemoryManagerMXBean mbean : ManagementFactory.getMemoryManagerMXBeans()) { if (name.equals(escapeMBeanName(mbean.getName()))) { return new LeafPlatformMBeanResource(PathElement.pathElement(ModelDescriptionConstants.NAME, name)); } } return null; }
Example #16
Source File: MemoryPoolImpl.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
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 #17
Source File: JvmMemMgrPoolRelTableMetaImpl.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
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 #18
Source File: MemoryPoolImpl.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
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 #19
Source File: Test.java From ClusterDeviceControlPlatform with MIT License | 5 votes |
private static void printMemoryManagerInfo() { List<MemoryManagerMXBean> managers = ManagementFactory.getMemoryManagerMXBeans(); if (managers != null && !managers.isEmpty()) { for (MemoryManagerMXBean manager : managers) { System.out.println("vm内存管理器:名称=" + manager.getName() + ",管理的内存区=" + Arrays.deepToString(manager.getMemoryPoolNames()) + ",ObjectName=" + manager.getObjectName()); } } }
Example #20
Source File: MemoryPoolImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
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 #21
Source File: MemoryPoolImpl.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
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 #22
Source File: JvmMemMgrPoolRelTableMetaImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
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 #23
Source File: MXBeanInteropTest1.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
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 #24
Source File: MemoryPoolImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
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 #25
Source File: MXBeanInteropTest1.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
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 #26
Source File: MemoryUsageTest.java From JDKSourceCode1.8 with MIT License | 5 votes |
public static void main(String[] args) { MemoryMXBean memoryMxBean = ManagementFactory.getMemoryMXBean(); MemoryUsage memoryUsage = memoryMxBean.getHeapMemoryUsage(); System.out.println(memoryUsage); List<MemoryManagerMXBean> memoryManagerMXBeans = ManagementFactory.getMemoryManagerMXBeans(); for (MemoryManagerMXBean memoryManagerMXBean : memoryManagerMXBeans) { System.out.println(memoryManagerMXBean.getName()); } }
Example #27
Source File: MXBeanInteropTest1.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
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 #28
Source File: MXBeanInteropTest1.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
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 #29
Source File: OperatingSystemInfoUtil.java From Deta_Cache with Apache License 2.0 | 5 votes |
/** * Java ������е��ڴ������ */ public static Map<String, Object> showMemoryManager(){ Map<String, Object> map = new HashMap<>(); List<MemoryManagerMXBean> mm = ManagementFactory.getMemoryManagerMXBeans(); for(MemoryManagerMXBean eachmm: mm){ Map<String, String> innerMap = new HashMap<>(); // System.out.println("name:" + eachmm.getName()); // System.out.println("MemoryPoolNames:" + eachmm.getMemoryPoolNames().toString()); innerMap.put("MemoryPoolNames:", "" + eachmm.getMemoryPoolNames().toString()); map.put(eachmm.getName(), innerMap); } return map; }
Example #30
Source File: MemoryPoolImpl.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
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; }