cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject [2/2] git commit: Updates to make sure extensions are only loaded once if multiple threads request the same extension at the same time.
Date Fri, 13 Jun 2014 19:37:28 GMT
Updates to make sure extensions are only loaded once if multiple threads request the same extension
at the same time.


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

Branch: refs/heads/2.7.x-fixes
Commit: eeeac57a3feac50257e1a71d9e2511f2042bdcfd
Parents: ec3deed
Author: Daniel Kulp <dkulp@apache.org>
Authored: Fri Jun 13 15:29:11 2014 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Fri Jun 13 15:36:43 2014 -0400

----------------------------------------------------------------------
 .../src/main/java/org/apache/cxf/bus/extension/Extension.java   | 5 ++++-
 .../java/org/apache/cxf/bus/extension/ExtensionManagerImpl.java | 4 +++-
 2 files changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/eeeac57a/rt/core/src/main/java/org/apache/cxf/bus/extension/Extension.java
----------------------------------------------------------------------
diff --git a/rt/core/src/main/java/org/apache/cxf/bus/extension/Extension.java b/rt/core/src/main/java/org/apache/cxf/bus/extension/Extension.java
index d608a14..85e0860 100644
--- a/rt/core/src/main/java/org/apache/cxf/bus/extension/Extension.java
+++ b/rt/core/src/main/java/org/apache/cxf/bus/extension/Extension.java
@@ -43,7 +43,7 @@ public class Extension {
     protected boolean deferred;
     protected Collection<String> namespaces = new ArrayList<String>();
     protected Object args[];
-    protected Object obj;
+    protected volatile Object obj;
     protected boolean optional;
     protected boolean notFound;
     
@@ -197,6 +197,9 @@ public class Extension {
         return clazz;
     }
     public Object load(ClassLoader cl, Bus b) {
+        if (obj != null) {
+            return obj;
+        }
         Class<?> cls = getClassObject(cl);
         try {
             if (notFound) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/eeeac57a/rt/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerImpl.java
----------------------------------------------------------------------
diff --git a/rt/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerImpl.java
b/rt/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerImpl.java
index 4b014e1..c1ba715 100644
--- a/rt/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerImpl.java
+++ b/rt/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerImpl.java
@@ -207,12 +207,14 @@ public class ExtensionManagerImpl implements ExtensionManager, ConfiguredBeanLoc
             Class<?> cls = null;
             if (null != e.getInterfaceName() && !"".equals(e.getInterfaceName()))
{
                 cls = e.loadInterface(loader);
+            }  else {
+                cls = e.getClassObject(loader);
             }
     
             if (null != activated && null != cls && null != activated.get(cls))
{
                 return;
             }
-     
+            
             Object obj = e.load(loader, bus);
             if (obj == null) {
                 return;


Mime
View raw message