X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FDatastoreContextConfigAdminOverlay.java;h=abf07ecb40ea94e01ff965eaaa370bc256f24793;hp=fcd72fa74f039059749896862edfad61bc7485a8;hb=28e9832cc97a345d5ceb69262784e5c8fef77e37;hpb=dea3effede98cfb561c44d66b24c2d71a44b10a3 diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DatastoreContextConfigAdminOverlay.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DatastoreContextConfigAdminOverlay.java index fcd72fa74f..abf07ecb40 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DatastoreContextConfigAdminOverlay.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DatastoreContextConfigAdminOverlay.java @@ -46,7 +46,7 @@ public class DatastoreContextConfigAdminOverlay implements AutoCloseable { ServiceReference configAdminServiceReference = bundleContext.getServiceReference(ConfigurationAdmin.class); - if(configAdminServiceReference == null) { + if (configAdminServiceReference == null) { LOG.warn("No ConfigurationAdmin service found"); } else { overlaySettings(configAdminServiceReference); @@ -60,18 +60,19 @@ public class DatastoreContextConfigAdminOverlay implements AutoCloseable { this.listener = listener; } + @SuppressWarnings("checkstyle:IllegalCatch") private void overlaySettings(ServiceReference configAdminServiceReference) { try { ConfigurationAdmin configAdmin = bundleContext.getService(configAdminServiceReference); Configuration config = configAdmin.getConfiguration(CONFIG_ID); - if(config != null) { + if (config != null) { Dictionary properties = config.getProperties(); LOG.debug("Overlaying settings: {}", properties); - if(introspector.update(properties)) { - if(listener != null) { + if (introspector.update(properties)) { + if (listener != null) { listener.onDatastoreContextUpdated(introspector.newContextFactory()); } } @@ -80,7 +81,7 @@ public class DatastoreContextConfigAdminOverlay implements AutoCloseable { } } catch (IOException e) { LOG.error("Error obtaining Configuration for pid {}", CONFIG_ID, e); - } catch(IllegalStateException e) { + } catch (IllegalStateException e) { // Ignore - indicates the bundleContext has been closed. } finally { try { @@ -95,7 +96,7 @@ public class DatastoreContextConfigAdminOverlay implements AutoCloseable { public void close() { listener = null; - if(configListenerServiceRef != null) { + if (configListenerServiceRef != null) { configListenerServiceRef.unregister(); } } @@ -103,7 +104,7 @@ public class DatastoreContextConfigAdminOverlay implements AutoCloseable { private class DatastoreConfigurationListener implements ConfigurationListener { @Override public void configurationEvent(ConfigurationEvent event) { - if(CONFIG_ID.equals(event.getPid()) && event.getType() == ConfigurationEvent.CM_UPDATED) { + if (CONFIG_ID.equals(event.getPid()) && event.getType() == ConfigurationEvent.CM_UPDATED) { LOG.debug("configurationEvent: config {} was updated", CONFIG_ID); overlaySettings(event.getReference()); }