Skip to content

Commit

Permalink
Unregistering previously registered MBeans if a register() for the sa…
Browse files Browse the repository at this point in the history
…me name is encountered (https://issues.jboss.org/browse/JGRP-1392)
  • Loading branch information
belaban committed Nov 25, 2011
1 parent 65e7a85 commit e97c535
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/org/jgroups/jmx/JmxConfigurator.java
Expand Up @@ -162,6 +162,17 @@ private static void internalRegister(Object obj, MBeanServer server, String name

try {
ObjectName objName = getObjectName(obj, name);
if(server.isRegistered(objName)) {
if(log.isWarnEnabled())
log.warn("unregistering already registered MBean: " + objName);
try {
server.unregisterMBean(objName);
}
catch(InstanceNotFoundException e) {
log.error("failed to unregister MBean " + e.getMessage());
}
}

ResourceDMBean res = new ResourceDMBean(obj);
server.registerMBean(res, objName);
} catch (InstanceAlreadyExistsException e) {
Expand Down

0 comments on commit e97c535

Please sign in to comment.