public void handleNotification(Notification notification, Object handback) {
if (notification instanceof JMXConnectionNotification) {
JMXConnectionNotification jn = (JMXConnectionNotification) notification;
if (log.isLoggable(Level.FINE)) {
Subject sub = Subject.getSubject(AccessController.getContext());
log.log(Level.FINE, "Got notification from client {0}, subject = {1}", new Object[]{jn.getConnectionId(), sub});
}
long sessionId = getSessionIdFromConnectionId(jn.getConnectionId());
if (sessionId >= 0) {
if (JMXConnectionNotification.CLOSED.equals(jn.getType())) {
log.log(Level.FINE, "client connection {0} closed", jn.getConnectionId());
JGDISession session = JGDISession.closeSession(sessionId);
if (session != null) {
unregisterSessionMBean(session);
}
} else if (JMXConnectionNotification.FAILED.equals(jn.getType())) {
log.log(Level.FINE, "client connection {0} failed", jn.getConnectionId());
JGDISession session = JGDISession.closeSession(sessionId);
if (session != null) {
unregisterSessionMBean(session);
}
} else if (JMXConnectionNotification.NOTIFS_LOST.equals(jn.getType())) {
log.log(Level.WARNING, "client connection {0} losts notification", jn.getConnectionId());
} else if (JMXConnectionNotification.OPENED.equals(jn.getType())) {
if (log.isLoggable(Level.FINE)) {
log.log(Level.FINE, "client connection {0} opened", new Object[]{jn.getConnectionId()});
}
JGDISession session = JGDISession.createNewSession(sessionId, url);
registerSessionMBean(session);
}
} else {
log.log(Level.WARNING, "Got a jmx connection without a session id: {0}", jn.getConnectionId());
}
}
}