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=eb6fd2722a4cbdb9860ec4faf57462403ff02fbd;hb=d5759c52d69ba8725d9bbdc18e81848f319861d1;hp=e319d2cb679260718c9eade75234b9996170007c;hpb=31ea7166f7cf572b3d2c51e2749bb94e8f8af821;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 e319d2cb67..eb6fd2722a 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 @@ -23,7 +23,6 @@ import javax.management.NotificationListener; import javax.management.ObjectName; import java.io.Closeable; import java.io.IOException; -import java.util.regex.Pattern; /** * Responsible for listening for notifications from netconf (via JMX) containing latest @@ -39,9 +38,9 @@ public class ConfigPersisterNotificationHandler implements Closeable { public ConfigPersisterNotificationHandler(MBeanServerConnection mBeanServerConnection, - Persister persisterAggregator, Pattern ignoredMissingCapabilityRegex) { + Persister persisterAggregator) { this.mBeanServerConnection = mBeanServerConnection; - listener = new ConfigPersisterNotificationListener(persisterAggregator, ignoredMissingCapabilityRegex); + listener = new ConfigPersisterNotificationListener(persisterAggregator); registerAsJMXListener(mBeanServerConnection, listener); } @@ -49,7 +48,7 @@ public class ConfigPersisterNotificationHandler implements Closeable { private static void registerAsJMXListener(MBeanServerConnection mBeanServerConnection, ConfigPersisterNotificationListener listener) { logger.trace("Called registerAsJMXListener"); try { - mBeanServerConnection.addNotificationListener(DefaultCommitOperationMXBean.objectName, listener, null, null); + mBeanServerConnection.addNotificationListener(DefaultCommitOperationMXBean.OBJECT_NAME, listener, null, null); } catch (InstanceNotFoundException | IOException e) { throw new RuntimeException("Cannot register as JMX listener to netconf", e); } @@ -58,7 +57,7 @@ public class ConfigPersisterNotificationHandler implements Closeable { @Override public synchronized void close() { // unregister from JMX - ObjectName on = DefaultCommitOperationMXBean.objectName; + ObjectName on = DefaultCommitOperationMXBean.OBJECT_NAME; try { if (mBeanServerConnection.isRegistered(on)) { mBeanServerConnection.removeNotificationListener(on, listener); @@ -73,17 +72,16 @@ class ConfigPersisterNotificationListener implements NotificationListener { private static final Logger logger = LoggerFactory.getLogger(ConfigPersisterNotificationListener.class); private final Persister persisterAggregator; - private final Pattern ignoredMissingCapabilityRegex; - ConfigPersisterNotificationListener(Persister persisterAggregator, Pattern ignoredMissingCapabilityRegex) { + ConfigPersisterNotificationListener(Persister persisterAggregator) { this.persisterAggregator = persisterAggregator; - this.ignoredMissingCapabilityRegex = ignoredMissingCapabilityRegex; } @Override public void handleNotification(Notification notification, Object handback) { - if (notification instanceof NetconfJMXNotification == false) + if (notification instanceof NetconfJMXNotification == false) { return; + } // Socket should not be closed at this point // Activator unregisters this as JMX listener before close is called @@ -98,14 +96,15 @@ class ConfigPersisterNotificationListener implements NotificationListener { logger.warn("Exception occured during notification handling: ", e); throw e; } - } else + } else { throw new IllegalStateException("Unknown config registry notification type " + notification); + } } private void handleAfterCommitNotification(final CommitJMXNotification notification) { try { persisterAggregator.persistConfig(new CapabilityStrippingConfigSnapshotHolder(notification.getConfigSnapshot(), - notification.getCapabilities(), ignoredMissingCapabilityRegex)); + notification.getCapabilities())); logger.trace("Configuration persisted successfully"); } catch (IOException e) { throw new RuntimeException("Unable to persist configuration snapshot", e);