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 A7A9F9144 for ; Thu, 29 Sep 2011 18:48:16 +0000 (UTC) Received: (qmail 77894 invoked by uid 500); 29 Sep 2011 18:48:15 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 77867 invoked by uid 500); 29 Sep 2011 18:48:15 -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 77860 invoked by uid 99); 29 Sep 2011 18:48:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Sep 2011 18:48:15 +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; Thu, 29 Sep 2011 18:48:14 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 70BB623889D7 for ; Thu, 29 Sep 2011 18:47:54 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1177396 - in /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk: ./ src/main/csharp/MessageConsumer.cs src/main/csharp/Session.cs Date: Thu, 29 Sep 2011 18:47:54 -0000 To: commits@activemq.apache.org From: jgomes@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20110929184754.70BB623889D7@eris.apache.org> Author: jgomes Date: Thu Sep 29 18:47:53 2011 New Revision: 1177396 URL: http://svn.apache.org/viewvc?rev=1177396&view=rev Log: Merged revision(s) 1177395 from activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.5.x: Add lock of SyncRoot when iterating over the consumers list. Fixes [AMQNET-342]. (See https://issues.apache.org/jira/browse/AMQNET-342) Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/ (props changed) activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageConsumer.cs activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Session.cs Propchange: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Sep 29 18:47:53 2011 @@ -1,3 +1,3 @@ -/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.5.x:1082291,1135831,1137081,1171843,1171874,1177390 +/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.5.x:1082291,1135831,1137081,1171843,1171874,1177390,1177395 /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/tags/1.0.0:692591,693525 /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/tags/1.1.0:788230,788233,790183 Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageConsumer.cs URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageConsumer.cs?rev=1177396&r1=1177395&r2=1177396&view=diff ============================================================================== --- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageConsumer.cs (original) +++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageConsumer.cs Thu Sep 29 18:47:53 2011 @@ -228,7 +228,7 @@ namespace Apache.NMS.ActiveMQ bool wasStarted = this.session.Started; - if(wasStarted == true) + if(wasStarted) { this.session.Stop(); } @@ -236,7 +236,7 @@ namespace Apache.NMS.ActiveMQ listener += value; this.session.Redispatch(this.unconsumedMessages); - if(wasStarted == true) + if(wasStarted) { this.session.Start(); } Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Session.cs URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Session.cs?rev=1177396&r1=1177395&r2=1177396&view=diff ============================================================================== --- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Session.cs (original) +++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Session.cs Thu Sep 29 18:47:53 2011 @@ -815,10 +815,13 @@ namespace Apache.NMS.ActiveMQ public void Start() { - foreach(MessageConsumer consumer in this.consumers.Values) - { - consumer.Start(); - } + lock(this.consumers.SyncRoot) + { + foreach(MessageConsumer consumer in this.consumers.Values) + { + consumer.Start(); + } + } if(this.executor != null) { @@ -968,13 +971,16 @@ namespace Apache.NMS.ActiveMQ internal bool IsInUse(ActiveMQTempDestination dest) { - foreach(MessageConsumer consumer in this.consumers.Values) - { - if(consumer.IsInUse(dest)) - { - return true; - } - } + lock(this.consumers.SyncRoot) + { + foreach(MessageConsumer consumer in this.consumers.Values) + { + if(consumer.IsInUse(dest)) + { + return true; + } + } + } return false; }