try {
mBeanServerConnection.addNotificationListener(DefaultCommitOperationMXBean.OBJECT_NAME, listener, null, null);
} catch (InstanceNotFoundException | IOException e) {
- throw new RuntimeException("Cannot register as JMX listener to netconf", e);
+ throw new IllegalStateException("Cannot register as JMX listener to netconf", e);
}
}
@Override
public void handleNotification(Notification notification, Object handback) {
- if (notification instanceof NetconfJMXNotification == false) {
+ if (!(notification instanceof NetconfJMXNotification))
return;
- }
// Socket should not be closed at this point
// Activator unregisters this as JMX listener before close is called
if (notification instanceof CommitJMXNotification) {
try {
handleAfterCommitNotification((CommitJMXNotification) notification);
- } catch (Throwable e) {
+ } catch (Exception e) {
// log exceptions from notification Handler here since
// notificationBroadcastSupport logs only DEBUG level
- logger.warn("Exception occured during notification handling: ", e);
+ logger.warn("Failed to handle notification {}", notification, e);
throw e;
}
} else {
throw new RuntimeException("Unable to persist configuration snapshot", e);
}
}
-}
\ No newline at end of file
+}