/**
* Registers an mBean at an MBeanServer. If there is already an mbean registered
* under the specified name, it is first de-registered.
*
* @param name the objectName
* @param mbean the modelMbean to register
* @throws ConfigurationException
*/
private static void registerMBean(ObjectName name, RequiredModelMBean mbean) throws ConfigurationException {
MBeanServer server = getMBeanServer();
if (server != null) {
LOG.debug("got an MBean server");
try {
if (server.isRegistered(name)) {
LOG.debug("unregistering [" + name.getCanonicalName() + "] as it already exists");
server.unregisterMBean(name);
}
server.registerMBean(mbean, name);
} catch (InstanceAlreadyExistsException iae) {
LOG.warn("Could not register mbean " + iae.getMessage());
} catch (Exception e) {
throw new ConfigurationException(e);
}
LOG.debug("MBean [" + name.getCanonicalName() + "] registered");
} else {
LOG.warn("No MBean server found");
}
}
JmxMbeanHelper.java 文件源码
java
阅读 18
收藏 0
点赞 0
评论 0
项目:iaf
作者:
评论列表
文章目录