You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2011/07/29 05:24:18 UTC

svn commit: r1152087 - in /cxf/branches/2.3.x-fixes: ./ api/src/main/java/org/apache/cxf/BusFactory.java

Author: dkulp
Date: Fri Jul 29 03:24:17 2011
New Revision: 1152087

URL: http://svn.apache.org/viewvc?rev=1152087&view=rev
Log:
Merged revisions 1152086 via svnmerge from 
https://svn.us.apache.org/repos/asf/cxf/branches/2.4.x-fixes

................
  r1152086 | dkulp | 2011-07-28 23:21:13 -0400 (Thu, 28 Jul 2011) | 9 lines
  
  Merged revisions 1152084 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r1152084 | dkulp | 2011-07-28 23:18:03 -0400 (Thu, 28 Jul 2011) | 1 line
    
    [CXF-3696] FIx potential lockup in BusFactory
  ........
................

Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/BusFactory.java

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jul 29 03:24:17 2011
@@ -1,2 +1,2 @@
-/cxf/branches/2.4.x-fixes:1152012
-/cxf/trunk:1152010
+/cxf/branches/2.4.x-fixes:1152012,1152086
+/cxf/trunk:1152010,1152084

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

Modified: cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/BusFactory.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/BusFactory.java?rev=1152087&r1=1152086&r2=1152087&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/BusFactory.java (original)
+++ cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/BusFactory.java Fri Jul 29 03:24:17 2011
@@ -131,19 +131,24 @@ public abstract class BusFactory {
     public static Bus getThreadDefaultBus(boolean createIfNeeded) {
         Bus threadBus;
         synchronized (threadBusses) {
-            if (createIfNeeded) {
-                threadBus = threadBusses.get(Thread.currentThread());
-                if (createIfNeeded && threadBus == null) {
-                    threadBus = getDefaultBus(createIfNeeded);
-                    threadBusses.put(Thread.currentThread(), threadBus);
-                }
-            } else {
-                threadBus = threadBusses.get(Thread.currentThread());
-            }
+            threadBus = threadBusses.get(Thread.currentThread());
+        }
+        if (createIfNeeded && threadBus == null) {
+            threadBus = createThreadBus();
+        }
+        return threadBus;
+    }
+    private static synchronized Bus createThreadBus() {
+        Bus threadBus;
+        synchronized (threadBusses) {
+            threadBus = threadBusses.get(Thread.currentThread());
+        }
+        if (threadBus == null) {
+            threadBus = getDefaultBus(true);
+            threadBusses.put(Thread.currentThread(), threadBus);
         }
         return threadBus;
     }
-
     /**
      * Removes a bus from being a thread default bus for any thread.
      * <p>