X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fconfig-persister-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fpersist%2Fimpl%2FConfigPersisterNotificationHandler.java;h=40a15be70616217d81529b003f899236865d8ac8;hb=e159106bc148e76fc1e3e3c780bdd740d99e74ed;hp=eb6fd2722a4cbdb9860ec4faf57462403ff02fbd;hpb=12204729ecaa1d1862a580cc6282eceacd21efe2;p=controller.git diff --git a/opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/ConfigPersisterNotificationHandler.java b/opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/ConfigPersisterNotificationHandler.java index eb6fd2722a..40a15be706 100644 --- a/opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/ConfigPersisterNotificationHandler.java +++ b/opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/ConfigPersisterNotificationHandler.java @@ -50,7 +50,7 @@ public class ConfigPersisterNotificationHandler implements Closeable { 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); } } @@ -79,9 +79,8 @@ class ConfigPersisterNotificationListener implements NotificationListener { @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 @@ -90,10 +89,10 @@ class ConfigPersisterNotificationListener implements NotificationListener { 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 { @@ -110,4 +109,4 @@ class ConfigPersisterNotificationListener implements NotificationListener { throw new RuntimeException("Unable to persist configuration snapshot", e); } } -} \ No newline at end of file +}