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


Java MBeanException类代码示例

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


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

示例1: createMBean

import javax.management.MBeanException; //导入依赖的package包/类
/**
 * Create, register, and return an MBean for this
 * <code>Context</code> object.
 *
 * @param context The Context to be managed
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public static ModelMBean createMBean(Context context)
    throws Exception {

    String mname = createManagedName(context);
    ManagedBean managed = registry.findManagedBean(mname);
    if (managed == null) {
        Exception e = new Exception("ManagedBean is not found with "+mname);
        throw new MBeanException(e);
    }
    String domain = managed.getDomain();
    if (domain == null)
        domain = mserver.getDefaultDomain();
    ModelMBean mbean = managed.createMBean(context);
    ObjectName oname = createObjectName(domain, context);
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
 
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:27,代码来源:MBeanUtils.java

示例2: invoke

import javax.management.MBeanException; //导入依赖的package包/类
@Override
public Object invoke(String actionName, Object[] parms, String[] signature)
    throws MBeanException, ReflectionException {
  
  if (actionName == null || actionName.isEmpty()) 
    throw new IllegalArgumentException();
  
  
  // Right now we support only one fixed operation (if it applies)
  if (!(actionName.equals(RESET_ALL_MIN_MAX_OP)) || 
      mbeanInfo.getOperations().length != 1) {
    throw new ReflectionException(new NoSuchMethodException(actionName));
  }
  for (MetricsBase m : metricsRegistry.getMetricsList())  {
    if ( MetricsTimeVaryingRate.class.isInstance(m) ) {
      MetricsTimeVaryingRate.class.cast(m).resetMinMax();
    }
  }
  return null;
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:21,代码来源:MetricsDynamicMBeanBase.java

示例3: setAttribute

import javax.management.MBeanException; //导入依赖的package包/类
@Override
public synchronized void setAttribute(final Attribute attribute)
        throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException {
    Attribute newAttribute = attribute;
    if (configBeanModificationDisabled.get()) {
        throw new IllegalStateException("Operation is not allowed now");
    }

    if ("Attribute".equals(newAttribute.getName())) {
        setAttribute((Attribute) newAttribute.getValue());
        return;
    }

    try {
        if (newAttribute.getValue() instanceof ObjectName) {
            newAttribute = fixDependencyAttribute(newAttribute);
        } else if (newAttribute.getValue() instanceof ObjectName[]) {
            newAttribute = fixDependencyListAttribute(newAttribute);
        }

        internalServer.setAttribute(objectNameInternal, newAttribute);
    } catch (final InstanceNotFoundException e) {
        throw new MBeanException(e);
    }

}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:27,代码来源:DynamicWritableWrapper.java

示例4: createMBean

import javax.management.MBeanException; //导入依赖的package包/类
/**
 * Call <code>checkCreate(className)</code>, then forward this method to the
 * wrapped object.
 */
public ObjectInstance createMBean(String className, ObjectName name)
    throws
    ReflectionException,
    InstanceAlreadyExistsException,
    MBeanRegistrationException,
    MBeanException,
    NotCompliantMBeanException {
    checkCreate(className);
    SecurityManager sm = System.getSecurityManager();
    if (sm == null) {
        Object object = getMBeanServer().instantiate(className);
        checkClassLoader(object);
        return getMBeanServer().registerMBean(object, name);
    } else {
        return getMBeanServer().createMBean(className, name);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:MBeanServerAccessController.java

示例5: setAttribute

import javax.management.MBeanException; //导入依赖的package包/类
void setAttribute(Object resource, String attribute, Object value,
                  Object cookie)
        throws AttributeNotFoundException,
               InvalidAttributeValueException,
               MBeanException,
               ReflectionException {

    final M cm = setters.get(attribute);
    if (cm == null) {
        final String msg;
        if (getters.containsKey(attribute))
            msg = "Read-only attribute: " + attribute;
        else
            msg = "No such attribute: " + attribute;
        throw new AttributeNotFoundException(msg);
    }
    introspector.invokeSetter(attribute, cm, resource, value, cookie);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:PerInterface.java

示例6: createMBean

import javax.management.MBeanException; //导入依赖的package包/类
/**
 * Create, register, and return an MBean for this
 * <code>ContextEnvironment</code> object.
 *
 * @param environment
 *            The ContextEnvironment to be managed
 *
 * @exception Exception
 *                if an MBean cannot be created or registered
 */
public static DynamicMBean createMBean(ContextEnvironment environment) throws Exception {

	String mname = createManagedName(environment);
	ManagedBean managed = registry.findManagedBean(mname);
	if (managed == null) {
		Exception e = new Exception("ManagedBean is not found with " + mname);
		throw new MBeanException(e);
	}
	String domain = managed.getDomain();
	if (domain == null)
		domain = mserver.getDefaultDomain();
	DynamicMBean mbean = managed.createMBean(environment);
	ObjectName oname = createObjectName(domain, environment);
	if (mserver.isRegistered(oname)) {
		mserver.unregisterMBean(oname);
	}
	mserver.registerMBean(mbean, oname);
	return (mbean);

}
 
开发者ID:how2j,项目名称:lazycat,代码行数:31,代码来源:MBeanUtils.java

示例7: createMBean

import javax.management.MBeanException; //导入依赖的package包/类
/**
 * Create, register, and return an MBean for this
 * <code>Group</code> object.
 *
 * @param group The Group to be managed
 *
 * @exception Exception if an MBean cannot be created or registered
 */
static DynamicMBean createMBean(Group group)
    throws Exception {

    String mname = createManagedName(group);
    ManagedBean managed = registry.findManagedBean(mname);
    if (managed == null) {
        Exception e = new Exception("ManagedBean is not found with "+mname);
        throw new MBeanException(e);
    }
    String domain = managed.getDomain();
    if (domain == null)
        domain = mserver.getDefaultDomain();
    DynamicMBean mbean = managed.createMBean(group);
    ObjectName oname = createObjectName(domain, group);
    if( mserver.isRegistered( oname ))  {
        mserver.unregisterMBean(oname);
    }
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:30,代码来源:MBeanUtils.java

示例8: sendAttributeChangeNotification

import javax.management.MBeanException; //导入依赖的package包/类
public void sendAttributeChangeNotification(Attribute oldAttribute, Attribute newAttribute)
    throws MBeanException, RuntimeOperationsException {
  if (oldAttribute == null || newAttribute == null)
    throw new RuntimeOperationsException(new IllegalArgumentException(
        LocalizedStrings.MX4JModelMBean_ATTRIBUTE_CANNOT_BE_NULL.toLocalizedString()));
  if (!oldAttribute.getName().equals(newAttribute.getName()))
    throw new RuntimeOperationsException(new IllegalArgumentException(
        LocalizedStrings.MX4JModelMBean_ATTRIBUTE_NAMES_CANNOT_BE_DIFFERENT.toLocalizedString()));

  // TODO: the source must be the object name of the MBean if the listener was registered through
  // MBeanServer
  Object oldValue = oldAttribute.getValue();
  AttributeChangeNotification n = new AttributeChangeNotification(this, 1,
      System.currentTimeMillis(), "Attribute value changed", oldAttribute.getName(),
      oldValue == null ? null : oldValue.getClass().getName(), oldValue, newAttribute.getValue());
  sendAttributeChangeNotification(n);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:18,代码来源:MX4JModelMBean.java

示例9: createMBean

import javax.management.MBeanException; //导入依赖的package包/类
/**
 * Call <code>checkCreate(className)</code>, then forward this method to the
 * wrapped object.
 */
public ObjectInstance createMBean(String className, ObjectName name,
                                  Object params[], String signature[])
    throws
    ReflectionException,
    InstanceAlreadyExistsException,
    MBeanRegistrationException,
    MBeanException,
    NotCompliantMBeanException {
    checkCreate(className);
    SecurityManager sm = System.getSecurityManager();
    if (sm == null) {
        Object object = getMBeanServer().instantiate(className,
                                                     params,
                                                     signature);
        checkClassLoader(object);
        return getMBeanServer().registerMBean(object, name);
    } else {
        return getMBeanServer().createMBean(className, name,
                                            params, signature);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:26,代码来源:MBeanServerAccessController.java

示例10: getAttribute

import javax.management.MBeanException; //导入依赖的package包/类
public Object getAttribute(ObjectName name,
        String attribute)
        throws MBeanException,
        AttributeNotFoundException,
        InstanceNotFoundException,
        ReflectionException,
        IOException {
    if (logger.debugOn()) logger.debug("getAttribute",
            "name=" + name + ", attribute="
            + attribute);

    final ClassLoader old = pushDefaultClassLoader();
    try {
        return connection.getAttribute(name,
                attribute,
                delegationSubject);
    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        return connection.getAttribute(name,
                attribute,
                delegationSubject);
    } finally {
        popDefaultClassLoader(old);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:27,代码来源:RMIConnector.java

示例11: createMBean

import javax.management.MBeanException; //导入依赖的package包/类
/**
 * Create, register, and return an MBean for this
 * <code>Engine</code> object.
 *
 * @param engine The Engine to be managed
 *
 * @exception Exception if an MBean cannot be created or registered
 */
static DynamicMBean createMBean(Engine engine)
    throws Exception {

    String mname = createManagedName(engine);
    ManagedBean managed = registry.findManagedBean(mname);
    if (managed == null) {
        Exception e = new Exception("ManagedBean is not found with "+mname);
        throw new MBeanException(e);
    }
    String domain = managed.getDomain();
    if (domain == null)
        domain = mserver.getDefaultDomain();
    DynamicMBean mbean = managed.createMBean(engine);
    ObjectName oname = createObjectName(domain, engine);
    if( mserver.isRegistered( oname ))  {
        mserver.unregisterMBean(oname);
    }
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:30,代码来源:MBeanUtils.java

示例12: setAttribute

import javax.management.MBeanException; //导入依赖的package包/类
public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException {
    try {
        mbsc.setAttribute(objectName, attribute);
    } catch (Exception ex) {
        throw new MBeanException(ex);
    }
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:8,代码来源:DynamicProxy.java

示例13: createMBean

import javax.management.MBeanException; //导入依赖的package包/类
public ObjectInstance createMBean(String className,
        ObjectName name,
        Object params[],
        String signature[])
        throws ReflectionException,
        InstanceAlreadyExistsException,
        MBeanRegistrationException,
        MBeanException,
        NotCompliantMBeanException,
        IOException {
    if (logger.debugOn())
        logger.debug("createMBean(String,ObjectName,Object[],String[])",
                "className=" + className + ", name="
                + name + ", params="
                + objects(params) + ", signature="
                + strings(signature));

    final MarshalledObject<Object[]> sParams =
            new MarshalledObject<Object[]>(params);
    final ClassLoader old = pushDefaultClassLoader();
    try {
        return connection.createMBean(className,
                name,
                sParams,
                signature,
                delegationSubject);
    } catch (IOException ioe) {
        communicatorAdmin.gotIOException(ioe);

        return connection.createMBean(className,
                name,
                sParams,
                signature,
                delegationSubject);
    } finally {
        popDefaultClassLoader(old);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:39,代码来源:RMIConnector.java

示例14: setAttribute

import javax.management.MBeanException; //导入依赖的package包/类
@Override
public void setAttribute(ObjectName name, Attribute attribute)
    throws InstanceNotFoundException, AttributeNotFoundException, InvalidAttributeValueException,
    MBeanException, ReflectionException {
  ResourcePermission ctx = getOperationContext(name, attribute.getName(), false);
  this.securityService.authorize(ctx);
  mbs.setAttribute(name, attribute);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:9,代码来源:MBeanServerWrapper.java

示例15: createMBean

import javax.management.MBeanException; //导入依赖的package包/类
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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:DefaultMBeanServerInterceptor.java


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