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

The following examples show how to use java.lang.management.ManagementFactory#getMemoryManagerMXBeans() . 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: MemoryPoolsPresenceTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
protected void runTest() {
    List<MemoryManagerMXBean> beans
            = ManagementFactory.getMemoryManagerMXBeans();
    Optional<MemoryManagerMXBean> any = beans
            .stream()
            .filter(bean -> CC_MANAGER.equals(bean.getName()))
            .findAny();
    Asserts.assertTrue(any.isPresent(), "Bean not found: " + CC_MANAGER);
    MemoryManagerMXBean ccManager = any.get();
    Asserts.assertNotNull(ccManager, "Found null for " + CC_MANAGER);
    String names[] = ccManager.getMemoryPoolNames();
    for (String name : names) {
        counters.put(name, counters.containsKey(name)
                ? counters.get(name) + 1 : 1);
    }
    for (BlobType btype : BlobType.getAvailable()) {
        Asserts.assertEQ(counters.get(btype.getMemoryPool().getName()), 1,
                "Found unexpected amount of beans for pool "
                + btype.getMemoryPool().getName());
    }
    Asserts.assertEQ(BlobType.getAvailable().size(),
            counters.keySet().size(), "Unexpected amount of bean names");
}
 
Example 2
Source File: VMLogger.java    From openjdk-systemtest with Apache License 2.0 6 votes vote down vote up
private void initialiseProxies() {
    runtimeBean  = ManagementFactory.getRuntimeMXBean();
    osBean       = ManagementFactory.getOperatingSystemMXBean();
    classBean    = ManagementFactory.getClassLoadingMXBean();
    
    if (!(compiler.equals("")))
    {	
        compBean  = ManagementFactory.getCompilationMXBean();
    }
    
    threadBean   = ManagementFactory.getThreadMXBean();
    memBean      = ManagementFactory.getMemoryMXBean();
    logBean      = LogManager.getLoggingMXBean();

    memPoolBeans = ManagementFactory.getMemoryPoolMXBeans();
    memMgrBeans  = ManagementFactory.getMemoryManagerMXBeans();
    gcBeans      = ManagementFactory.getGarbageCollectorMXBeans();
}
 
Example 3
Source File: MemoryManagerMXBeanResource.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
Set<String> getChildrenNames() {
    final Set<String> result = new LinkedHashSet<String>();
    for (MemoryManagerMXBean mbean : ManagementFactory.getMemoryManagerMXBeans()) {
        result.add(escapeMBeanName(mbean.getName()));
    }
    return result;
}
 
Example 4
Source File: OperatingSystemInfoUtil.java    From Deta_Cache with Apache License 2.0 5 votes vote down vote up
/**
	 * 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 5
Source File: MemoryManagerMXBeanResource.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@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 6
Source File: Test.java    From ClusterDeviceControlPlatform with MIT License 5 votes vote down vote up
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 7
Source File: Test.java    From ClusterDeviceControlPlatform with MIT License 5 votes vote down vote up
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 8
Source File: MemoryManagerMXBeanAttributeHandler.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
protected void executeReadAttribute(OperationContext context, ModelNode operation) throws OperationFailedException {

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

    MemoryManagerMXBean memoryManagerMXBean = null;

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

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

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

}
 
Example 9
Source File: JvmMemManagerTableMetaImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Call ManagementFactory.getMemoryManagerMXBeans() to
 * load the raw data of this table.
 **/
protected List<MemoryManagerMXBean> loadRawDatas(Map<Object, Object> userData) {
    return ManagementFactory.getMemoryManagerMXBeans();
}
 
Example 10
Source File: JvmMemManagerTableMetaImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Call ManagementFactory.getMemoryManagerMXBeans() to
 * load the raw data of this table.
 **/
protected List<MemoryManagerMXBean> loadRawDatas(Map<Object, Object> userData) {
    return ManagementFactory.getMemoryManagerMXBeans();
}
 
Example 11
Source File: JvmMemManagerTableMetaImpl.java    From jdk8u60 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Call ManagementFactory.getMemoryManagerMXBeans() to
 * load the raw data of this table.
 **/
protected List<MemoryManagerMXBean> loadRawDatas(Map<Object, Object> userData) {
    return ManagementFactory.getMemoryManagerMXBeans();
}
 
Example 12
Source File: JvmMemManagerTableMetaImpl.java    From jdk8u-jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Call ManagementFactory.getMemoryManagerMXBeans() to
 * load the raw data of this table.
 **/
protected List<MemoryManagerMXBean> loadRawDatas(Map<Object, Object> userData) {
    return ManagementFactory.getMemoryManagerMXBeans();
}
 
Example 13
Source File: JvmMemManagerTableMetaImpl.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Call ManagementFactory.getMemoryManagerMXBeans() to
 * load the raw data of this table.
 **/
protected List<MemoryManagerMXBean> loadRawDatas(Map<Object, Object> userData) {
    return ManagementFactory.getMemoryManagerMXBeans();
}
 
Example 14
Source File: JvmMemManagerTableMetaImpl.java    From openjdk-8-source with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Call ManagementFactory.getMemoryManagerMXBeans() to
 * load the raw data of this table.
 **/
protected List<MemoryManagerMXBean> loadRawDatas(Map<Object, Object> userData) {
    return ManagementFactory.getMemoryManagerMXBeans();
}
 
Example 15
Source File: JvmMemManagerTableMetaImpl.java    From openjdk-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Call ManagementFactory.getMemoryManagerMXBeans() to
 * load the raw data of this table.
 **/
protected List<MemoryManagerMXBean> loadRawDatas(Map<Object, Object> userData) {
    return ManagementFactory.getMemoryManagerMXBeans();
}
 
Example 16
Source File: JvmMemManagerTableMetaImpl.java    From jdk8u_jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Call ManagementFactory.getMemoryManagerMXBeans() to
 * load the raw data of this table.
 **/
protected List<MemoryManagerMXBean> loadRawDatas(Map<Object, Object> userData) {
    return ManagementFactory.getMemoryManagerMXBeans();
}
 
Example 17
Source File: JvmMemManagerTableMetaImpl.java    From jdk8u-jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Call ManagementFactory.getMemoryManagerMXBeans() to
 * load the raw data of this table.
 **/
protected List<MemoryManagerMXBean> loadRawDatas(Map<Object, Object> userData) {
    return ManagementFactory.getMemoryManagerMXBeans();
}
 
Example 18
Source File: JvmMemManagerTableMetaImpl.java    From jdk8u-dev-jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Call ManagementFactory.getMemoryManagerMXBeans() to
 * load the raw data of this table.
 **/
protected List<MemoryManagerMXBean> loadRawDatas(Map<Object, Object> userData) {
    return ManagementFactory.getMemoryManagerMXBeans();
}
 
Example 19
Source File: JvmMemManagerTableMetaImpl.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Call ManagementFactory.getMemoryManagerMXBeans() to
 * load the raw data of this table.
 **/
protected List<MemoryManagerMXBean> loadRawDatas(Map<Object, Object> userData) {
    return ManagementFactory.getMemoryManagerMXBeans();
}
 
Example 20
Source File: JvmMemManagerTableMetaImpl.java    From dragonwell8_jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Call ManagementFactory.getMemoryManagerMXBeans() to
 * load the raw data of this table.
 **/
protected List<MemoryManagerMXBean> loadRawDatas(Map<Object, Object> userData) {
    return ManagementFactory.getMemoryManagerMXBeans();
}