I have a requirement to get the notofication, when "HeapMemoryUsage" increase more than size "X" or decrease than size "Y".
In below program I have used mbean [java.lang:type=Memory] and added the notification listener on that
mbsc.addNotificationListener(mbeanName, listener, null, null);
I was under impression that, handleNotification(Notification notification, Object handback) will be invoked and the message will ne printed.
Please help me in this regard. or provide a sample program for
tomcat server
Below code I am using :