NanoContainer
  1. NanoContainer
  2. NANO-14

JMX - NanoMX registers component with JMX every time it is retrieved

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0-beta-1
    • Component/s: None
    • Labels:
      None
    • Environment:
      MX4J 1.1.1
    • Number of attachments :
      0

      Description

      Every time a JMX-managed component is retrieved from a NanoMXContainer, the NanoMXComponentAdapter tries to register it with JMX. MX4J 1.1.1 expects that this will happen only once.

      Here is my proposed fix: Add a new ivar called "registered" to NanoMXComponentAdapter and return from the method before registering with JMX if the "registered" ivar is true. Look for // added by JAC below:

      public Object getComponentInstance(
      MutablePicoContainer componentRegistry) throws
      PicoInitializationException,
      PicoIntrospectionException,
      AssignabilityRegistrationException,
      NotConcreteRegistrationException
      {
      Object component = super.getComponentInstance(componentRegistry);
      if (registered) return component; // added by JAC
      try

      { ObjectName name = NanoMXContainer.asObjectName(getComponentKey()); Object mbean = NanoMXContainer.asMBean(component); mbeanServer.registerMBean(mbean, name); }

      catch (MalformedObjectNameException e)

      { throw new NanoMXInitializationException(e); } catch (MBeanRegistrationException e) { throw new NanoMXInitializationException(e); }

      catch (NotCompliantMBeanException e)

      { throw new NanoMXInitializationException(e); } catch (InstanceAlreadyExistsException e) { throw new NanoMXInitializationException(e); }

      registered = true; // added by JAC
      return component;
      }

        Activity

        Aslak Hellesøy made changes -
        Field Original Value New Value
        Assignee Aslak Hellesoy [ rinkrank ]
        Status Unassigned [ 1 ] Assigned [ 2 ]
        Hide
        Aslak Hellesøy added a comment -

        Fixed a while ago - slightly different implementation.

        Show
        Aslak Hellesøy added a comment - Fixed a while ago - slightly different implementation.
        Aslak Hellesøy made changes -
        Fix Version/s 1.0-alpha-1 [ 10146 ]
        Status Assigned [ 2 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Aslak Hellesøy
            Reporter:
            Jonathan Carlson
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: