diff options
| author | Marnie McCormack <marnie@apache.org> | 2011-02-23 10:35:15 +0000 |
|---|---|---|
| committer | Marnie McCormack <marnie@apache.org> | 2011-02-23 10:35:15 +0000 |
| commit | f96eb3b2e68f6067915a0774f9e055239dbde723 (patch) | |
| tree | 17c1b97193a00c1f86f20d739178c4d0820bb3d2 | |
| parent | 48591d6c55e4ffa9abde55312a5495d4b2b32349 (diff) | |
| download | qpid-python-f96eb3b2e68f6067915a0774f9e055239dbde723.tar.gz | |
QPID-3059 fix for background thread termination from Keith Wall
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1073681 13f79535-47bb-0310-9956-ffa450edef68
| -rw-r--r-- | qpid/dotnet/Qpid.Client.Tests/interop/TopicListener.cs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/qpid/dotnet/Qpid.Client.Tests/interop/TopicListener.cs b/qpid/dotnet/Qpid.Client.Tests/interop/TopicListener.cs index b355abb28d..e5daa64a89 100644 --- a/qpid/dotnet/Qpid.Client.Tests/interop/TopicListener.cs +++ b/qpid/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> |
