本文整理汇总了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);
}
}
示例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()));
}
}