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();
}
}
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;
}
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);
}
}
Aggregations