Posted By:
Anonymous
Posted On:
Monday, February 4, 2008 08:15 AM
Hello Vanitha,
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:
http://www-128.ibm.com/developerworks/java/library/j-jtp09196/index.html
For some sample code, see this article about JMX monitoring:
http://www.ibm.com/developerworks/tivoli/library/t-inttivmon/index.html
(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).