java类javax.management.MBeanException的实例源码

DefaultMBeanServerInterceptor.java 文件源码 项目:jdk8u-jdk 阅读 24 收藏 0 点赞 0 评论 0
public ObjectInstance createMBean(String className, ObjectName name,
                                  ObjectName loaderName,
                                  Object[] params, String[] signature)
    throws ReflectionException, InstanceAlreadyExistsException,
           MBeanRegistrationException, MBeanException,
           NotCompliantMBeanException, InstanceNotFoundException  {

    return createMBean(className, name, loaderName, false,
                       params, signature);
}
AbstractDynamicWrapper.java 文件源码 项目:hashsdn-controller 阅读 24 收藏 0 点赞 0 评论 0
@Override
public Object getAttribute(final String attributeName)
        throws AttributeNotFoundException, MBeanException, ReflectionException {
    if ("MBeanInfo".equals(attributeName)) {
        return getMBeanInfo();
    }

    Object obj = null;
    try {
        obj = internalServer.getAttribute(objectNameInternal, attributeName);
    } catch (final InstanceNotFoundException e) {
        throw new MBeanException(e);
    }

    if (obj instanceof ObjectName) {
        AttributeHolder attributeHolder = attributeHolderMap.get(attributeName);
        if (attributeHolder.getRequireInterfaceOrNull() != null) {
            obj = fixObjectName((ObjectName) obj);
        }
        return obj;
    }

    if (isDependencyListAttr(attributeName, obj)) {
        obj = fixDependencyListAttribute(obj);
    }

    return obj;
}
AvoidGetMBeanInfoCallsTest.java 文件源码 项目:openjdk-jdk10 阅读 17 收藏 0 点赞 0 评论 0
public Object invoke(String actionName,
                     Object params[],
                     String signature[])
    throws MBeanException,
           ReflectionException {
    return null;
}
BaseModelMBean.java 文件源码 项目:tomcat7 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Send a <code>Notification</code> to all registered listeners as a
 * <code>jmx.modelmbean.general</code> notification.
 *
 * @param notification The <code>Notification</code> that will be passed
 *
 * @exception MBeanException if an object initializer throws an
 *  exception
 * @exception RuntimeOperationsException wraps IllegalArgumentException
 *  when the specified notification is <code>null</code> or invalid
 */
@Override
public void sendNotification(Notification notification)
    throws MBeanException, RuntimeOperationsException {

    if (notification == null)
        throw new RuntimeOperationsException
            (new IllegalArgumentException("Notification is null"),
             "Notification is null");
    if (generalBroadcaster == null)
        return; // This means there are no registered listeners
    generalBroadcaster.sendNotification(notification);

}
SetConfigurationSetting.java 文件源码 项目:oscm 阅读 19 收藏 0 点赞 0 评论 0
@Override
public Object invoke(String actionName, Object[] params, String[] signature)
        throws MBeanException, ReflectionException {
    Object result = null;
    if (actionName.equals(SET_CONFIGURATION_SETTING)) {
        result = setConfigurationSetting((String) params[0],
                (String) params[1]);
    } else {
        throw new ReflectionException(new NoSuchMethodException(actionName));
    }
    return result;
}
SnmpGenericObjectServer.java 文件源码 项目:OpenJSharp 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Set the value of an SNMP variable.
 *
 * <p><b><i>
 * You should never need to use this method directly.
 * </i></b></p>
 *
 * @param meta  The impacted metadata object
 * @param name  The ObjectName of the impacted MBean
 * @param x     The new requested SnmpValue
 * @param id    The OID arc identifying the variable we're trying to set.
 * @param data  User contextual data allocated through the
 *        {@link com.sun.jmx.snmp.agent.SnmpUserDataFactory}
 *
 * @return The new value of the variable after the operation.
 *
 * @exception SnmpStatusException whenever an SNMP exception must be
 *      raised. Raising an exception will abort the request. <br>
 *      Exceptions should never be raised directly, but only by means of
 * <code>
 * req.registerSetException(<i>VariableId</i>,<i>SnmpStatusException</i>)
 * </code>
 **/
public SnmpValue set(SnmpGenericMetaServer meta, ObjectName name,
                     SnmpValue x, long id, Object data)
    throws SnmpStatusException {
    final String attname = meta.getAttributeName(id);
    final Object attvalue=
        meta.buildAttributeValue(id,x);
    final Attribute att = new Attribute(attname,attvalue);

    Object result = null;

    try {
        server.setAttribute(name,att);
        result = server.getAttribute(name,attname);
    } catch(InvalidAttributeValueException iv) {
        throw new
            SnmpStatusException(SnmpStatusException.snmpRspWrongValue);
    } catch (InstanceNotFoundException f) {
        throw new
            SnmpStatusException(SnmpStatusException.snmpRspInconsistentName);
    } catch (ReflectionException r) {
        throw new
            SnmpStatusException(SnmpStatusException.snmpRspInconsistentName);
    } catch (MBeanException m) {
        Exception t = m.getTargetException();
        if (t instanceof SnmpStatusException)
            throw (SnmpStatusException) t;
        throw new
            SnmpStatusException(SnmpStatusException.noAccess);
    } catch (Exception e) {
        throw new
            SnmpStatusException(SnmpStatusException.noAccess);
    }

    return meta.buildSnmpValue(id,result);
}
MBeanExceptionTest.java 文件源码 项目:openjdk-jdk10 阅读 19 收藏 0 点赞 0 评论 0
public Object getAttribute(String attrName)
        throws MBeanException {
    if (attrName.equals("UncheckedException"))
        throw theUncheckedException;
    else
        throw new AssertionError();
}
SpringModelMBean.java 文件源码 项目:lams 阅读 26 收藏 0 点赞 0 评论 0
/**
 * Sets managed resource to expose and stores its {@link ClassLoader}.
 */
@Override
public void setManagedResource(Object managedResource, String managedResourceType)
        throws MBeanException, InstanceNotFoundException, InvalidTargetObjectTypeException {

    this.managedResourceClassLoader = managedResource.getClass().getClassLoader();
    super.setManagedResource(managedResource, managedResourceType);
}
RequiredModelMBean.java 文件源码 项目:jdk8u-jdk 阅读 24 收藏 0 点赞 0 评论 0
/**
 * 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");
    }
}
MX4JModelMBean.java 文件源码 项目:monarch 阅读 26 收藏 0 点赞 0 评论 0
public void load() throws MBeanException, RuntimeOperationsException, InstanceNotFoundException {
  PersisterMBean persister = findPersister();
  if (persister != null) {
    ModelMBeanInfo info = (ModelMBeanInfo) persister.load();
    setModelMBeanInfo(info);
  }
}


问题


面经


文章

微信
公众号

扫码关注公众号