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 2010/07/08 21:39:08 UTC

svn commit: r961899 - in /activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp: Commands/ShutdownInfo.cs Transport/Failover/FailoverTransport.cs Util/ThreadUtil.cs

Author: tabish
Date: Thu Jul  8 19:39:08 2010
New Revision: 961899

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

Some enhancements and fixes for Failover processing and shutdown.

Modified:
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ShutdownInfo.cs
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/Failover/FailoverTransport.cs
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Util/ThreadUtil.cs

Modified: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ShutdownInfo.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ShutdownInfo.cs?rev=961899&r1=961898&r2=961899&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ShutdownInfo.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Commands/ShutdownInfo.cs Thu Jul  8 19:39:08 2010
@@ -18,6 +18,8 @@
 using System;
 using System.Collections;
 
+using Apache.NMS.Stomp.State;
+
 namespace Apache.NMS.Stomp.Commands
 {
     public class ShutdownInfo : BaseCommand
@@ -57,6 +59,11 @@ namespace Apache.NMS.Stomp.Commands
             }
         }
 
+        public override Response visit(ICommandVisitor visitor)
+        {
+            return visitor.processShutdownInfo( this );
+        }
+
     };
 }
 

Modified: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/Failover/FailoverTransport.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/Failover/FailoverTransport.cs?rev=961899&r1=961898&r2=961899&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/Failover/FailoverTransport.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/Failover/FailoverTransport.cs Thu Jul  8 19:39:08 2010
@@ -470,8 +470,13 @@ namespace Apache.NMS.Stomp.Transport.Fai
                             // Release so that the reconnect task can run
                             try
                             {
-                                // Wait for something
-                                ThreadUtil.MonitorWait(reconnectMutex, 1000);
+                                // This is a bit of a hack, what should be happening is that when
+                                // there's a reconnect the reconnectTask should signal the Monitor
+                                // or some other event object to indicate that we can wakeup right
+                                // away here, instead of performing the full wait.
+                                Monitor.Exit(reconnectMutex);
+                                Thread.Sleep(100);
+                                Monitor.Enter(reconnectMutex);
                             }
                             catch(Exception e)
                             {

Modified: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Util/ThreadUtil.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Util/ThreadUtil.cs?rev=961899&r1=961898&r2=961899&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Util/ThreadUtil.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Util/ThreadUtil.cs Thu Jul  8 19:39:08 2010
@@ -22,27 +22,6 @@ namespace Apache.NMS.Stomp.Util
 {
     public class ThreadUtil
     {
-       public static bool MonitorWait(Mutex mutex, int timeout)
-       {
-#if NETCF
-            int waitTime = 0;
-            bool acquiredLock = false;
-
-            // Release so that the reconnect task can run
-            Monitor.Exit(mutex);
-            // Wait for something
-            while(!(acquiredLock = Monitor.TryEnter(mutex)) && waitTime < timeout)
-            {
-                Thread.Sleep(1);
-                waitTime++;
-            }
-
-            return acquiredLock;
-#else
-           return Monitor.Wait(mutex, timeout);
-#endif
-       }
-
        public static void DisposeTimer(Timer timer, int timeout)
        {
 #if NETCF