activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1059954 - /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs
Date Mon, 17 Jan 2011 15:35:37 GMT
Author: tabish
Date: Mon Jan 17 15:35:37 2011
New Revision: 1059954

URL: http://svn.apache.org/viewvc?rev=1059954&view=rev
Log:
https://issues.apache.org/jira/browse/AMQNET-290

Have the async exception callback use a copy of the sessions list to avoid a concurrent modification
error

Modified:
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs?rev=1059954&r1=1059953&r2=1059954&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs Mon Jan
17 15:35:37 2011
@@ -890,7 +890,15 @@ namespace Apache.NMS.ActiveMQ
 
             this.brokerInfoReceived.countDown();
 
-            foreach(Session session in this.sessions)
+            IList sessionsCopy = null;
+            lock(this.sessions.SyncRoot)
+            {
+                sessionsCopy = new ArrayList(this.sessions);
+            }
+
+            // Use a copy so we don't concurrently modify the Sessions list if the
+            // client is closing at the same time.
+            foreach(Session session in sessionsCopy)
             {
                 try
                 {



Mime
View raw message