I am trying to monitor number of user sessions through the JMX . I am using jconsole as UI. I have created a variable named 'numberOfUser" in my Monitor class(which is MBean implementation class) and I am updating this variable with each subsequent user login. I have printed the updated value on console and it worked fine. However I am not getting how should I monitor this changing value through jconsole. My requirement is I should be able to see the updated values of "numberOfUser" on jconsole with each user login. f Can anyone please let me know how can I achieve the same
*** clarification, I am not a JConsole user, so don't know if this will work for JConsole ***
The standard way for any JMX listener (like JConsole) to get attributes, in a asynchronous manner -- is through the use of JMX notifications. Just have your MBean send an attribute change notification to it's listeners.