* @param notification the notification
* @param handback the handback object
*/
public void handleNotification(Notification notification, Object handback) {
Event evt = null;
if (notification.getUserData() instanceof Event) {
evt = (Event) notification.getUserData();
} else if (JMXConnectionNotification.CLOSED.equals(notification.getType())) {
synchronized (this) {
if (connector != null) {
try {
connector.removeConnectionNotificationListener(this);
close();
evt = new ConnectionClosedEvent(System.currentTimeMillis() / 1000, 0);
} catch (ListenerNotFoundException ex) {
// Ignore
}
}
}
} else if (JMXConnectionNotification.FAILED.equals(notification.getType())) {
synchronized (this) {
if (connector != null) {
try {
connector.removeConnectionNotificationListener(this);
close();
evt = new ConnectionFailedEvent(System.currentTimeMillis() / 1000, 0);
} catch (ListenerNotFoundException ex) {
// Ignore
}
}
}
}
if (evt != null) {
boolean isCloseEvent = ConnectionClosedEvent.class.isAssignableFrom(evt.getClass());
if (!isCloseEvent || !closeEventSent) {
Set<EventListener> tmpLis = null;
synchronized (this) {
tmpLis = listeners;
}