felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject svn commit: r1679367 - /felix/trunk/framework/src/main/java/org/apache/felix/framework/capabilityset/CapabilitySet.java
Date Thu, 14 May 2015 13:38:53 GMT
Author: davidb
Date: Thu May 14 13:38:53 2015
New Revision: 1679367

URL: http://svn.apache.org/r1679367
Log:
[Framework] Fix concurrency issue in CapabilitySet as reported by pderop

Modified:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/capabilityset/CapabilitySet.java

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/capabilityset/CapabilitySet.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/capabilityset/CapabilitySet.java?rev=1679367&r1=1679366&r2=1679367&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/capabilityset/CapabilitySet.java
(original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/capabilityset/CapabilitySet.java
Thu May 14 13:38:53 2015
@@ -25,8 +25,6 @@ import java.lang.reflect.Modifier;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -88,7 +86,7 @@ public class CapabilitySet
         for (int i = 0; (indexProps != null) && (i < indexProps.size()); i++)
         {
             m_indices.put(
-                indexProps.get(i), new HashMap<Object, Set<BundleCapability>>());
+                indexProps.get(i), new ConcurrentHashMap<Object, Set<BundleCapability>>());
         }
     }
 
@@ -131,7 +129,7 @@ public class CapabilitySet
         Set<BundleCapability> caps = index.get(capValue);
         if (caps == null)
         {
-            caps = new HashSet<BundleCapability>();
+            caps = Collections.newSetFromMap(new ConcurrentHashMap<BundleCapability, Boolean>());
             index.put(capValue, caps);
         }
         caps.add(cap);
@@ -194,7 +192,7 @@ public class CapabilitySet
 
     private Set<Capability> match(Set<Capability> caps, final SimpleFilter sf)
     {
-        Set<Capability> matches = new HashSet<Capability>();
+        Set<Capability> matches = Collections.newSetFromMap(new ConcurrentHashMap<Capability,
Boolean>());
 
         if (sf.getOperation() == SimpleFilter.MATCH_ALL)
         {



Mime
View raw message