Search in sources :

Example 81 with NotCompliantMBeanException

use of javax.management.NotCompliantMBeanException in project wikidata-query-rdf by wikimedia.

the class MonitoredFilter method init.

/**
 * Register a Filter as an MBean.
 *
 * On successful registration, the {@link ObjectName} used for registration
 * is stored into an instance field so that the MBean can be released on
 * {@link Filter#destroy()}.
 */
@Override
public void init(FilterConfig filterConfig) throws ServletException {
    String filterName = filterConfig.getFilterName();
    ObjectName name = null;
    try {
        name = new ObjectName(this.getClass().getName(), "filterName", filterName);
        MBeanServer platformMBeanServer = ManagementFactory.getPlatformMBeanServer();
        platformMBeanServer.registerMBean(this, name);
        log.info("ThrottlingFilter MBean registered as {}.", name);
    } catch (MalformedObjectNameException e) {
        log.error("filter name {} is invalid as an MBean property.", filterName, e);
    } catch (InstanceAlreadyExistsException e) {
        log.error("MBean for {}} has already been registered.", filterName, e);
    } catch (NotCompliantMBeanException | MBeanRegistrationException e) {
        log.error("Could not register MBean for Filter {}.", filterName, e);
    }
    objectName = name;
}
Also used : MalformedObjectNameException(javax.management.MalformedObjectNameException) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) InstanceAlreadyExistsException(javax.management.InstanceAlreadyExistsException) MBeanRegistrationException(javax.management.MBeanRegistrationException) ObjectName(javax.management.ObjectName) MBeanServer(javax.management.MBeanServer)

Example 82 with NotCompliantMBeanException

use of javax.management.NotCompliantMBeanException in project quasar by puniverse.

the class ActorLoader method registerMBean.

private void registerMBean(String mbeanName) throws InstanceAlreadyExistsException {
    try {
        final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
        final ObjectName mxbeanName = new ObjectName(mbeanName);
        mbs.registerMBean(this, mxbeanName);
    } catch (MBeanRegistrationException ex) {
        LOG.error("exception while registering MBean " + mbeanName, ex);
    } catch (NotCompliantMBeanException ex) {
        throw new AssertionError(ex);
    } catch (MalformedObjectNameException ex) {
        throw new AssertionError(ex);
    }
}
Also used : MalformedObjectNameException(javax.management.MalformedObjectNameException) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) MBeanRegistrationException(javax.management.MBeanRegistrationException) MBeanServer(javax.management.MBeanServer) ObjectName(javax.management.ObjectName)

Example 83 with NotCompliantMBeanException

use of javax.management.NotCompliantMBeanException in project quasar by puniverse.

the class JMXActorsMonitor method registerMBean.

@SuppressWarnings({ "CallToPrintStackTrace", "CallToThreadDumpStack" })
private void registerMBean() {
    try {
        final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
        final ObjectName mxbeanName = new ObjectName(mbeanName);
        mbs.registerMBean(this, mxbeanName);
        this.registered = true;
    } catch (InstanceAlreadyExistsException ex) {
        throw new RuntimeException(ex);
    } catch (MBeanRegistrationException ex) {
        ex.printStackTrace();
    } catch (NotCompliantMBeanException ex) {
        throw new AssertionError(ex);
    } catch (MalformedObjectNameException ex) {
        throw new AssertionError(ex);
    }
    MonitoringServices.getInstance().addPerfNotificationListener(this, mbeanName);
}
Also used : MalformedObjectNameException(javax.management.MalformedObjectNameException) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) InstanceAlreadyExistsException(javax.management.InstanceAlreadyExistsException) MBeanRegistrationException(javax.management.MBeanRegistrationException) MBeanServer(javax.management.MBeanServer) ObjectName(javax.management.ObjectName)

Example 84 with NotCompliantMBeanException

use of javax.management.NotCompliantMBeanException in project quasar by puniverse.

the class JMXActorMonitor method registerMBean.

private void registerMBean() {
    try {
        MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
        ObjectName mxbeanName = new ObjectName(name);
        if (mbs.isRegistered(mxbeanName)) {
            try {
                LOG.info("MBean named {} is already registered. Unregistering it.", name);
                mbs.unregisterMBean(mxbeanName);
            } catch (InstanceNotFoundException e) {
            }
        }
        mbs.registerMBean(this, mxbeanName);
        MonitoringServices.getInstance().addPerfNotificationListener(this, name);
        this.registered = true;
    } catch (InstanceAlreadyExistsException ex) {
        throw new RuntimeException(ex);
    } catch (MBeanRegistrationException ex) {
        ex.printStackTrace();
    } catch (NotCompliantMBeanException | MalformedObjectNameException ex) {
        throw new AssertionError(ex);
    }
}
Also used : MalformedObjectNameException(javax.management.MalformedObjectNameException) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) InstanceNotFoundException(javax.management.InstanceNotFoundException) InstanceAlreadyExistsException(javax.management.InstanceAlreadyExistsException) MBeanRegistrationException(javax.management.MBeanRegistrationException) MBeanServer(javax.management.MBeanServer) ObjectName(javax.management.ObjectName)

Example 85 with NotCompliantMBeanException

use of javax.management.NotCompliantMBeanException in project quasar by puniverse.

the class MonitoringServices method registerMBean.

private void registerMBean() {
    try {
        MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
        ObjectName mxbeanName = new ObjectName("co.paralleluniverse:name=MonitoringServices");
        mbs.registerMBean(this, mxbeanName);
    } catch (InstanceAlreadyExistsException ex) {
        throw new RuntimeException(ex);
    } catch (MBeanRegistrationException ex) {
        ex.printStackTrace();
    } catch (NotCompliantMBeanException ex) {
        throw new AssertionError(ex);
    } catch (MalformedObjectNameException ex) {
        throw new AssertionError(ex);
    }
}
Also used : MalformedObjectNameException(javax.management.MalformedObjectNameException) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) InstanceAlreadyExistsException(javax.management.InstanceAlreadyExistsException) MBeanRegistrationException(javax.management.MBeanRegistrationException) MBeanServer(javax.management.MBeanServer) ObjectName(javax.management.ObjectName)

Aggregations

NotCompliantMBeanException (javax.management.NotCompliantMBeanException)106 ObjectName (javax.management.ObjectName)73 InstanceAlreadyExistsException (javax.management.InstanceAlreadyExistsException)71 MBeanRegistrationException (javax.management.MBeanRegistrationException)71 MalformedObjectNameException (javax.management.MalformedObjectNameException)59 MBeanServer (javax.management.MBeanServer)39 InstanceNotFoundException (javax.management.InstanceNotFoundException)23 StandardMBean (javax.management.StandardMBean)20 MBeanException (javax.management.MBeanException)8 ReflectionException (javax.management.ReflectionException)8 IOException (java.io.IOException)7 ObjectInstance (javax.management.ObjectInstance)5 AttributeNotFoundException (javax.management.AttributeNotFoundException)4 InvalidAttributeValueException (javax.management.InvalidAttributeValueException)4 ListenerNotFoundException (javax.management.ListenerNotFoundException)4 Logger (org.apache.aries.jmx.Logger)4 MalformedURLException (java.net.MalformedURLException)3 DynamicMBean (javax.management.DynamicMBean)3 IntrospectionException (javax.management.IntrospectionException)3 JMRuntimeException (javax.management.JMRuntimeException)3