Search in sources :

Example 1 with MBeanRegistration

use of javax.management.MBeanRegistration in project jdk8u_jdk by JetBrains.

the class DefaultMBeanServerInterceptor method exclusiveUnregisterMBean.

private void exclusiveUnregisterMBean(ObjectName name) throws InstanceNotFoundException, MBeanRegistrationException {
    DynamicMBean instance = getMBean(name);
    // may throw InstanceNotFoundException
    checkMBeanPermission(instance, null, name, "unregisterMBean");
    if (instance instanceof MBeanRegistration)
        preDeregisterInvoke((MBeanRegistration) instance);
    final Object resource = getResource(instance);
    // Unregisters the MBean from the repository.
    // Returns the resource context that was used.
    // The returned context does nothing for regular MBeans.
    // For ClassLoader MBeans and JMXNamespace (and JMXDomain)
    // MBeans - the context makes it possible to unregister these
    // objects from the appropriate framework artifacts, such as
    // the CLR or the dispatcher, from within the repository lock.
    // In case of success, we also need to call context.done() at the
    // end of this method.
    //
    final ResourceContext context = unregisterFromRepository(resource, instance, name);
    try {
        if (instance instanceof MBeanRegistration)
            postDeregisterInvoke(name, (MBeanRegistration) instance);
    } finally {
        context.done();
    }
}
Also used : DynamicMBean(javax.management.DynamicMBean) NamedObject(com.sun.jmx.mbeanserver.NamedObject) MBeanRegistration(javax.management.MBeanRegistration)

Example 2 with MBeanRegistration

use of javax.management.MBeanRegistration in project aries by apache.

the class RegistrableStandardEmitterMBean method preRegister.

/**
     * @see javax.management.MBeanRegistration#preRegister(javax.management.MBeanServer, javax.management.ObjectName)
     */
public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception {
    ObjectName result = name;
    Object impl = getImplementation();
    if (impl instanceof MBeanRegistration) {
        result = ((MBeanRegistration) impl).preRegister(server, name);
    }
    return result;
}
Also used : ObjectName(javax.management.ObjectName) MBeanRegistration(javax.management.MBeanRegistration)

Example 3 with MBeanRegistration

use of javax.management.MBeanRegistration in project aries by apache.

the class JmxWhiteboardSupport method registerMBean.

protected synchronized void registerMBean(Object mbean, final ServiceReference props) {
    log.debug("registerMBean: Adding MBean {}", mbean);
    ObjectName objectName = getObjectName(props);
    if (objectName != null || mbean instanceof MBeanRegistration) {
        MBeanHolder holder = MBeanHolder.create(mbean, objectName);
        if (holder != null) {
            MBeanServer[] mbeanServers = this.mbeanServers;
            for (MBeanServer mbeanServer : mbeanServers) {
                holder.register(mbeanServer);
            }
            mbeans.put(mbean, holder);
        } else {
            log.error("registerMBean: Cannot register MBean service {} with MBean servers: Not an instanceof DynamicMBean or not MBean spec compliant standard MBean", mbean);
        }
    } else {
        log.error("registerMBean: MBean service {} not registered with valid jmx.objectname propety and not implementing MBeanRegistration interface; not registering with MBean servers", mbean);
    }
}
Also used : ObjectName(javax.management.ObjectName) MBeanRegistration(javax.management.MBeanRegistration) MBeanServer(javax.management.MBeanServer)

Aggregations

MBeanRegistration (javax.management.MBeanRegistration)3 ObjectName (javax.management.ObjectName)2 NamedObject (com.sun.jmx.mbeanserver.NamedObject)1 DynamicMBean (javax.management.DynamicMBean)1 MBeanServer (javax.management.MBeanServer)1