qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject svn commit: r1073681 - /qpid/trunk/qpid/dotnet/Qpid.Client.Tests/interop/TopicListener.cs
Date Wed, 23 Feb 2011 10:35:15 GMT
Author: marnie
Date: Wed Feb 23 10:35:15 2011
New Revision: 1073681

URL: http://svn.apache.org/viewvc?rev=1073681&view=rev
Log:
QPID-3059 fix for background thread termination from Keith Wall

Modified:
    qpid/trunk/qpid/dotnet/Qpid.Client.Tests/interop/TopicListener.cs

Modified: qpid/trunk/qpid/dotnet/Qpid.Client.Tests/interop/TopicListener.cs
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/Qpid.Client.Tests/interop/TopicListener.cs?rev=1073681&r1=1073680&r2=1073681&view=diff
==============================================================================
--- qpid/trunk/qpid/dotnet/Qpid.Client.Tests/interop/TopicListener.cs (original)
+++ qpid/trunk/qpid/dotnet/Qpid.Client.Tests/interop/TopicListener.cs Wed Feb 23 10:35:15
2011
@@ -19,6 +19,7 @@
  *
  */
 using System;
+using System.Threading;
 using log4net;
 using Apache.Qpid.Messaging;
 using Apache.Qpid.Client.Qms;
@@ -47,6 +48,12 @@ namespace Apache.Qpid.Client.Tests.inter
         /// <summary> Holds the producer to send report messages on. </summary>
         private IMessagePublisher publisher;
 
+        /// <summary> A monitor used to wait for shutdown. </summary>
+        private AutoResetEvent shutdownReceivedEvt = new AutoResetEvent(false);
+
+        /// <summary> Holds the default test timeout for communications . </summary>
+        const int TIMEOUT = 60000;
+
         /// <summary> Holds a flag to indicate that a timer has begun on the first
message. Reset when report is sent. </summary> */
         private bool init;
     
@@ -85,6 +92,15 @@ namespace Apache.Qpid.Client.Tests.inter
 
             connection.Start();
             Console.WriteLine("Waiting for messages...");
+
+            if (shutdownReceivedEvt.WaitOne(TIMEOUT, true))
+            {
+                Console.WriteLine("Shutting down - shut down message was received");
+            }
+            else 
+            {
+                Console.WriteLine("Shutting down - timeout elapsed");
+            }
         }
 
         public static void Main(String[] argv)
@@ -185,6 +201,8 @@ namespace Apache.Qpid.Client.Tests.inter
             connection.Stop();
             channel.Dispose();
             connection.Dispose();
+
+            shutdownReceivedEvt.Set();
         }
 
         /// <summary> Sends the report message to the response location. </summary>



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message