I would like to impose JMX on an existing (standalone) application. While I was digging through the forums and documentation, several concerns arised, and I am looking forward to receiving some feedback from the more experienced JMX engineers.
Firstly, I wonder whether there is a general approach to instrumenting existing applications. As far as I understood, I could use Model MBeans to "wrap" existing objects, but it wouldn't do any harm to use Standard or Dynamic MBeans and let the objects implement an MBean interface which exposes the methods meant for instrumentation. Does someone have some real life examples when one used what?
Secondly, I didn't get when one would unregister a bean. It's easy to add some lines to the c'tor of an object to register the bean, but how do I manage the end of the MBean lifetime? The trouble is that there is no designated "kill" method or something like that for some of the objects I'm going to instrument. E.g., sometimes an object lifetime ends when its removed from a container, sometimes it ends when the object which holds the container is no longer referenced, and so on. Do I have to go through the code and add something like cleanUp methods instead of simply relying on the GC, or is there any other way (other than using the finalize method)?
Thirdly, the application uses its own authorization concept. Are there ways and means to implement specific authorization procedures for the HTTP adapter, like checking the login against a database?
I grealty appreciate your hints and comments. Thanks in advance.