use of javax.management.NotCompliantMBeanException in project wikidata-query-rdf by wikimedia.
the class ThrottlingFilter method registerMBean.
/**
* Register this Filter as an MBean.
*
* On successful registration, the {@link ObjectName} used for registration
* will be stored into the instance field {@link ThrottlingFilter#objectName}.
*
* @param filterName
*/
private void registerMBean(String filterName) {
try {
ObjectName objectName = new ObjectName(ThrottlingFilter.class.getName(), "filterName", filterName);
MBeanServer platformMBeanServer = ManagementFactory.getPlatformMBeanServer();
platformMBeanServer.registerMBean(this, objectName);
this.objectName = objectName;
log.info("ThrottlingFilter MBean registered as {}.", objectName);
} catch (MalformedObjectNameException e) {
log.error("filter name {} is invalid as an MBean property.", filterName, e);
} catch (InstanceAlreadyExistsException e) {
log.error("MBean for ThrottlingFilter has already been registered.", e);
} catch (NotCompliantMBeanException | MBeanRegistrationException e) {
log.error("Could not register MBean for ThrottlingFilter.", e);
}
}
use of javax.management.NotCompliantMBeanException in project felix by apache.
the class CompendiumHandler method handleEvent.
private void handleEvent(ServiceReference serviceReference, String iService, int eType) {
try {
if (iService.equals(ConfigurationAdmin.class.getName())) {
switch(eType) {
case ServiceEvent.REGISTERED:
ConfigAdminManagerMBean ca = new ConfigAdminManager(ac);
server.registerMBean(ca, new ObjectName(ObjectNames.CM_SERVICE));
break;
case ServiceEvent.UNREGISTERING:
server.unregisterMBean(new ObjectName(ObjectNames.CM_SERVICE));
break;
default:
break;
}
}
if (iService.equals(LogService.class.getName())) {
switch(eType) {
case ServiceEvent.REGISTERED:
LogManagerMBean lm = new LogManager(ac);
server.registerMBean(lm, new ObjectName(ObjectNames.LOG_SERVICE));
break;
case ServiceEvent.UNREGISTERING:
server.unregisterMBean(new ObjectName(ObjectNames.LOG_SERVICE));
break;
default:
break;
}
}
if (iService.equals(UserAdmin.class.getName())) {
switch(eType) {
case ServiceEvent.REGISTERED:
UserManagerMBean um = new UserManager(ac);
server.registerMBean(um, new ObjectName(ObjectNames.UA_SERVICE));
break;
case ServiceEvent.UNREGISTERING:
server.unregisterMBean(new ObjectName(ObjectNames.UA_SERVICE));
break;
default:
break;
}
}
} catch (InstanceAlreadyExistsException e) {
ac.error("Unexpected error", e);
} catch (MBeanRegistrationException e) {
ac.error("Unexpected error", e);
} catch (NotCompliantMBeanException e) {
ac.error("Unexpected error", e);
} catch (MalformedObjectNameException e) {
ac.error("Unexpected error", e);
} catch (NullPointerException e) {
ac.error("Unexpected error", e);
} catch (InstanceNotFoundException e) {
ac.error("Unexpected error", e);
}
}
use of javax.management.NotCompliantMBeanException in project felix by apache.
the class CompendiumHandler method initController.
public void initController() {
try {
if (ac.getConfigurationAdmin() != null) {
ConfigAdminManagerMBean ca = new ConfigAdminManager(ac);
server.registerMBean(ca, new ObjectName(ObjectNames.CM_SERVICE));
}
if (ac.getLogservice() != null) {
LogManagerMBean lm = new LogManager(ac);
server.registerMBean(lm, new ObjectName(ObjectNames.LOG_SERVICE));
}
if (ac.getUserAdmin() != null) {
UserManagerMBean um = new UserManager(ac);
server.registerMBean(um, new ObjectName(ObjectNames.UA_SERVICE));
}
} catch (InstanceAlreadyExistsException e) {
ac.error("Unexpected error", e);
} catch (MBeanRegistrationException e) {
ac.error("Unexpected error", e);
} catch (NotCompliantMBeanException e) {
ac.error("Unexpected error", e);
} catch (MalformedObjectNameException e) {
ac.error("Unexpected error", e);
} catch (NullPointerException e) {
ac.error("Unexpected error", e);
}
ac.getBundleContext().addServiceListener(sl);
}
use of javax.management.NotCompliantMBeanException in project felix by apache.
the class MBeanRegistrator method registerBundleMBean.
private void registerBundleMBean(Bundle bundle) {
try {
server.registerMBean(new ManagedBundle(bundle, ac), new ObjectName(ObjectNames.BUNDLE + InstrumentationSupport.getSymbolicName(bundle)));
ac.debug("registered mbean for " + bundle.getSymbolicName());
} catch (InstanceAlreadyExistsException iaee) {
ac.error("unexpected error:", iaee);
} catch (MBeanRegistrationException mre) {
ac.error("unexpected error:", mre);
} catch (NotCompliantMBeanException ncme) {
ac.error("unexpected error:", ncme);
} catch (MalformedObjectNameException mone) {
ac.error("unexpected error:", mone);
} catch (NullPointerException npe) {
ac.error("unexpected error:", npe);
}
}
use of javax.management.NotCompliantMBeanException in project felix by apache.
the class AgentActivator method register.
private void register(ServiceReference serviceReference) {
String name = this.getObjectNameString(serviceReference);
Object mbean = bc.getService(serviceReference);
ObjectName objectName = null;
try {
// Unique identification of MBeans
objectName = new ObjectName(name);
} catch (MalformedObjectNameException e) {
e.printStackTrace();
} catch (NullPointerException e) {
e.printStackTrace();
}
try {
// Uniquely identify the MBean and register it with the MBeanServer
server.registerMBean(mbean, objectName);
} catch (InstanceAlreadyExistsException e1) {
e1.printStackTrace();
} catch (MBeanRegistrationException e1) {
e1.printStackTrace();
} catch (NotCompliantMBeanException e1) {
e1.printStackTrace();
}
}
Aggregations