11

For a simple Java library which performs operations in constant intervals I have implemented JMX management using MXBeans and it works as expected, I can query the status and set parameters, supend / resume the operations etc in JConsole.

Now I would like to create a web application - to display and control the library operation.

I don't know wether it is a good idea to use the samy JMX API also in the web application, so I need a way to access the MXBeans which are registered in the same VM using the platform MBean Server:

MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();

I noticed that the MBeanServer has a queryMBeans method. Should I use this method to access the registered JMX API MXBeans? There is a different path, using JMXConnectorFactory, which requires protocol, host, and port information so that the client can access a remote JMX server.

1 Answer 1

17

If you only want to access the MBeanServer in the same JVM, then ManagementFactory.getPlatformMBeanServer(); is the way to do it.

JMXConnectorFactory is for accessing remote MBeanServers (i.e. in a different JVM, and/or on a different host).

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.