Monday, February 4, 2008 08:15 AM
I've got a couple samples that could help you. First of all, have you considered Sun's built-in jconsole? Depending on your requirements, it may be sufficient. jconsole is described here:
For some sample code, see this article about JMX monitoring:
(Just look at the "JMX monitoring" section and the code download at the end). In the J2SE sample, there's a JMX server and there is also an example of a NotificationListener. In the JMXUtils class you can see that whenever an MBean is registered on the server, a listener is also registered. (The alternate approach is to do a scan for all MBeans you want to monitor and register there).