X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fconfig%2Fconfig-persister-feature-adapter%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfigpusherfeature%2Finternal%2FFeatureConfigPusher.java;h=7b90580a660cac0a03a4b90c0c0f8d40a1d2eb68;hp=17099f9d3355d948c877538bc76b0f1f8f21285e;hb=2944d1c934e26e23726d1649ee4b61b9e4fe9265;hpb=6e3f5765d348492f7977228969cd7987e44697cb diff --git a/opendaylight/config/config-persister-feature-adapter/src/main/java/org/opendaylight/controller/configpusherfeature/internal/FeatureConfigPusher.java b/opendaylight/config/config-persister-feature-adapter/src/main/java/org/opendaylight/controller/configpusherfeature/internal/FeatureConfigPusher.java index 17099f9d33..7b90580a66 100644 --- a/opendaylight/config/config-persister-feature-adapter/src/main/java/org/opendaylight/controller/configpusherfeature/internal/FeatureConfigPusher.java +++ b/opendaylight/config/config-persister-feature-adapter/src/main/java/org/opendaylight/controller/configpusherfeature/internal/FeatureConfigPusher.java @@ -7,11 +7,11 @@ */ package org.opendaylight.controller.configpusherfeature.internal; +import com.google.common.collect.LinkedHashMultimap; import java.util.ArrayList; import java.util.Arrays; import java.util.LinkedHashSet; import java.util.List; - import org.apache.karaf.features.Feature; import org.apache.karaf.features.FeaturesService; import org.opendaylight.controller.config.persist.api.ConfigPusher; @@ -19,13 +19,11 @@ import org.opendaylight.controller.config.persist.api.ConfigSnapshotHolder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.google.common.collect.LinkedHashMultimap; - /* * Simple class to push configs to the config subsystem from Feature's configfiles */ public class FeatureConfigPusher { - private static final Logger logger = LoggerFactory.getLogger(FeatureConfigPusher.class); + private static final Logger LOG = LoggerFactory.getLogger(FeatureConfigPusher.class); private static final int MAX_RETRIES=100; private static final int RETRY_PAUSE_MILLIS=1; private FeaturesService featuresService = null; @@ -46,7 +44,7 @@ public class FeatureConfigPusher { /* * @param p - ConfigPusher to push ConfigSnapshotHolders */ - public FeatureConfigPusher(ConfigPusher p, FeaturesService f) { + public FeatureConfigPusher(final ConfigPusher p, final FeaturesService f) { pusher = p; featuresService = f; } @@ -59,7 +57,7 @@ public class FeatureConfigPusher { * If a Feature is not in the returned LinkedHashMultimap then we couldn't push its configs * (Ususally because it was not yet installed) */ - public LinkedHashMultimap pushConfigs(List features) throws Exception, InterruptedException { + public LinkedHashMultimap pushConfigs(final List features) throws Exception, InterruptedException { LinkedHashMultimap pushedFeatures = LinkedHashMultimap.create(); for(Feature feature: features) { LinkedHashSet configSnapShots = pushConfig(feature); @@ -70,7 +68,7 @@ public class FeatureConfigPusher { return pushedFeatures; } - private LinkedHashSet pushConfig(Feature feature) throws Exception, InterruptedException { + private LinkedHashSet pushConfig(final Feature feature) throws Exception, InterruptedException { LinkedHashSet configs = new LinkedHashSet(); if(isInstalled(feature)) { ChildAwareFeatureWrapper wrappedFeature = new ChildAwareFeatureWrapper(feature,featuresService); @@ -83,20 +81,20 @@ public class FeatureConfigPusher { return configs; } - private boolean isInstalled(Feature feature) { + private boolean isInstalled(final Feature feature) { for(int retries=0;retries installedFeatures = Arrays.asList(featuresService.listInstalledFeatures()); if(installedFeatures.contains(feature)) { return true; } else { - logger.warn("Karaf featuresService.listInstalledFeatures() has not yet finished installing feature (retry {}) {} {}",retries,feature.getName(),feature.getVersion()); + LOG.warn("Karaf featuresService.listInstalledFeatures() has not yet finished installing feature (retry {}) {} {}",retries,feature.getName(),feature.getVersion()); } } catch (Exception e) { if(retries < MAX_RETRIES) { - logger.warn("Karaf featuresService.listInstalledFeatures() has thrown an exception, retry {}, Exception {}", retries,e); + LOG.warn("Karaf featuresService.listInstalledFeatures() has thrown an exception, retry {}", retries, e); } else { - logger.error("Giving up on Karaf featuresService.listInstalledFeatures() which has thrown an exception, retry {}, Exception {}", retries,e); + LOG.error("Giving up on Karaf featuresService.listInstalledFeatures() which has thrown an exception, retry {}", retries, e); throw e; } } @@ -106,11 +104,11 @@ public class FeatureConfigPusher { throw new IllegalStateException(e1); } } - logger.error("Giving up (after {} retries) on Karaf featuresService.listInstalledFeatures() which has not yet finished installing feature {} {}",MAX_RETRIES,feature.getName(),feature.getVersion()); + LOG.error("Giving up (after {} retries) on Karaf featuresService.listInstalledFeatures() which has not yet finished installing feature {} {}",MAX_RETRIES,feature.getName(),feature.getVersion()); return false; } - private LinkedHashSet pushConfig(LinkedHashSet configs) throws InterruptedException { + private LinkedHashSet pushConfig(final LinkedHashSet configs) throws InterruptedException { LinkedHashSet configsToPush = new LinkedHashSet(configs); configsToPush.removeAll(pushedConfigs); if(!configsToPush.isEmpty()) {