// which is the MBeanInvocationHandlerImpl and so also a NotificationListener.
final NotificationListener invocationHandler = (NotificationListener) Proxy.getInvocationHandler(mbsf);
// Install a notification listener on OPENED, CLOSED, and FAILED,
// passing the map of connection-ids to usernames as hand-back data.
final NotificationFilterSupport invocationHandlerFilter = new NotificationFilterSupport();
invocationHandlerFilter.enableType(JMXConnectionNotification.OPENED);
invocationHandlerFilter.enableType(JMXConnectionNotification.CLOSED);
invocationHandlerFilter.enableType(JMXConnectionNotification.FAILED);
_cs.addNotificationListener(invocationHandler, invocationHandlerFilter, connectionIdUsernameMap);
// Install a second notification listener on CLOSED AND FAILED only to remove the entry from the
// Map. Here we rely on the fact that JMX will call the listeners in the order in which they are
// installed.
final NotificationFilterSupport mapCleanupHandlerFilter = new NotificationFilterSupport();
mapCleanupHandlerFilter.enableType(JMXConnectionNotification.CLOSED);
mapCleanupHandlerFilter.enableType(JMXConnectionNotification.FAILED);
_cs.addNotificationListener(mapCleanupListener, mapCleanupHandlerFilter, null);
_cs.start();
String connectorServer = (sslEnabled ? "SSL " : "") + "JMX RMIConnectorServer";