Uploaded image for project: 'JGroups'
  1. JGroups
  2. JGRP-1392

JmxConfigurator should unregister the MBeans first if it is already registered

    XMLWordPrintable

Details

    • Feature Request
    • Resolution: Done
    • Minor
    • 3.0.1, 3.1
    • 2.12.1
    • None
    • 0
    • 0% 0%

    Description

      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.

      Current behavior

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

      Desired behavior

      It would be nice if the JmxConfigurator.internalRegister(Object,MBeanServer,String) method unregister the MBean it it previously exists, e.g.

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

      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.

      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.

      Attachments

        Activity

          People

            rhn-engineering-bban Bela Ban
            jkronegg_jira Julien Kronegg (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: