karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject [11/11] karaf git commit: Use a TreeSet to make the code more obvious
Date Mon, 15 May 2017 13:12:11 GMT
Use a TreeSet to make the code more obvious

Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/9b99ac74
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/9b99ac74
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/9b99ac74

Branch: refs/heads/master
Commit: 9b99ac740fed65fc518e16088eb9a88194632b61
Parents: 0326b10
Author: Guillaume Nodet <gnodet@apache.org>
Authored: Mon May 15 14:57:51 2017 +0200
Committer: Guillaume Nodet <gnodet@apache.org>
Committed: Mon May 15 14:57:51 2017 +0200

----------------------------------------------------------------------
 .../karaf/features/internal/service/FeaturesServiceImpl.java  | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/9b99ac74/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesServiceImpl.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesServiceImpl.java
b/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesServiceImpl.java
index 44300e7..d4e7ce1 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesServiceImpl.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesServiceImpl.java
@@ -714,12 +714,12 @@ public class FeaturesServiceImpl implements FeaturesService, Deployer.DeployCall
      * Should not be called while holding a lock.
      */
     protected Map<String, Map<String, Feature>> getFeatures() throws Exception
{
-        List<String> uris;
+        Set<String> uris;
         synchronized (lock) {
             if (featureCache != null) {
                 return featureCache;
             }
-            uris = new ArrayList<>(state.repositories);
+            uris = new TreeSet<>(state.repositories);
         }
         //the outer map's key is feature name, the inner map's key is feature version
         Map<String, Map<String, Feature>> map = new HashMap<>();
@@ -771,8 +771,7 @@ public class FeaturesServiceImpl implements FeaturesService, Deployer.DeployCall
             }
         }
         synchronized (lock) {
-            if (uris.size() == state.repositories.size()
-                    && state.repositories.containsAll(uris)) {
+            if (uris.equals(state.repositories)) {
                 featureCache = map;
             }
         }


Mime
View raw message