当前位置: 首页>>代码示例>>Java>>正文


Java JMX.newMXBeanProxy方法代码示例

本文整理汇总了Java中javax.management.JMX.newMXBeanProxy方法的典型用法代码示例。如果您正苦于以下问题:Java JMX.newMXBeanProxy方法的具体用法?Java JMX.newMXBeanProxy怎么用?Java JMX.newMXBeanProxy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.management.JMX的用法示例。


在下文中一共展示了JMX.newMXBeanProxy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testCaseProb

import javax.management.JMX; //导入方法依赖的package包/类
private static void testCaseProb() throws Exception {
    MBeanServer mbs = MBeanServerFactory.newMBeanServer();
    ObjectName name = new ObjectName("a:b=c");
    mbs.registerMBean(new CaseProbImpl(), name);
    CaseProbMXBean proxy = JMX.newMXBeanProxy(mbs, name, CaseProbMXBean.class);
    try {
        CaseProb prob = proxy.getCaseProb();
        fail("No exception from proxy method getCaseProb");
    } catch (IllegalArgumentException e) {
        String messageChain = messageChain(e);
        if (messageChain.contains("URLPath")) {
            System.out.println("Message chain contains URLPath as required: "
                    + messageChain);
        } else {
            fail("Exception chain for CaseProb does not mention property" +
                    " URLPath differing only in case");
            System.out.println("Full stack trace:");
            e.printStackTrace(System.out);
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:ExceptionDiagnosisTest.java

示例2: getSimonProxyBean

import javax.management.JMX; //导入方法依赖的package包/类
private SimonManagerMXBean getSimonProxyBean (
												MBeanServerConnection mbeanConn,
												ServiceCollectionResults collectionResults ) {

	SimonManagerMXBean simonMgrMxBean = null;

	ServiceInstance service = collectionResults.getServiceInstance();
	if ( service.getSimonMbean().length() > 0 ) {

		try {
			simonMgrMxBean = JMX.newMXBeanProxy(
				mbeanConn, new ObjectName(
					collectionResults.getServiceInstance().getSimonMbean() ),
				SimonManagerMXBean.class );
		} catch (Exception e) {
			logger.warn( "Failed to get simon proxy", CSAP.getCsapFilteredStackTrace( e ) );
		}

	}

	logger.debug( "{} type: {} Simon mbean name: {} ",
		service.getServiceName(), service.getServerType(), service.getSimonMbean() );

	return simonMgrMxBean;
}
 
开发者ID:csap-platform,项目名称:csap-core,代码行数:26,代码来源:ServiceCollector.java

示例3: getManagingMemberMXBean

import javax.management.JMX; //导入方法依赖的package包/类
/**
 * Lookup operation for the MemberMXBean representing the Manager in the GemFire cluster. This
 * method gets an instance fo the Platform MBeanServer for this JVM process and uses it to lookup
 * the MemberMXBean for the GemFire Manager based on the ObjectName declared in the
 * DistributedSystemMXBean.getManagerObjectName() operation.
 * 
 * @return a proxy instance to the MemberMXBean of the GemFire Manager.
 * @see #getMBeanServer()
 * @see #createMemberMXBeanForManagerUsingProxy(javax.management.MBeanServer,
 *      javax.management.ObjectName)
 * @see org.apache.geode.management.DistributedSystemMXBean
 * @see org.apache.geode.management.MemberMXBean
 */
protected synchronized MemberMXBean getManagingMemberMXBean() {
  if (managingMemberMXBeanProxy == null) {
    SystemManagementService service = (SystemManagementService) ManagementService
        .getExistingManagementService(GemFireCacheImpl.getInstance());
    MBeanServer mbs = getMBeanServer();

    final DistributedSystemMXBean distributedSystemMXBean = JMX.newMXBeanProxy(mbs,
        MBeanJMXAdapter.getDistributedSystemName(), DistributedSystemMXBean.class);

    managingMemberMXBeanProxy = createMemberMXBeanForManagerUsingProxy(mbs,
        distributedSystemMXBean.getMemberObjectName());
  }

  return managingMemberMXBeanProxy;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:29,代码来源:AbstractCommandsController.java

示例4: doMemoryManagerMXBeanTest

import javax.management.JMX; //导入方法依赖的package包/类
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 ;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:40,代码来源:MXBeanInteropTest1.java

示例5: ConfigRegistryJMXClient

import javax.management.JMX; //导入方法依赖的package包/类
private ConfigRegistryJMXClient(final MBeanServer configMBeanServer, final ObjectName configRegistryON) {
    this.configMBeanServer = configMBeanServer;
    this.configRegistryON = configRegistryON;
    Set<ObjectInstance> searchResult = configMBeanServer.queryMBeans(configRegistryON, null);
    if (searchResult.size() != 1) {
        throw new IllegalStateException("Config registry not found");
    }
    configRegistryMXBeanProxy = JMX.newMXBeanProxy(configMBeanServer, configRegistryON, ConfigRegistryMXBean.class,
            false);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:11,代码来源:ConfigRegistryJMXClient.java

示例6: testSettersWithMXBeanProxy

import javax.management.JMX; //导入方法依赖的package包/类
@Test
public void testSettersWithMXBeanProxy() {
    TestingFixedThreadPoolConfigMXBean proxy = JMX.newMXBeanProxy(platformMBeanServer, threadPoolDynamicWrapperON,
            TestingFixedThreadPoolConfigMXBean.class);
    proxy.setThreadCount(newThreadCount);
    assertEquals(newThreadCount, threadPoolConfigBean.getThreadCount());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:8,代码来源:DynamicWritableWrapperTest.java

示例7: createOtherConfigurationMBean

import javax.management.JMX; //导入方法依赖的package包/类
public ScanDirConfigMXBean createOtherConfigurationMBean(String name,
        String filename)
    throws JMException {
    final ScanDirConfig profile = new ScanDirConfig(filename);
    final ObjectName profName = makeScanDirConfigName(name);
    final ObjectInstance moi = mbeanServer.registerMBean(profile,profName);
    final ScanDirConfigMXBean proxy =
            JMX.newMXBeanProxy(mbeanServer,profName,
                ScanDirConfigMXBean.class,true);
    configmap.put(moi.getObjectName(),proxy);
    return proxy;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:13,代码来源:ScanManager.java

示例8: shutdownViaRuntimeJMX

import javax.management.JMX; //导入方法依赖的package包/类
private void shutdownViaRuntimeJMX(final String secret) throws Exception {
    // test JMX rpc
    ShutdownRuntimeMXBean runtime = JMX.newMXBeanProxy(platformMBeanServer, runtimeON, ShutdownRuntimeMXBean.class);
    try {
        runtime.shutdown("", 60000L, null);
        fail();
    } catch (final IllegalArgumentException e) {
        assertEquals("Invalid secret", e.getMessage());
    }
    runtime.shutdown(secret, 60000L, null);
    assertStopped();
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:13,代码来源:ShutdownTest.java

示例9: getInstanceServiceMXBean

import javax.management.JMX; //导入方法依赖的package包/类
@Override
public InstanceServiceMXBean getInstanceServiceMXBean(
        String domainId,
        String instanceId,
        com.ibm.streams.management.instance.InstanceServiceMXBean.Type serviceType) {
    ObjectName serviceObjectName = ObjectNameBuilder.instanceService(
            domainId, instanceId, serviceType);
    return JMX.newMXBeanProxy(connection, serviceObjectName,
            InstanceServiceMXBean.class, true);
}
 
开发者ID:IBMStreams,项目名称:streamsx.jmxclients,代码行数:11,代码来源:JmxConnectionPool.java

示例10: doOperatingSystemMXBeanTest

import javax.management.JMX; //导入方法依赖的package包/类
private final int doOperatingSystemMXBeanTest(MBeanServerConnection mbsc) {
    int errorCount = 0 ;
    System.out.println("---- OperatingSystemMXBean") ;

    try {
        ObjectName operationName =
                new ObjectName(ManagementFactory.OPERATING_SYSTEM_MXBEAN_NAME) ;
        MBeanInfo mbInfo = mbsc.getMBeanInfo(operationName);
        errorCount += checkNonEmpty(mbInfo);
        System.out.println("getMBeanInfo\t\t" + mbInfo);
        OperatingSystemMXBean operation = null ;

        operation =
                JMX.newMXBeanProxy(mbsc,
                operationName,
                OperatingSystemMXBean.class) ;
        System.out.println("getArch\t\t"
                + operation.getArch());
        System.out.println("getAvailableProcessors\t\t"
                + operation.getAvailableProcessors());
        System.out.println("getName\t\t"
                + operation.getName());
        System.out.println("getVersion\t\t"
                + operation.getVersion());

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

    return errorCount ;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:35,代码来源:MXBeanInteropTest1.java

示例11: getOperatorInputPortMXBean

import javax.management.JMX; //导入方法依赖的package包/类
@Override
public OperatorInputPortMXBean getOperatorInputPortMXBean(
        String domainId, String instanceId, BigInteger jobId,
        String operator, int indexWithinOperator) {
    ObjectName inputPortName = ObjectNameBuilder.operatorInputPort(
            domainId, instanceId, jobId, operator, indexWithinOperator);
    return JMX.newMXBeanProxy(connection, inputPortName,
            OperatorInputPortMXBean.class, true);
}
 
开发者ID:IBMStreams,项目名称:streamsx.jmxclients,代码行数:10,代码来源:JmxConnectionPool.java

示例12: getOperatorOutputPortMXBean

import javax.management.JMX; //导入方法依赖的package包/类
@Override
public OperatorOutputPortMXBean getOperatorOutputPortMXBean(
        String domainId, String instanceId, BigInteger jobId,
        String operator, int indexWithinOperator) {
    ObjectName outputPortName = ObjectNameBuilder.operatorOutputPort(
            domainId, instanceId, jobId, operator, indexWithinOperator);
    return JMX.newMXBeanProxy(connection, outputPortName,
            OperatorOutputPortMXBean.class, true);
}
 
开发者ID:IBMStreams,项目名称:streamsx.jmxclients,代码行数:10,代码来源:JmxConnectionPool.java

示例13: main

import javax.management.JMX; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    MBeanServer mbs = MBeanServerFactory.newMBeanServer();
    ObjectName name = new ObjectName("a:b=c");
    StupidMXBean stupid = new StupidImpl();
    mbs.registerMBean(stupid, name);
    ObjectName referName = new ObjectName("a:c=d");
    mbs.registerMBean(new ReferImpl(stupid), referName);
    System.out.println(mbs.getMBeanInfo(name));
    StupidMXBean stupid2 = (StupidMXBean)
            Proxy.newProxyInstance(StupidMXBean.class.getClassLoader(),
                new Class<?>[] {StupidMXBean.class},
                new WrapInvocationHandler(stupid));
    ObjectName stupidName2 = new ObjectName("a:d=e");
    mbs.registerMBean(stupid2, stupidName2);
    Field zero = StupidMXBean.class.getField("ZERO");
    System.out.println("Zero field = " + zero.get(null));
    test(mbs, MerlinMXBean.class);
    test(mbs, TigerMXBean.class);

    StupidMXBean proxy = JMX.newMXBeanProxy(mbs, name, StupidMXBean.class);
    System.out.println("Zero = " + proxy.getZero());
    System.out.println("One = " + proxy.identity(1));
    ReferMXBean referProxy =
            JMX.newMXBeanProxy(mbs, referName, ReferMXBean.class);
    StupidMXBean stupidProxy2 = referProxy.getStupid();
    System.out.println("Same proxy: " + (proxy == stupidProxy2));
    Method[] methods = StupidMXBean.class.getMethods();
    for (Method method : methods) {
        if (method.getParameterTypes().length == 0)
            method.invoke(proxy, new Object[0]);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:33,代码来源:RandomMXBeanTest.java

示例14: getPeOutputPortMXBean

import javax.management.JMX; //导入方法依赖的package包/类
@Override
public PeOutputPortMXBean getPeOutputPortMXBean(String domainId,
        String instanceId, BigInteger peId, int indexWithinPe) {
    ObjectName outputPortName = ObjectNameBuilder.peOutputPort(
            domainId, instanceId, peId, indexWithinPe);
    return JMX.newMXBeanProxy(connection, outputPortName,
            PeOutputPortMXBean.class, true);
}
 
开发者ID:IBMStreams,项目名称:streamsx.jmxclients,代码行数:9,代码来源:JmxConnectionPool.java

示例15: doClassLoadingMXBeanTest

import javax.management.JMX; //导入方法依赖的package包/类
private final int doClassLoadingMXBeanTest(MBeanServerConnection mbsc) {
    int errorCount = 0 ;
    System.out.println("---- ClassLoadingMXBean") ;

    try {
        ObjectName classLoadingName =
                new ObjectName(ManagementFactory.CLASS_LOADING_MXBEAN_NAME) ;
        MBeanInfo mbInfo = mbsc.getMBeanInfo(classLoadingName);
        errorCount += checkNonEmpty(mbInfo);
        System.out.println("getMBeanInfo\t\t"
                + mbInfo);
        ClassLoadingMXBean classLoading = null;

        classLoading = JMX.newMXBeanProxy(mbsc,
                classLoadingName,
                ClassLoadingMXBean.class) ;
        System.out.println("getLoadedClassCount\t\t"
                + classLoading.getLoadedClassCount());
        System.out.println("getTotalLoadedClassCount\t\t"
                + classLoading.getTotalLoadedClassCount());
        System.out.println("getUnloadedClassCount\t\t"
                + classLoading.getUnloadedClassCount());
        System.out.println("isVerbose\t\t"
                + classLoading.isVerbose());

        System.out.println("---- OK\n") ;

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

    return errorCount ;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:36,代码来源:MXBeanInteropTest1.java


注:本文中的javax.management.JMX.newMXBeanProxy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。