RequiredModelMBean.java 文件源码

java
阅读 24 收藏 0 点赞 0 评论 0

项目:jdk8u-jdk 作者:
/**
 * Sets the instance handle of the object against which to
 * execute all methods in this ModelMBean management interface
 * (MBeanInfo and Descriptors).
 *
 * @param mr Object that is the managed resource
 * @param mr_type The type of reference for the managed resource.
 *     <br>Can be: "ObjectReference", "Handle", "IOR", "EJBHandle",
 *         or "RMIReference".
 *     <br>In this implementation only "ObjectReference" is supported.
 *
 * @exception MBeanException The initializer of the object has
 *            thrown an exception.
 * @exception InstanceNotFoundException The managed resource
 *            object could not be found
 * @exception InvalidTargetObjectTypeException The managed
 *            resource type should be "ObjectReference".
 * @exception RuntimeOperationsException Wraps a {@link
 *            RuntimeException} when setting the resource.
 **/
public void setManagedResource(Object mr, String mr_type)
    throws MBeanException, RuntimeOperationsException,
           InstanceNotFoundException, InvalidTargetObjectTypeException {
    if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
        MODELMBEAN_LOGGER.logp(Level.FINER,
                RequiredModelMBean.class.getName(),
            "setManagedResource(Object,String)","Entry");
    }

    // check that the mr_type is supported by this JMXAgent
    // only "objectReference" is supported
    if ((mr_type == null) ||
        (! mr_type.equalsIgnoreCase("objectReference"))) {
        if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
            MODELMBEAN_LOGGER.logp(Level.FINER,
                    RequiredModelMBean.class.getName(),
                "setManagedResource(Object,String)",
                "Managed Resource Type is not supported: " + mr_type);
        }
        throw new InvalidTargetObjectTypeException(mr_type);
    }

    if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
        MODELMBEAN_LOGGER.logp(Level.FINER,
                RequiredModelMBean.class.getName(),
            "setManagedResource(Object,String)",
            "Managed Resource is valid");
    }
    managedResource = mr;

    if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
        MODELMBEAN_LOGGER.logp(Level.FINER,
                RequiredModelMBean.class.getName(),
            "setManagedResource(Object, String)", "Exit");
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号