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/10 14:09:42 UTC

svn commit: r1057180 - in /activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport: InactivityMonitor.cs TransportFilter.cs

Author: tabish
Date: Mon Jan 10 13:09:42 2011
New Revision: 1057180

URL: http://svn.apache.org/viewvc?rev=1057180&view=rev
Log:
Apply similar fix as needed for AMQNET-298

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

Modified: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/InactivityMonitor.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/InactivityMonitor.cs?rev=1057180&r1=1057179&r2=1057180&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/InactivityMonitor.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/InactivityMonitor.cs Mon Jan 10 13:09:42 2011
@@ -45,6 +45,7 @@ namespace Apache.NMS.Stomp.Transport
         private AsyncWriteTask asyncWriteTask;
 
         private readonly Mutex monitor = new Mutex();
+        private bool disposing = false;
 
         private Timer connectionCheckTimer;
 
@@ -97,8 +98,8 @@ namespace Apache.NMS.Stomp.Transport
                 // get rid of unmanaged stuff
             }
 
+            this.disposing = true;
             StopMonitorThreads();
-
             base.Dispose(disposing);
         }
 
@@ -265,7 +266,7 @@ namespace Apache.NMS.Stomp.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();
@@ -277,6 +278,11 @@ namespace Apache.NMS.Stomp.Transport
         {
             lock(monitor)
             {
+                if(this.IsDisposed || this.disposing)
+                {
+                    return;
+                }
+                
                 if(monitorStarted.Value)
                 {
                     return;

Modified: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/TransportFilter.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/TransportFilter.cs?rev=1057180&r1=1057179&r2=1057180&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/TransportFilter.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/TransportFilter.cs Mon Jan 10 13:09:42 2011
@@ -151,6 +151,8 @@ namespace Apache.NMS.Stomp.Transport
 		{
 			if(disposing)
 			{
+                Tracer.Debug("TransportFilter disposing of next Transport: " +
+                             this.next.GetType().Name);
 				this.next.Dispose();
 			}
 			disposed = true;
@@ -190,6 +192,7 @@ namespace Apache.NMS.Stomp.Transport
 		
 		public virtual void Stop()
 		{
+            this.next.Stop();
 		}
 
         public Object Narrow(Type type)