config-persister-feature-adapter: final parameters 64/56964/2
authorStephen Kitt <skitt@redhat.com>
Fri, 12 May 2017 12:08:44 +0000 (14:08 +0200)
committerTom Pantelis <tompantelis@gmail.com>
Mon, 15 May 2017 11:52:57 +0000 (11:52 +0000)
This automatically-generated patch flags all appropriate parameters as
final (including caught exceptions).

Change-Id: Ic198d806782423545323cc00075219fa89d06dd4
Signed-off-by: Stephen Kitt <skitt@redhat.com>
opendaylight/config/config-persister-feature-adapter/src/main/java/org/opendaylight/controller/configpusherfeature/ConfigPusherFeatureActivator.java
opendaylight/config/config-persister-feature-adapter/src/main/java/org/opendaylight/controller/configpusherfeature/internal/AbstractFeatureWrapper.java
opendaylight/config/config-persister-feature-adapter/src/main/java/org/opendaylight/controller/configpusherfeature/internal/ChildAwareFeatureWrapper.java
opendaylight/config/config-persister-feature-adapter/src/main/java/org/opendaylight/controller/configpusherfeature/internal/ConfigFeaturesListener.java
opendaylight/config/config-persister-feature-adapter/src/main/java/org/opendaylight/controller/configpusherfeature/internal/ConfigPusherCustomizer.java
opendaylight/config/config-persister-feature-adapter/src/main/java/org/opendaylight/controller/configpusherfeature/internal/ConfigPushingRunnable.java
opendaylight/config/config-persister-feature-adapter/src/main/java/org/opendaylight/controller/configpusherfeature/internal/FeatureConfigPusher.java
opendaylight/config/config-persister-feature-adapter/src/main/java/org/opendaylight/controller/configpusherfeature/internal/FeatureConfigSnapshotHolder.java
opendaylight/config/config-persister-feature-adapter/src/main/java/org/opendaylight/controller/configpusherfeature/internal/FeatureServiceCustomizer.java

index 0b4f6f7..c20c6f9 100644 (file)
@@ -19,14 +19,14 @@ public class ConfigPusherFeatureActivator implements BundleActivator {
     ConfigPusherCustomizer cpc = null;
     ServiceTracker<ConfigPusher,ConfigPusher> cpst = null;
 
-    public void start(BundleContext context) throws Exception {
+    public void start(final BundleContext context) throws Exception {
         bc = context;
         cpc = new ConfigPusherCustomizer();
         cpst = new ServiceTracker<>(bc, ConfigPusher.class.getName(), cpc);
         cpst.open();
     }
 
-    public void stop(BundleContext context) throws Exception {
+    public void stop(final BundleContext context) throws Exception {
         if(cpst != null) {
             cpst.close();
             cpst = null;
index eec7882..7e33cee 100644 (file)
@@ -88,7 +88,7 @@ public class AbstractFeatureWrapper implements Feature {
         return Optional.absent();
     }
 
-    private static boolean isConfigSnapshot(String fileName) {
+    private static boolean isConfigSnapshot(final String fileName) {
         if(!Files.getFileExtension(fileName).equals(CONFIG_FILE_SUFFIX)) {
             return false;
         }
@@ -110,7 +110,7 @@ public class AbstractFeatureWrapper implements Feature {
 
             Element root = builderFactory.newDocumentBuilder().parse(fis).getDocumentElement();
             return ConfigSnapshot.SNAPSHOT_ROOT_ELEMENT_NAME.equals(root.getLocalName());
-        } catch (Exception e) {
+        } catch (final Exception e) {
             LOG.error("Could not parse XML file {}", file, e);
             return false;
         }
index a9d0685..f51bf47 100644 (file)
@@ -31,7 +31,7 @@ public class ChildAwareFeatureWrapper extends AbstractFeatureWrapper implements
     private static final Logger LOG = LoggerFactory.getLogger(ChildAwareFeatureWrapper.class);
     private FeaturesService featuresService= null;
 
-    protected ChildAwareFeatureWrapper(Feature f) {
+    protected ChildAwareFeatureWrapper(final Feature f) {
         // Don't use without a feature service
     }
 
@@ -39,7 +39,7 @@ public class ChildAwareFeatureWrapper extends AbstractFeatureWrapper implements
      * @param f Feature to wrap
      * @param s FeaturesService to look up dependencies
      */
-    ChildAwareFeatureWrapper(Feature f, FeaturesService s) throws Exception {
+    ChildAwareFeatureWrapper(final Feature f, final FeaturesService s) throws Exception {
         super(s.getFeature(f.getName(), f.getVersion()));
         Preconditions.checkNotNull(s, "FeatureWrapper requires non-null FeatureService in constructor");
         this.featuresService = s;
@@ -87,7 +87,7 @@ public class ChildAwareFeatureWrapper extends AbstractFeatureWrapper implements
         return snapShotHolders;
     }
 
-    protected Feature extractFeatureFromDependency(Dependency dependency) throws Exception {
+    protected Feature extractFeatureFromDependency(final Dependency dependency) throws Exception {
         Feature[] features = featuresService.listFeatures();
         VersionRange range = org.apache.karaf.features.internal.model.Feature.DEFAULT_VERSION.equals(dependency.getVersion())
                 ? VersionRange.ANY_VERSION : new VersionRange(dependency.getVersion(), true, true);
index 3297ba4..075db50 100644 (file)
@@ -23,18 +23,18 @@ public class ConfigFeaturesListener implements  FeaturesListener,  AutoCloseable
     private BlockingQueue<FeatureEvent> queue = new LinkedBlockingQueue<>(QUEUE_SIZE);
     Thread pushingThread = null;
 
-    public ConfigFeaturesListener(ConfigPusher p, FeaturesService f) {
+    public ConfigFeaturesListener(final ConfigPusher p, final FeaturesService f) {
         pushingThread = new Thread(new ConfigPushingRunnable(p, f, queue), "ConfigFeatureListener - ConfigPusher");
         pushingThread.start();
     }
 
     @Override
-    public void featureEvent(FeatureEvent event) {
+    public void featureEvent(final FeatureEvent event) {
         queue.offer(event);
     }
 
     @Override
-    public void repositoryEvent(RepositoryEvent event) {
+    public void repositoryEvent(final RepositoryEvent event) {
         LOG.debug("Repository: {} {}", event.getType(), event.getRepository());
     }
 
index 420e8d7..ac10c68 100644 (file)
@@ -23,7 +23,7 @@ public class ConfigPusherCustomizer implements ServiceTrackerCustomizer<ConfigPu
     private ServiceTracker<FeaturesService,FeaturesService> fsst = null;
 
     @Override
-    public ConfigPusher addingService(ServiceReference<ConfigPusher> configPusherServiceReference) {
+    public ConfigPusher addingService(final ServiceReference<ConfigPusher> configPusherServiceReference) {
         LOG.trace("Got ConfigPusherCustomizer.addingService {}", configPusherServiceReference);
         BundleContext bc = configPusherServiceReference.getBundle().getBundleContext();
         ConfigPusher cpService = bc.getService(configPusherServiceReference);
@@ -34,12 +34,12 @@ public class ConfigPusherCustomizer implements ServiceTrackerCustomizer<ConfigPu
     }
 
     @Override
-    public void modifiedService(ServiceReference<ConfigPusher> configPusherServiceReference, ConfigPusher configPusher) {
+    public void modifiedService(final ServiceReference<ConfigPusher> configPusherServiceReference, final ConfigPusher configPusher) {
         // we don't care if the properties change
     }
 
     @Override
-    public void removedService(ServiceReference<ConfigPusher> configPusherServiceReference, ConfigPusher configPusher) {
+    public void removedService(final ServiceReference<ConfigPusher> configPusherServiceReference, final ConfigPusher configPusher) {
         this.close();
     }
 
index cfdad56..48c494b 100644 (file)
@@ -25,7 +25,7 @@ public class ConfigPushingRunnable implements Runnable {
     private static final int POLL_TIME = 1;
     private BlockingQueue<FeatureEvent> queue;
     private FeatureConfigPusher configPusher;
-    public ConfigPushingRunnable(ConfigPusher p, FeaturesService f,BlockingQueue<FeatureEvent> q) {
+    public ConfigPushingRunnable(final ConfigPusher p, final FeaturesService f, final BlockingQueue<FeatureEvent> q) {
         queue = q;
         configPusher = new FeatureConfigPusher(p, f);
     }
@@ -50,16 +50,16 @@ public class ConfigPushingRunnable implements Runnable {
                     LOG.error("ConfigPushingRunnable - exiting");
                     return;
                 }
-            } catch (InterruptedException e) {
+            } catch (final InterruptedException e) {
                 LOG.error("ConfigPushingRunnable - interupted");
                 interuppted = true;
-            } catch (Exception e) {
+            } catch (final Exception e) {
                 LOG.error("Exception while processing features {} event {}", toInstall, event, e);
             }
         }
     }
 
-    protected void processFeatureEvent(FeatureEvent event, List<Feature> toInstall) throws Exception {
+    protected void processFeatureEvent(final FeatureEvent event, final List<Feature> toInstall) throws Exception {
         if(event.getType() == EventType.FeatureInstalled) {
             toInstall.add(event.getFeature());
             LinkedHashMultimap<Feature,FeatureConfigSnapshotHolder> result = configPusher.pushConfigs(toInstall);
@@ -69,7 +69,7 @@ public class ConfigPushingRunnable implements Runnable {
         }
     }
 
-    protected void logPushResult(LinkedHashMultimap<Feature,FeatureConfigSnapshotHolder> results) {
+    protected void logPushResult(final LinkedHashMultimap<Feature,FeatureConfigSnapshotHolder> results) {
         for(Feature f:results.keySet()) {
             LOG.info("Pushed configs for feature {} {}",f,results.get(f));
         }
index 406739d..15223a8 100644 (file)
@@ -111,7 +111,7 @@ public class FeatureConfigPusher {
             // we're fully on Karaf 4 only, as a comment in BUG-6787 indicates that (in Karaf 4) :
             // "the 'installed' Map of FeaturesServiceImpl .. appears to be correctly synchronized/thread-safe".
             // (Or, if it's still NOK, then it could be fixed properly upstream in Karaf once we're on recent.)
-            } catch (ConcurrentModificationException e) {
+            } catch (final ConcurrentModificationException e) {
                 // BUG-6787 experience shows that a LOG.warn (or info) here is very confusing to end-users;
                 // as we have a retry loop anyway, there is no point informing (and confusing) users of this
                 // intermediate state of, so ... NOOP, do not log here.
@@ -119,7 +119,7 @@ public class FeatureConfigPusher {
             }
             try {
                 Thread.sleep(RETRY_PAUSE_MILLIS);
-            } catch (InterruptedException e1) {
+            } catch (final InterruptedException e1) {
                 throw new IllegalStateException(e1);
             }
         }
index 70f7366..7107cc9 100644 (file)
@@ -93,7 +93,7 @@ public class FeatureConfigSnapshotHolder implements ConfigSnapshotHolder {
      * We really care most about the underlying ConfigShapshot, so compute equality on that
      */
     @Override
-    public boolean equals(Object obj) {
+    public boolean equals(final Object obj) {
         if (this == obj) {
             return true;
         }
index 5ce58ef..9a1764e 100644 (file)
@@ -25,12 +25,12 @@ public class FeatureServiceCustomizer implements ServiceTrackerCustomizer<Featur
     private ConfigPusher configPusher = null;
     private ServiceRegistration<?> registration;
 
-    FeatureServiceCustomizer(ConfigPusher c) {
+    FeatureServiceCustomizer(final ConfigPusher c) {
         configPusher = c;
     }
 
     @Override
-    public FeaturesService addingService(ServiceReference<FeaturesService> reference) {
+    public FeaturesService addingService(final ServiceReference<FeaturesService> reference) {
         BundleContext bc = reference.getBundle().getBundleContext();
         final FeaturesService featureService = bc.getService(reference);
         final Optional<XmlFileStorageAdapter> currentPersister = XmlFileStorageAdapter.getInstance();
@@ -54,14 +54,14 @@ public class FeatureServiceCustomizer implements ServiceTrackerCustomizer<Featur
     }
 
     @Override
-    public void modifiedService(ServiceReference<FeaturesService> reference,
-            FeaturesService service) {
+    public void modifiedService(final ServiceReference<FeaturesService> reference,
+            final FeaturesService service) {
         // we don't care if the properties change
     }
 
     @Override
-    public void removedService(ServiceReference<FeaturesService> reference,
-            FeaturesService service) {
+    public void removedService(final ServiceReference<FeaturesService> reference,
+            final FeaturesService service) {
         close();
     }
 

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.