You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2011/01/17 16:35:37 UTC
svn commit: r1059954 -
/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs
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
{