[jboss-jira] [JBoss JIRA] (JGRP-1392) JmxConfigurator should unregister the MBeans first if it is already registered

Julien Kronegg (Created) (JIRA) jira-events at lists.jboss.org
Tue Nov 22 10:27:40 EST 2011


JmxConfigurator should unregister the MBeans first if it is already registered
------------------------------------------------------------------------------

                 Key: JGRP-1392
                 URL: https://issues.jboss.org/browse/JGRP-1392
             Project: JGroups
          Issue Type: Feature Request
    Affects Versions: 2.12.1
            Reporter: Julien Kronegg
            Assignee: Bela Ban
            Priority: Minor


When using EhCache+JGroups+JGroupsReplication as a distributed cache solution, JGroupsReplication registers MBeans for the channels by using the {{org.jgroups.jmx.JmxConfigurator}}. If for some reason (e.g. application redeployment) MBean registration is not done, the next JMX registration will not be able to register the MBeans that are already been registered.

h3. Current behavior
The {{JmxConfigurator.internalRegister(Object,MBeanServer,String)}} throws an exception if the MBean instance is already registered.

h3. Desired behavior
It would be nice if the {{JmxConfigurator.internalRegister(Object,MBeanServer,String)}} method unregister the MBean it it previously exists, e.g. 
{code}
if (server.isRegistered(objName)) {
  log.warn("unregistering already registered MBean: "+objName);
  try {
    server.unregisterMBean(objName);
  } catch (InstanceNotFoundException e) {
    log.error("failed to unregister MBean "+ e.getMessage());
  }
}
{code}
In order not to break the current behavior, adding a boolean flag {{rebind}} could be useful/considered.

This behavior is IMHO justified because the previously registered MBean was almost certainly registered by JGroups for the same usage, so that it is safe to unregister it. 

h3. Workaround
The workaround is to have a custom copy of {{org.jgroups.jmx.JmxConfigurator}} with the code fragment above, and also a custom copy JGroupsReplication library to call the custom copy of {{org.jgroups.jmx.JmxConfigurator}}.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list