activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1052069 - /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/InactivityMonitor.cs
Date Wed, 22 Dec 2010 21:16:39 GMT
Author: tabish
Date: Wed Dec 22 21:16:37 2010
New Revision: 1052069

URL: http://svn.apache.org/viewvc?rev=1052069&view=rev
Log:
refined the fix for: https://issues.apache.org/jira/browse/AMQNET-298

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

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/InactivityMonitor.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/InactivityMonitor.cs?rev=1052069&r1=1052068&r2=1052069&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/InactivityMonitor.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/InactivityMonitor.cs
Wed Dec 22 21:16:37 2010
@@ -51,6 +51,7 @@ namespace Apache.NMS.ActiveMQ.Transport
 
         private static int id = 0;
         private readonly int instanceId = 0;
+        private bool disposing = false;
 
         private long readCheckTime;
         public long ReadCheckTime
@@ -107,11 +108,9 @@ namespace Apache.NMS.ActiveMQ.Transport
                 // get rid of unmanaged stuff
             }
 
-            lock(monitor)
-            {
-                StopMonitorThreads();
-                base.Dispose(disposing);
-            }
+            this.disposing = true;
+            StopMonitorThreads();
+            base.Dispose(disposing);
         }
 		
 		public void CheckConnection(object state)
@@ -281,7 +280,7 @@ namespace Apache.NMS.ActiveMQ.Transport
 
         protected override void OnException(ITransport sender, Exception command)
         {
-            if(failed.CompareAndSet(false, true))
+            if(failed.CompareAndSet(false, true) && !this.disposing)
             {
                 Tracer.Debug("Exception received in the Inactivity Monitor: " + command.ToString());
                 StopMonitorThreads();
@@ -293,7 +292,7 @@ namespace Apache.NMS.ActiveMQ.Transport
         {
             lock(monitor)
             {
-                if(this.IsDisposed)
+                if(this.IsDisposed || this.disposing)
                 {
                     return;
                 }



Mime
View raw message