Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 84533 invoked from network); 26 Dec 2008 14:31:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Dec 2008 14:31:33 -0000 Received: (qmail 17178 invoked by uid 500); 26 Dec 2008 14:31:33 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 17158 invoked by uid 500); 26 Dec 2008 14:31:33 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 17149 invoked by uid 99); 26 Dec 2008 14:31:32 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Dec 2008 06:31:32 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.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; Fri, 26 Dec 2008 14:31:31 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id F3C6B23888A3; Fri, 26 Dec 2008 06:31:09 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r729498 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java Date: Fri, 26 Dec 2008 14:31:09 -0000 To: commits@activemq.apache.org From: dejanb@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081226143109.F3C6B23888A3@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dejanb Date: Fri Dec 26 06:31:09 2008 New Revision: 729498 URL: http://svn.apache.org/viewvc?rev=729498&view=rev Log: fix for https://issues.apache.org/activemq/browse/AMQ-2044 Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java?rev=729498&r1=729497&r2=729498&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java (original) +++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java Fri Dec 26 06:31:09 2008 @@ -104,7 +104,7 @@ synchronized(this) { // If there was nothing dispatched.. we may need to setup a timeout. if (dispatchCounterBeforePull == dispatchCounter) { - // imediate timeout used by receiveNoWait() + // immediate timeout used by receiveNoWait() if (pull.getTimeout() == -1) { // Send a NULL message. add(QueueMessageReference.NULL_MESSAGE); @@ -128,13 +128,15 @@ * Occurs when a pull times out. If nothing has been dispatched since the * timeout was setup, then send the NULL message. */ - final synchronized void pullTimeout(long dispatchCounterBeforePull) { + final void pullTimeout(long dispatchCounterBeforePull) { if (dispatchCounterBeforePull == dispatchCounter) { - try { - add(QueueMessageReference.NULL_MESSAGE); - dispatchPending(); - } catch (Exception e) { - context.getConnection().serviceException(e); + synchronized (pendingLock) { + try { + add(QueueMessageReference.NULL_MESSAGE); + dispatchPending(); + } catch (Exception e) { + context.getConnection().serviceException(e); + } } } }