cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aki Yoshida <sapa...@googlemail.com>
Subject Odd behavior in CXF's JMX InstrumentationManagerImpl
Date Thu, 24 Feb 2011 17:38:51 GMT
Hi,
I am experimenting with the JMX instrumentaiton included in CXF in the
standalone environment.

It works fine with a single CXF bus file and I can see this bus
showing up in the jconsole monitor.
But when I use two bus files and setting parameter
createMBServerConnectorFactory on one of the files to false, I
expected to see two bus instances showing up in the monitor.
However, I saw only the first one. So I looked into what is happening
in org.apache.cxf.management.jmx.InstrumentationManagerImpl and
probably found some issue.

To explain, I need to quote the following code fragment (from 2.3.2,
2.3.x), which is in the init method of this class.

            if (mbs == null) {
                // return platform mbean server if the option is specified.
                if (usePlatformMBeanServer) {
                    mbs = ManagementFactory.getPlatformMBeanServer();
                } else {
                    List<MBeanServer> servers = CastUtils

.cast(MBeanServerFactory.findMBeanServer(mbeanServerName));
                    if (servers.size() <= 1) {
                        mbs =
MBeanServerFactory.createMBeanServer(mbeanServerName);
                    } else {
                        mbs = (MBeanServer)servers.get(0);
                    }
                }
            }

The intention of the code seems to retrieve the available server if it
has been already created. However, MBeanserverFactory's
createMBeanServer takes the domain name as the parameter (in this
case, "org.apache.cxf"), whereas its findMBeanServer method takes the
parameter agendId. And this value is not the domain name. So the above
code does not find the instantiated server at the second time.

As JMX's MBeanServerFactory stores the instantiated servers in its
static map, I think CXF's InstrumentationManagementImpl should also
use a static map to map each domain name to the agentID of the
instantiated server so that the right parameter can be used for the
find method.

Along this line, I modified the code and now I can see the both bus
instsances showing up in the monitor.

But I am not sure if I understood the logic correctly or I am missing
something. I would appreciate if someone could comment on this
situation.

Thanks.

Regards, Aki

Mime
View raw message