summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarnie McCormack <marnie@apache.org>2011-02-23 10:35:15 +0000
committerMarnie McCormack <marnie@apache.org>2011-02-23 10:35:15 +0000
commitd8e80cc98d8bee1c9bd0127e4850a060b582065e (patch)
treedbcde467fea0122b58d3f20d00d19bb83c70dace
parent7d12d40d864d138248acac69f3e663e119f4f4d1 (diff)
downloadqpid-python-d8e80cc98d8bee1c9bd0127e4850a060b582065e.tar.gz
QPID-3059 fix for background thread termination from Keith Wall
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1073681 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--dotnet/Qpid.Client.Tests/interop/TopicListener.cs18
1 files changed, 18 insertions, 0 deletions
diff --git a/dotnet/Qpid.Client.Tests/interop/TopicListener.cs b/dotnet/Qpid.Client.Tests/interop/TopicListener.cs
index b355abb28d..e5daa64a89 100644
--- a/dotnet/Qpid.Client.Tests/interop/TopicListener.cs
+++ b/dotnet/Qpid.Client.Tests/interop/TopicListener.cs
@@ -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.interop
/// <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.interop
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.interop
connection.Stop();
channel.Dispose();
connection.Dispose();
+
+ shutdownReceivedEvt.Set();
}
/// <summary> Sends the report message to the response location. </summary>