Author: dkulp
Date: Wed Jul 11 21:15:32 2012
New Revision: 1360402
URL: http://svn.apache.org/viewvc?rev=1360402&view=rev
Log:
Move thread.currentThread out of synch block.
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=1360402&r1=1360401&r2=1360402&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 Wed Jul 11
21:15:32 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) {