activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1032743 - /activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/InactivityMonitor.cs
Date Mon, 08 Nov 2010 21:42:14 GMT
Author: tabish
Date: Mon Nov  8 21:42:14 2010
New Revision: 1032743

URL: http://svn.apache.org/viewvc?rev=1032743&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQNET-284

Updates for build on .NET Compact Framework.

Modified:
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/InactivityMonitor.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=1032743&r1=1032742&r2=1032743&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 Nov  8 21:42:14 2010
@@ -19,6 +19,7 @@ using System;
 using System.Threading;
 using Apache.NMS.Stomp.Commands;
 using Apache.NMS.Stomp.Threads;
+using Apache.NMS.Stomp.Util;
 using Apache.NMS.Util;
 
 namespace Apache.NMS.Stomp.Transport
@@ -100,14 +101,14 @@ namespace Apache.NMS.Stomp.Transport
 
             base.Dispose(disposing);
         }
-        
+
         public void CheckConnection(object state)
         {
             Tracer.DebugFormat("CheckConnection: Timer Elapsed at {0}", DateTime.Now.ToLocalTime());
 
             // First see if we have written or can write.
             WriteCheck();
-            
+
             // Now check is we've read anything, if not then we send
             // a new KeepAlive with response required.
             ReadCheck();
@@ -121,7 +122,7 @@ namespace Apache.NMS.Stomp.Transport
         {
             if(this.inWrite.Value || this.failed.Value)
             {
-                Tracer.Debug("Inactivity Monitor is in write or already failed.");      
       
+                Tracer.Debug("Inactivity Monitor is in write or already failed.");
                 return;
             }
 
@@ -148,7 +149,7 @@ namespace Apache.NMS.Stomp.Transport
 
             if(!AllowReadCheck(elapsed))
             {
-                Tracer.Debug("Inactivity Monitor: A read check is not currently allowed.");
            
+                Tracer.Debug("Inactivity Monitor: A read check is not currently allowed.");
                 return;
             }
 
@@ -319,7 +320,7 @@ namespace Apache.NMS.Stomp.Transport
                 }
 
                 initialDelayTime = localWireFormatInfo.MaxInactivityDurationInitialDelay;
-                
+
                 Tracer.DebugFormat("Inactivity: Read Check time interval: {0}", readCheckTime
);
                 Tracer.DebugFormat("Inactivity: Initial Delay time interval: {0}", initialDelayTime
);
                 Tracer.DebugFormat("Inactivity: Write Check time interval: {0}", writeCheckTime
);
@@ -359,12 +360,9 @@ namespace Apache.NMS.Stomp.Transport
             {
                 if(monitorStarted.CompareAndSet(true, false))
                 {
-                    AutoResetEvent shutdownEvent = new AutoResetEvent(false);
-
                     // Attempt to wait for the Timer to shutdown, but don't wait
                     // forever, if they don't shutdown after two seconds, just quit.
-                    this.connectionCheckTimer.Dispose(shutdownEvent);
-                    shutdownEvent.WaitOne(TimeSpan.FromMilliseconds(2000), false);
+                    ThreadUtil.DisposeTimer(connectionCheckTimer, 2000);
 
                     this.asyncTasks.Shutdown();
                     this.asyncTasks = null;



Mime
View raw message