An application is using JBoss 4.2.2, and I have found it necessary to call listThreadDump(), and I expect it is in ServerInfo.
I am thinking the jar I need to find this information is jboss-jmx.jar.
So, how do I programmatically duplicate what is done by calling something similar to http://localhost:8080/jmx-console/HtmlAdaptor?action=invokeOpByName&name=jboss.system:type=ServerInfo&methodName=listThreadDump?
This is how I have accessed the ServerInfo MBean. I’m using JBoss AS 5.1, but this method should be the same.
To call
listThreadDump(), you caninvoke()the method on theServerInfoMBean using anMBeanServerinstance.Additionally, you can access attributes of MBeans using the same MBeanServer.
Sample code:
Finally, I find it handy when MBeans expose an ‘instance’ attribute, so you can then access the object directly
(CastToType) server.getAttribute(name, "instance")instead of always going through the MBeanServer. For example, when using JMS, the ServerPeer instance is nice to have as you can get message counters on your queues and topic subscribers.