cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r988298 - in /cxf/branches/2.2.x-fixes: ./ rt/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerImpl.java
Date Mon, 23 Aug 2010 20:36:20 GMT
Author: dkulp
Date: Mon Aug 23 20:36:20 2010
New Revision: 988298

URL: http://svn.apache.org/viewvc?rev=988298&view=rev
Log:
Merged revisions 988291 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r988291 | dkulp | 2010-08-23 16:22:23 -0400 (Mon, 23 Aug 2010) | 1 line
  
  [CXF-2954] Synchronize some stuff in the Extension bus
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerImpl.java

Propchange: cxf/branches/2.2.x-fixes/
            ('svn:mergeinfo' removed)

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerImpl.java?rev=988298&r1=988297&r2=988298&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerImpl.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerImpl.java
Mon Aug 23 20:36:20 2010
@@ -30,6 +30,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
 
 import org.apache.cxf.common.injection.ResourceInjector;
 import org.apache.cxf.configuration.Configurer;
@@ -105,15 +106,19 @@ public class ExtensionManagerImpl implem
             activateViaNS(deferred.keySet().iterator().next());
         }
     }
-    public <T> void activateAllByType(Class<T> type) {
+    public synchronized <T> void activateAllByType(Class<T> type) {
         for (Map.Entry<String, Collection<Extension>> e : deferred.entrySet())
{
-            Iterator<Extension> it = e.getValue().iterator();
-            while (it.hasNext()) {
-                Extension ex = it.next();
-                if (type.isAssignableFrom(ex.getClassObject(loader))) {
-                    loadAndRegister(ex);
-                    it.remove();
+            if (!e.getValue().isEmpty()) {
+                List<Extension> removes = new ArrayList<Extension>(e.getValue().size());
+                Iterator<Extension> it = e.getValue().iterator();
+                while (it.hasNext()) {
+                    Extension ex = it.next();
+                    if (type.isAssignableFrom(ex.getClassObject(loader))) {
+                        loadAndRegister(ex);
+                        removes.add(ex);
+                    }
                 }
+                e.getValue().removeAll(removes);
             }
         }
     }
@@ -202,7 +207,7 @@ public class ExtensionManagerImpl implem
         for (String ns : e.getNamespaces()) {
             Collection<Object> intf2Obj = namespaced.get(ns);
             if (intf2Obj == null) {
-                intf2Obj = new ArrayList<Object>();
+                intf2Obj = new CopyOnWriteArrayList<Object>();
                 if (!namespaced.containsKey(ns)) {
                     namespaced.put(ns, intf2Obj);
                 }



Mime
View raw message