Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 93359D8AC for ; Wed, 11 Jul 2012 21:15:53 +0000 (UTC) Received: (qmail 59535 invoked by uid 500); 11 Jul 2012 21:15:53 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 59481 invoked by uid 500); 11 Jul 2012 21:15:53 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 59474 invoked by uid 99); 11 Jul 2012 21:15:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Jul 2012 21:15:53 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Jul 2012 21:15:52 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 0981B23889E1; Wed, 11 Jul 2012 21:15:33 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1360402 - /cxf/trunk/api/src/main/java/org/apache/cxf/BusFactory.java Date: Wed, 11 Jul 2012 21:15:32 -0000 To: commits@cxf.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120711211533.0981B23889E1@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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) {