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


Java Introspector.testComplianceMBeanInterface方法代码示例

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


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

示例1: createProxy

import com.sun.jmx.mbeanserver.Introspector; //导入方法依赖的package包/类
/**
 * Centralised M(X)Bean proxy creation code
 * @param connection {@linkplain MBeanServerConnection} to use
 * @param objectName M(X)Bean object name
 * @param interfaceClass M(X)Bean interface class
 * @param notificationEmitter Is a notification emitter?
 * @param isMXBean Is an MXBean?
 * @return Returns an M(X)Bean proxy generated for the provided interface class
 * @throws SecurityException
 * @throws IllegalArgumentException
 */
private static <T> T createProxy(MBeanServerConnection connection,
                                 ObjectName objectName,
                                 Class<T> interfaceClass,
                                 boolean notificationEmitter,
                                 boolean isMXBean) {

    try {
        if (isMXBean) {
            // Check interface for MXBean compliance
            Introspector.testComplianceMXBeanInterface(interfaceClass);
        } else {
            // Check interface for MBean compliance
            Introspector.testComplianceMBeanInterface(interfaceClass);
        }
    } catch (NotCompliantMBeanException e) {
        throw new IllegalArgumentException(e);
    }

    InvocationHandler handler = new MBeanServerInvocationHandler(
            connection, objectName, isMXBean);
    final Class<?>[] interfaces;
    if (notificationEmitter) {
        interfaces =
            new Class<?>[] {interfaceClass, NotificationEmitter.class};
    } else
        interfaces = new Class<?>[] {interfaceClass};

    Object proxy = Proxy.newProxyInstance(
            interfaceClass.getClassLoader(),
            interfaces,
            handler);
    return interfaceClass.cast(proxy);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:45,代码来源:JMX.java

示例2: createProxy

import com.sun.jmx.mbeanserver.Introspector; //导入方法依赖的package包/类
/**
 * Centralised M(X)Bean proxy creation code
 * @param connection {@linkplain MBeanServerConnection} to use
 * @param objectName M(X)Bean object name
 * @param interfaceClass M(X)Bean interface class
 * @param notificationEmitter Is a notification emitter?
 * @param isMXBean Is an MXBean?
 * @return Returns an M(X)Bean proxy generated for the provided interface class
 * @throws SecurityException
 * @throws IllegalArgumentException
 */
private static <T> T createProxy(MBeanServerConnection connection,
                                 ObjectName objectName,
                                 Class<T> interfaceClass,
                                 boolean notificationEmitter,
                                 boolean isMXBean) {

    if (System.getSecurityManager() != null) {
        checkProxyInterface(interfaceClass);
    }
    try {
        if (isMXBean) {
            // Check interface for MXBean compliance
            Introspector.testComplianceMXBeanInterface(interfaceClass);
        } else {
            // Check interface for MBean compliance
            Introspector.testComplianceMBeanInterface(interfaceClass);
        }
    } catch (NotCompliantMBeanException e) {
        throw new IllegalArgumentException(e);
    }

    InvocationHandler handler = new MBeanServerInvocationHandler(
            connection, objectName, isMXBean);
    final Class<?>[] interfaces;
    if (notificationEmitter) {
        interfaces =
            new Class<?>[] {interfaceClass, NotificationEmitter.class};
    } else
        interfaces = new Class<?>[] {interfaceClass};

    Object proxy = Proxy.newProxyInstance(
            interfaceClass.getClassLoader(),
            interfaces,
            handler);
    return interfaceClass.cast(proxy);
}
 
开发者ID:greghaskins,项目名称:openjdk-jdk7u-jdk,代码行数:48,代码来源:JMX.java


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