cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject 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:36:11 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 7d4f8ea0c -> 7f60c6cfc


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/7f60c6cf
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/7f60c6cf
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/7f60c6cf

Branch: refs/heads/master
Commit: 7f60c6cfcfc74f52a331fe6cdd20fb570e8aa56c
Parents: 7d4f8ea
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:29:11 2014 -0400

----------------------------------------------------------------------
 core/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/7f60c6cf/core/src/main/java/org/apache/cxf/bus/extension/Extension.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/bus/extension/Extension.java b/core/src/main/java/org/apache/cxf/bus/extension/Extension.java
index d608a14..85e0860 100644
--- a/core/src/main/java/org/apache/cxf/bus/extension/Extension.java
+++ b/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/7f60c6cf/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerImpl.java b/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerImpl.java
index 71ae65d..79b88a6 100644
--- a/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerImpl.java
+++ b/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerImpl.java
@@ -195,12 +195,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