img
After the installation of the VisualVM-MBeans plug-in, you will able to see the MBeans tab. Clicking
the tab will show the available MBeans. You should see the node called "bean." When you expand it, it
will show the ProSpring3ContactApp MBean that was exposed, as shown in Figure 23-7.
Figure 23-7. The ProSpring3ContactApp MBean
On the right side, you will see the method that we implemented in the bean, with the attribute
TotalContactCount (which was automatically derived by the getTotalContactCount() method within the
bean). Feel free to add a new contact in the sample application and refresh the view. The count will be
revised accordingly.
Monitoring Logged-In Users
JMX is very useful for monitoring an application's status and metrics. One common use case is to expose
the number of logged-in users for a web application. In this section, we will show you how to expose the
number of logged-in users in the sample application to JMX.
As discussed in Chapter 17, we used Spring Security for application security management. Spring
Security supports the configuration of a session registry, which can be injected into our Spring bean, and
we retrieve the number of logged-in users. To do this, we need to enable concurrent session control in
Spring Security. So, in the web deployment descriptor (the web.xml file), add a Spring Security listener.
Listing 23-4 shows the listener declaration.
Search WWH :
Custom Search
Previous Page
Spring Framework 3 Topic Index
Next Page
Spring Framework 3 Bookmarks
Home