I am looking for a solution to register MBeans or all MBean servers directly from different Java virtual machines on a central MBean server, which should also run in a separate virtual machine. The goal is to have only one central MBean server that contains all the MBeans of the entire system. Another requirement is the difficulty :-) that the "client" MBean servers must connect / register to the central MBean server, and not vice versa. The central MBean server does not need to know the "client" MBean servers for registration.
I just found JMX examples in which the "main" MBean server connects to the "client" MBean servers and transfers their registered MBeans, but not vice versa. Unfortunately, the registerMBean () method, which is used to register your own MBeans, exists only for local MBean servers, but not for remote MBean servers in MBeanServerConnection. You can use the createMbean () method there, the problem here is that it worked to register the MBean on the remote MBean server, but then you have different objects, one local and the other on the remote MBean server. So, now the problem is that when something changes on the local object, there are only changes, the registered MBean on the remote MBean server does not receive these changes (new variable values โโ...). The only solution I have so far is to create a loop to unregister the MBeans on the remote server and create new ones to get the actual values โโof the object. It is very ugly and also not very good for execution.
I hope someone can give me a hint how I can do it better.
source share