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


Java MXBeanSupport类代码示例

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


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

示例1: construct

import com.sun.jmx.mbeanserver.MXBeanSupport; //导入依赖的package包/类
/**
 * Make a DynamicMBean out of <var>implementation</var>, using the
 * specified <var>mbeanInterface</var> class.
 * @param implementation The implementation of this MBean.
 *        If <code>null</code>, and null implementation is allowed,
 *        then the implementation is assumed to be <var>this</var>.
 * @param mbeanInterface The Management Interface exported by this
 *        MBean's implementation. If <code>null</code>, then this
 *        object will use standard JMX design pattern to determine
 *        the management interface associated with the given
 *        implementation.
 * @param nullImplementationAllowed <code>true</code> if a null
 *        implementation is allowed. If null implementation is allowed,
 *        and a null implementation is passed, then the implementation
 *        is assumed to be <var>this</var>.
 * @exception IllegalArgumentException if the given
 *    <var>implementation</var> is null, and null is not allowed.
 **/
private <T> void construct(T implementation, Class<T> mbeanInterface,
                           boolean nullImplementationAllowed,
                           boolean isMXBean)
                           throws NotCompliantMBeanException {
    if (implementation == null) {
        // Have to use (T)this rather than mbeanInterface.cast(this)
        // because mbeanInterface might be null.
        if (nullImplementationAllowed)
            implementation = Util.<T>cast(this);
        else throw new IllegalArgumentException("implementation is null");
    }
    if (isMXBean) {
        if (mbeanInterface == null) {
            mbeanInterface = Util.cast(Introspector.getMXBeanInterface(
                    implementation.getClass()));
        }
        this.mbean = new MXBeanSupport(implementation, mbeanInterface);
    } else {
        if (mbeanInterface == null) {
            mbeanInterface = Util.cast(Introspector.getStandardMBeanInterface(
                    implementation.getClass()));
        }
        this.mbean =
                new StandardMBeanSupport(implementation, mbeanInterface);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:45,代码来源:StandardMBean.java

示例2: setImplementation

import com.sun.jmx.mbeanserver.MXBeanSupport; //导入依赖的package包/类
/**
 * <p>Replace the implementation object wrapped in this object.</p>
 *
 * @param implementation The new implementation of this Standard MBean
 * (or MXBean). The <code>implementation</code> object must implement
 * the Standard MBean (or MXBean) interface that was supplied when this
 * <code>StandardMBean</code> was constructed.
 *
 * @exception IllegalArgumentException if the given
 * <var>implementation</var> is null.
 *
 * @exception NotCompliantMBeanException if the given
 * <var>implementation</var> does not implement the
 * Standard MBean (or MXBean) interface that was
 * supplied at construction.
 *
 * @see #getImplementation
 **/
public void setImplementation(Object implementation)
    throws NotCompliantMBeanException {

    if (implementation == null)
        throw new IllegalArgumentException("implementation is null");

    if (isMXBean()) {
        this.mbean = new MXBeanSupport(implementation,
                Util.<Class<Object>>cast(getMBeanInterface()));
    } else {
        this.mbean = new StandardMBeanSupport(implementation,
                Util.<Class<Object>>cast(getMBeanInterface()));
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:33,代码来源:StandardMBean.java


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