monitorMBean.addObservedObject(serviceName);
monitorMBean.setObservedAttribute("ConcurrentClients");
// Setup the monitor: a short granularity period
monitorMBean.setGranularityPeriod(50L);
// Setup the monitor: register a listener
monitorMBean.addNotificationListener(new NotificationListener()
{
public void handleNotification(Notification notification, Object handback)
{
System.out.println(notification);
}