Removed sonar warnings.
[controller.git] / opendaylight / config / config-persister-feature-adapter / src / main / java / org / opendaylight / controller / configpusherfeature / internal / ConfigPushingRunnable.java
index 1a40bb34d7b6fe1a8c296654dd1d6a448ae30421..cfdad560945f29cac2549274d09be37d9c704854 100644 (file)
@@ -7,11 +7,11 @@
  */
 package org.opendaylight.controller.configpusherfeature.internal;
 
+import com.google.common.collect.LinkedHashMultimap;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.TimeUnit;
-
 import org.apache.karaf.features.Feature;
 import org.apache.karaf.features.FeatureEvent;
 import org.apache.karaf.features.FeatureEvent.EventType;
@@ -20,10 +20,8 @@ import org.opendaylight.controller.config.persist.api.ConfigPusher;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.collect.LinkedHashMultimap;
-
 public class ConfigPushingRunnable implements Runnable {
-    private static final Logger LOGGER = LoggerFactory.getLogger(ConfigPushingRunnable.class);
+    private static final Logger LOG = LoggerFactory.getLogger(ConfigPushingRunnable.class);
     private static final int POLL_TIME = 1;
     private BlockingQueue<FeatureEvent> queue;
     private FeatureConfigPusher configPusher;
@@ -34,8 +32,8 @@ public class ConfigPushingRunnable implements Runnable {
 
     @Override
     public void run() {
-        List<Feature> toInstall = new ArrayList<Feature>();
-        FeatureEvent event;
+        List<Feature> toInstall = new ArrayList<>();
+        FeatureEvent event = null;
         boolean interuppted = false;
         while(true) {
             try {
@@ -49,19 +47,19 @@ public class ConfigPushingRunnable implements Runnable {
                         processFeatureEvent(event,toInstall);
                     }
                 } else if(toInstall.isEmpty()) {
-                    LOGGER.error("ConfigPushingRunnable - exiting");
+                    LOG.error("ConfigPushingRunnable - exiting");
                     return;
                 }
             } catch (InterruptedException e) {
-                LOGGER.error("ConfigPushingRunnable - interupted");
+                LOG.error("ConfigPushingRunnable - interupted");
                 interuppted = true;
             } catch (Exception e) {
-                LOGGER.error("Exception while processing features {}", e);
+                LOG.error("Exception while processing features {} event {}", toInstall, event, e);
             }
         }
     }
 
-    protected void processFeatureEvent(FeatureEvent event, List<Feature> toInstall) throws InterruptedException, Exception {
+    protected void processFeatureEvent(FeatureEvent event, List<Feature> toInstall) throws Exception {
         if(event.getType() == EventType.FeatureInstalled) {
             toInstall.add(event.getFeature());
             LinkedHashMultimap<Feature,FeatureConfigSnapshotHolder> result = configPusher.pushConfigs(toInstall);
@@ -73,7 +71,7 @@ public class ConfigPushingRunnable implements Runnable {
 
     protected void logPushResult(LinkedHashMultimap<Feature,FeatureConfigSnapshotHolder> results) {
         for(Feature f:results.keySet()) {
-            LOGGER.info("Pushed configs for feature {} {}",f,results.get(f));
+            LOG.info("Pushed configs for feature {} {}",f,results.get(f));
         }
     }
 }