7 Replies Latest reply on Sep 12, 2007 9:51 AM by brian.stansberry

    JBAS-4543 Design

      This issue notes that HAServiceMBeanSupport should use the kernel bean name as a default name if getServiceHAName() can't locate a name using the existing methods.

      It looks like this can easily be accomplished by having the class implement KernelControllerContextAware and then obtaining the name in the setKernelControllerContext callback.

      Is this what is intended by this issue or is there another way to accomplish this (besides injecting the kernel, which requires clients to perform an additional configuration step)?

        • 1. Re: JBAS-4543 Design
          brian.stansberry

          Have a look at http://jira.jboss.com/jira/browse/JBMICROCONT-192 and related forum thread http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4063443.

          The way the MC feature has developed, there should be no need to implement a special interface. Instead you can mark any method for kernel name injection, either via annotation or -beans.xml.

          I think it should be fine to just mark setServiceHAName().

          • 2. Re: JBAS-4543 Design

            OK - I'll use setServiceHAName(). It looks like the Microcontainer version in thirdparty doesn't have this support yet so I'll revisit this later in the week.

            I read some of the discussions on this subject in the Microcontainer Forum; it seems that the bean name will be accessible via annotation (unclear whether the work is done yet). I'll use an annotation in HAServiceMBeanSupport if available since this will make the name available in the base class without clients having to modify XML configurations for their services to include the name-method attribute.

            • 3. Re: JBAS-4543 Design

              Just to document what I found -

              The original discussion of JBMICROCONT-192 suggested that a "name-method" attribute would be used to expose the bean name. It appears that this was either not implemented or was rolled back. The bean name is available using "inject fromContext".

              For example, adding the following to the HASingletonDeployer bean will cause the bean name to be injected into serviceHAName.

              <property name="serviceHAName"><inject fromContext="name"/></property>
              


              It looks like the version of jboss-kernel.jar containing this support hasn't been updated in the repository yet. I built the jar from latest microcontainer source and confirmed that this technique works for HAServiceMBeanSupport.

              Once the jar is available, I'll modify deploy-hasingleton-beans.xml to use this capability. If annotation support subsequently becomes available, I'll revisit the issue as it might be preferable to handle this in the base class rather than in the configuration.

              • 4. Re: JBAS-4543 Design

                Brian,

                Now that the required version of the microcontainer is available, I can complete this issue. One question here - JBAS-4543 suggests that the service's ObjectName should be used first and the bean name should only be used as an alternative. Is this actually the case or should the bean name be preferred?

                For HAServiceMBeanSupport, the canonical name of the service is "jboss.ha:service=HASingletonDeployer" while the bean name is "HASingletonDeployer".

                Note that I can't use setServiceHAName() unless we want to use the bean name since this name would be set on initialization and we wouldn't retrieve the canonical name. Of course it would be trivial to add another getter/setter to the class to accommodate the bean name.

                • 5. Re: JBAS-4543 Design
                  brian.stansberry

                  Let's give preference to the kernel (bean) name. Another tiny step in getting JMX out of the middle of everything. :)

                  What would happen if you annotate setServiceHAName and then set it to something other than the kernel via xml? Will the xml value win out? If yes, you can annotate setServiceHAName. If not we need to create another property and annotate that.

                  • 6. Re: JBAS-4543 Design

                    The XML value will win out. I've annotated setServiceHAName() and it works as expected. I've committed the changes and closed the issue.

                    • 7. Re: JBAS-4543 Design
                      brian.stansberry

                      Great! Thanks :)