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

UT2004Bot.java 文件源码 项目:Pogamut3 阅读 24 收藏 0 点赞 0 评论 0
@Override
protected AgentJMXComponents createAgentJMX() {
    return new AgentJMXComponents<IUT2004Bot>(this) {

        @Override
        protected AgentMBeanAdapter createAgentMBean(ObjectName objectName, MBeanServer mbs) throws MalformedObjectNameException, InstanceAlreadyExistsException, InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException {
            return new BotJMXMBeanAdapter(UT2004Bot.this, objectName, mbs);
        }
    };
}
QuartzSchedulerMBeanImpl.java 文件源码 项目:lams 阅读 27 收藏 0 点赞 0 评论 0
/**
 * QuartzSchedulerMBeanImpl
 * 
 * @throws NotCompliantMBeanException
 */
protected QuartzSchedulerMBeanImpl(QuartzScheduler scheduler)
        throws NotCompliantMBeanException {
    super(QuartzSchedulerMBean.class);
    this.scheduler = scheduler;
    this.scheduler.addInternalJobListener(this);
    this.scheduler.addInternalSchedulerListener(this);
    this.sampledStatistics = NULL_SAMPLED_STATISTICS;
    this.sampledStatisticsEnabled = false;
}
OldMBeanServerTest.java 文件源码 项目:openjdk-jdk10 阅读 20 收藏 0 点赞 0 评论 0
public ObjectInstance createMBean(
        String className, ObjectName name, ObjectName loaderName,
        Object[] params, String[] signature)
throws ReflectionException, InstanceAlreadyExistsException,
        MBeanRegistrationException, MBeanException,
        NotCompliantMBeanException, InstanceNotFoundException {
    Object mbean = instantiate(className, loaderName, params, signature);
    return registerMBean(mbean, name);
}
DefaultMBeanServerInterceptor.java 文件源码 项目:openjdk-jdk10 阅读 21 收藏 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);
}
DefaultMBeanServerInterceptor.java 文件源码 项目:OpenJSharp 阅读 19 收藏 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);
}
JMXProxyTest.java 文件源码 项目:jdk8u-jdk 阅读 26 收藏 0 点赞 0 评论 0
private static void testNonCompliant(Class<?> iface, boolean isMx) throws Exception {
    try {
        System.out.println("Creating a proxy for non-compliant " +
                           (isMx ? "MXBean" : "MBean") + " " +
                           iface.getName() + " ...");

        MBeanServer mbs = MBeanServerFactory.newMBeanServer();
        ObjectName on = new ObjectName("test:type=Proxy");

        if (isMx) {
            JMX.newMXBeanProxy(mbs, on, iface);
        } else {
            JMX.newMBeanProxy(mbs, on, iface);
        }
        fail("Created a proxy for non-compliant " +
             (isMx ? "MXBean" : "MBean") + " - " + iface.getName());
    } catch (Exception e) {
        Throwable t = e;
        while (t != null && !(t instanceof NotCompliantMBeanException)) {
            t = t.getCause();
        }
        if (t != null) {
            success("Proxy not created");
        } else {
            throw e;
        }
    }
}
MBeanHelper.java 文件源码 项目:Byter 阅读 19 收藏 0 点赞 0 评论 0
/**
 * Register a JMXWrapper based object to mbean server.
 * @param objectToRegister object you want to register
 * @param objectName under which object name it should be available
 */
public void registerElement(final Object objectToRegister, final ObjectName objectName){
    try{
        final JMXBeanWrapper wrapper = new JMXBeanWrapper(objectToRegister);
        this.mbs.registerMBean(wrapper, objectName);
    } catch (final IntrospectionException | NotCompliantMBeanException | MBeanRegistrationException | InstanceAlreadyExistsException e) {
        log.log(Level.WARNING, "Error during initialisation or registration of Object to MBeanserver."
                + " see Stracktrace for more Information", e);
    }
}
Introspector.java 文件源码 项目:OpenJSharp 阅读 29 收藏 0 点赞 0 评论 0
/**
 * Basic method for testing that a MBean of a given class can be
 * instantiated by the MBean server.<p>
 * This method checks that:
 * <ul><li>The given class is a concrete class.</li>
 *     <li>The given class exposes at least one public constructor.</li>
 * </ul>
 * If these conditions are not met, throws a NotCompliantMBeanException.
 * @param c The class of the MBean we want to create.
 * @exception NotCompliantMBeanException if the MBean class makes it
 *            impossible to instantiate the MBean from within the
 *            MBeanServer.
 *
 **/
public static void testCreation(Class<?> c)
    throws NotCompliantMBeanException {
    // Check if the class is a concrete class
    final int mods = c.getModifiers();
    if (Modifier.isAbstract(mods) || Modifier.isInterface(mods)) {
        throw new NotCompliantMBeanException("MBean class must be concrete");
    }

    // Check if the MBean has a public constructor
    final Constructor<?>[] consList = c.getConstructors();
    if (consList.length == 0) {
        throw new NotCompliantMBeanException("MBean class must have public constructor");
    }
}
Introspector.java 文件源码 项目:OpenJSharp 阅读 27 收藏 0 点赞 0 评论 0
private static <M> MBeanInfo
        getClassMBeanInfo(MBeanIntrospector<M> introspector,
                          Class<?> baseClass, Class<?> mbeanInterface)
throws NotCompliantMBeanException {
    PerInterface<M> perInterface = introspector.getPerInterface(mbeanInterface);
    return introspector.getClassMBeanInfo(baseClass, perInterface);
}
MBeanHelper.java 文件源码 项目:Byter 阅读 20 收藏 0 点赞 0 评论 0
/**
 * Register a static build mbean to the mbean server.
 * @param objecToRegister object you want to register
 * @param objectName under which object name it should be available
 */
public void registerStaticElement(final Object objecToRegister, final ObjectName objectName){
    try {
        this.mbs.registerMBean(objecToRegister,objectName);
    } catch (InstanceAlreadyExistsException | NotCompliantMBeanException | MBeanRegistrationException e) {
        log.log(Level.WARNING,"Could not register static example mbean on MBeanServer. Check Stacktrace.", e);
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号