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 B10B310D37 for ; Tue, 12 Nov 2013 17:05:35 +0000 (UTC) Received: (qmail 79912 invoked by uid 500); 12 Nov 2013 17:05:35 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 79606 invoked by uid 500); 12 Nov 2013 17:05:33 -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 79503 invoked by uid 99); 12 Nov 2013 17:05:24 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Nov 2013 17:05:24 +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; Tue, 12 Nov 2013 17:05:23 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id F069923888FE; Tue, 12 Nov 2013 17:05:02 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1541153 - /cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/BusFactory.java Date: Tue, 12 Nov 2013 17:05:02 -0000 To: commits@cxf.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20131112170502.F069923888FE@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dkulp Date: Tue Nov 12 17:05:02 2013 New Revision: 1541153 URL: http://svn.apache.org/r1541153 Log: Merged revisions 1541140 via git cherry-pick from https://svn.apache.org/repos/asf/cxf/trunk ........ r1541140 | dkulp | 2013-11-12 11:57:27 -0500 (Tue, 12 Nov 2013) | 2 lines Make the thread bus holders final so the jit can optimize the accesses better. ........ Modified: cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/BusFactory.java Modified: cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/BusFactory.java URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/BusFactory.java?rev=1541153&r1=1541152&r2=1541153&view=diff ============================================================================== --- cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/BusFactory.java (original) +++ cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/BusFactory.java Tue Nov 12 17:05:02 2013 @@ -73,8 +73,8 @@ public abstract class BusFactory { volatile boolean stale; } - protected static Map threadBusses = new WeakHashMap(); - protected static ThreadLocal threadBus = new ThreadLocal(); + protected static final Map THREAD_BUSSES = new WeakHashMap(); + protected static final ThreadLocal THREAD_BUS = new ThreadLocal(); private static final Logger LOG = LogUtils.getL7dLogger(BusFactory.class); @@ -114,21 +114,21 @@ public abstract class BusFactory { } private static BusHolder getThreadBusHolder(boolean set) { - BusHolder h = threadBus.get(); + BusHolder h = THREAD_BUS.get(); if (h == null || h.stale) { Thread cur = Thread.currentThread(); - synchronized (threadBusses) { - h = threadBusses.get(cur); + synchronized (THREAD_BUSSES) { + h = THREAD_BUSSES.get(cur); } if (h == null || h.stale) { h = new BusHolder(); - synchronized (threadBusses) { - threadBusses.put(cur, h); + synchronized (THREAD_BUSSES) { + THREAD_BUSSES.put(cur, h); } } if (set) { - threadBus.set(h); + THREAD_BUS.set(h); } } return h; @@ -146,7 +146,7 @@ public abstract class BusFactory { b.bus = bus; if (bus == null) { b.stale = true; - threadBus.remove(); + THREAD_BUS.remove(); } } @@ -157,17 +157,17 @@ public abstract class BusFactory { */ public static void setThreadDefaultBus(Bus bus) { if (bus == null) { - BusHolder h = threadBus.get(); + BusHolder h = THREAD_BUS.get(); if (h == null) { Thread cur = Thread.currentThread(); - synchronized (threadBusses) { - h = threadBusses.get(cur); + synchronized (THREAD_BUSSES) { + h = THREAD_BUSSES.get(cur); } } if (h != null) { h.bus = null; h.stale = true; - threadBus.remove(); + THREAD_BUS.remove(); } } else { BusHolder b = getThreadBusHolder(true); @@ -183,18 +183,18 @@ public abstract class BusFactory { */ public static Bus getAndSetThreadDefaultBus(Bus bus) { if (bus == null) { - BusHolder b = threadBus.get(); + BusHolder b = THREAD_BUS.get(); if (b == null) { Thread cur = Thread.currentThread(); - synchronized (threadBusses) { - b = threadBusses.get(cur); + synchronized (THREAD_BUSSES) { + b = THREAD_BUSSES.get(cur); } } if (b != null) { Bus orig = b.bus; b.bus = null; b.stale = true; - threadBus.remove(); + THREAD_BUS.remove(); return orig; } return null; @@ -228,11 +228,11 @@ public abstract class BusFactory { } return b.bus; } - BusHolder h = threadBus.get(); + BusHolder h = THREAD_BUS.get(); if (h == null || h.stale) { Thread cur = Thread.currentThread(); - synchronized (threadBusses) { - h = threadBusses.get(cur); + synchronized (THREAD_BUSSES) { + h = THREAD_BUSSES.get(cur); } } return h == null || h.stale ? null : h.bus; @@ -254,8 +254,8 @@ public abstract class BusFactory { * @param bus the bus to remove */ public static void clearDefaultBusForAnyThread(final Bus bus) { - synchronized (threadBusses) { - for (final Iterator iterator = threadBusses.values().iterator(); + synchronized (THREAD_BUSSES) { + for (final Iterator iterator = THREAD_BUSSES.values().iterator(); iterator.hasNext();) { BusHolder itBus = iterator.next(); if (bus == null || itBus == null || itBus.bus == null