cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1422014 - /cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java
Date Fri, 14 Dec 2012 18:10:30 GMT
Author: dkulp
Date: Fri Dec 14 18:10:29 2012
New Revision: 1422014

URL: http://svn.apache.org/viewvc?rev=1422014&view=rev
Log:
Merged revisions 1422004 via  git cherry-pick from
https://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes

........
  r1422004 | dkulp | 2012-12-14 12:55:25 -0500 (Fri, 14 Dec 2012) | 10 lines

  Merged revisions 1421941 via  git cherry-pick from
  https://svn.apache.org/repos/asf/cxf/trunk

  ........
    r1421941 | dkulp | 2012-12-14 10:40:31 -0500 (Fri, 14 Dec 2012) | 2 lines

    [CXF-4703] Cache the unfound extensions to boost performance

  ........

........

Modified:
    cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java

Modified: cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java?rev=1422014&r1=1422013&r2=1422014&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java (original)
+++ cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java Fri
Dec 14 18:10:29 2012
@@ -22,8 +22,10 @@ package org.apache.cxf.bus;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.CopyOnWriteArraySet;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
@@ -54,6 +56,7 @@ public class CXFBusImpl extends Abstract
     }
     
     protected final Map<Class, Object> extensions;
+    protected final Set<Class> missingExtensions;
     protected String id;
     private BusState state;      
     private final Collection<AbstractFeature> features = new CopyOnWriteArrayList<AbstractFeature>();
@@ -70,6 +73,8 @@ public class CXFBusImpl extends Abstract
             extensions = new ConcurrentHashMap<Class, Object>(extensions);
         }
         this.extensions = extensions;
+        this.missingExtensions = new CopyOnWriteArraySet<Class>();
+        
         
         state = BusState.INITIAL;
         
@@ -89,7 +94,7 @@ public class CXFBusImpl extends Abstract
 
     public final <T> T getExtension(Class<T> extensionType) {
         Object obj = extensions.get(extensionType);
-        if (obj == null) {
+        if (obj == null && !missingExtensions.contains(extensionType)) {
             ConfiguredBeanLocator loc = (ConfiguredBeanLocator)extensions.get(ConfiguredBeanLocator.class);
             if (loc == null) {
                 loc = createConfiguredBeanLocator();
@@ -107,6 +112,8 @@ public class CXFBusImpl extends Abstract
         }
         if (null != obj) {
             return extensionType.cast(obj);
+        } else {
+            missingExtensions.add(extensionType);
         }
         return null;
     }
@@ -140,8 +147,9 @@ public class CXFBusImpl extends Abstract
 
     public <T> void setExtension(T extension, Class<T> extensionType) {
         extensions.put(extensionType, extension);
+        missingExtensions.remove(extensionType);
     }
-     
+
     public String getId() {        
         return null == id ? DEFAULT_BUS_ID + Integer.toString(Math.abs(this.hashCode()))
: id;
     }



Mime
View raw message