Return-Path: X-Original-To: apmail-activemq-commits-archive@www.apache.org Delivered-To: apmail-activemq-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 3F379FE94 for ; Wed, 1 May 2013 20:49:30 +0000 (UTC) Received: (qmail 66321 invoked by uid 500); 1 May 2013 20:49:30 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 66274 invoked by uid 500); 1 May 2013 20:49:30 -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 66266 invoked by uid 99); 1 May 2013 20:49:30 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 May 2013 20:49:30 +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, 01 May 2013 20:49:28 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id B039B2388993; Wed, 1 May 2013 20:49:08 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1478183 - in /activemq/trunk: activemq-broker/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4504Test.java Date: Wed, 01 May 2013 20:49:08 -0000 To: commits@activemq.apache.org From: gtully@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130501204908.B039B2388993@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: gtully Date: Wed May 1 20:49:08 2013 New Revision: 1478183 URL: http://svn.apache.org/r1478183 Log: https://issues.apache.org/jira/browse/AMQ-4504 - ensure all dests in a composite get a chance to dispatch to a consumer after an ack Added: activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4504Test.java (with props) Modified: activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java Modified: activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java?rev=1478183&r1=1478182&r2=1478183&view=diff ============================================================================== --- activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java (original) +++ activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java Wed May 1 20:49:08 2013 @@ -415,6 +415,12 @@ public abstract class PrefetchSubscripti if (callDispatchMatched && destination != null) { destination.wakeup(); dispatchPending(); + + if (pending.isEmpty()) { + for (Destination dest : destinations) { + dest.wakeup(); + } + } } else { LOG.debug("Acknowledgment out of sync (Normally occurs when failover connection reconnects): " + ack); Added: activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4504Test.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4504Test.java?rev=1478183&view=auto ============================================================================== --- activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4504Test.java (added) +++ activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4504Test.java Wed May 1 20:49:08 2013 @@ -0,0 +1,82 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.activemq.bugs; + +import javax.jms.Connection; +import javax.jms.ConnectionFactory; +import javax.jms.MessageConsumer; +import javax.jms.MessageProducer; +import javax.jms.Session; +import org.apache.activemq.ActiveMQConnectionFactory; +import org.apache.activemq.broker.BrokerService; +import org.apache.activemq.command.ActiveMQQueue; +import org.apache.activemq.command.ActiveMQTextMessage; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + + +import static org.junit.Assert.assertNotNull; + +public class AMQ4504Test { + + BrokerService brokerService; + + @Before + public void setup() throws Exception { + brokerService = new BrokerService(); + brokerService.setPersistent(false); + brokerService.start(); + } + + @After + public void stop() throws Exception { + brokerService.stop(); + } + + @Test + public void testCompositeDestConsumer() throws Exception { + + final int numDests = 20; + final int numMessages = 200; + StringBuffer stringBuffer = new StringBuffer(); + for (int i=0; i