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:18:04 UTC
svn commit: r1152084 -
/cxf/trunk/api/src/main/java/org/apache/cxf/BusFactory.java
Author: dkulp
Date: Fri Jul 29 03:18:03 2011
New Revision: 1152084
URL: http://svn.apache.org/viewvc?rev=1152084&view=rev
Log:
[CXF-3696] FIx potential lockup in BusFactory
Modified:
cxf/trunk/api/src/main/java/org/apache/cxf/BusFactory.java
Modified: cxf/trunk/api/src/main/java/org/apache/cxf/BusFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/BusFactory.java?rev=1152084&r1=1152083&r2=1152084&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/BusFactory.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/BusFactory.java Fri Jul 29 03:18:03 2011
@@ -148,19 +148,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(true);
- 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>