Author: dkulp Date: Thu Jul 12 14:28:46 2012 New Revision: 1360695 URL: http://svn.apache.org/viewvc?rev=1360695&view=rev Log: Merged revisions 1360673 via git cherry-pick from https://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes
........ r1360673 | dkulp | 2012-07-12 09:47:28 -0400 (Thu, 12 Jul 2012) | 10 lines Merged revisions 1360402 via git cherry-pick from https://svn.apache.org/repos/asf/cxf/trunk ........ r1360402 | dkulp | 2012-07-11 17:15:32 -0400 (Wed, 11 Jul 2012) | 2 lines Move thread.currentThread out of synch block. ........ ........ Modified: cxf/branches/2.5.x-fixes/api/src/main/java/org/apache/cxf/BusFactory.java Modified: cxf/branches/2.5.x-fixes/api/src/main/java/org/apache/cxf/BusFactory.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/api/src/main/java/org/apache/cxf/BusFactory.java?rev=1360695&r1=1360694&r2=1360695&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/api/src/main/java/org/apache/cxf/BusFactory.java (original) +++ cxf/branches/2.5.x-fixes/api/src/main/java/org/apache/cxf/BusFactory.java Thu Jul 12 14:28:46 2012 @@ -126,8 +126,9 @@ public abstract class BusFactory { * @param bus the default bus. */ public static void setThreadDefaultBus(Bus bus) { + Thread cur = Thread.currentThread(); synchronized (threadBusses) { - threadBusses.put(Thread.currentThread(), bus); + threadBusses.put(cur, bus); } } @@ -148,8 +149,9 @@ public abstract class BusFactory { */ public static Bus getThreadDefaultBus(boolean createIfNeeded) { Bus threadBus; + Thread cur = Thread.currentThread(); synchronized (threadBusses) { - threadBus = threadBusses.get(Thread.currentThread()); + threadBus = threadBusses.get(cur); } if (createIfNeeded && threadBus == null) { threadBus = createThreadBus(); @@ -158,12 +160,13 @@ public abstract class BusFactory { } private static synchronized Bus createThreadBus() { Bus threadBus; + Thread cur = Thread.currentThread(); synchronized (threadBusses) { - threadBus = threadBusses.get(Thread.currentThread()); + threadBus = threadBusses.get(cur); } if (threadBus == null) { threadBus = getDefaultBus(true); - threadBusses.put(Thread.currentThread(), threadBus); + threadBusses.put(cur, threadBus); } return threadBus; } @@ -195,9 +198,10 @@ public abstract class BusFactory { * @return true if the bus was not set and is now set */ public static synchronized boolean possiblySetDefaultBus(Bus bus) { + Thread cur = Thread.currentThread(); synchronized (threadBusses) { - if (threadBusses.get(Thread.currentThread()) == null) { - threadBusses.put(Thread.currentThread(), bus); + if (threadBusses.get(cur) == null) { + threadBusses.put(cur, bus); } } if (defaultBus == null) {
