Author: jgomes
Date: Thu Jun 25 01:12:07 2009
New Revision: 788233

URL: http://svn.apache.org/viewvc?rev=788233&view=rev
Log:
Applied patch to set worker thread as background thread.  Thanks to Iddo Shoham 
for the fix!
Fixes [AMQNET-166]. (See https://issues.apache.org/activemq/browse/AMQNET-166)

Modified:
    
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/tags/1.1.0/src/main/csharp/Transport/Discovery/Multicast/MulticastDiscoveryAgent.cs

Modified: 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/tags/1.1.0/src/main/csharp/Transport/Discovery/Multicast/MulticastDiscoveryAgent.cs
URL: 
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/tags/1.1.0/src/main/csharp/Transport/Discovery/Multicast/MulticastDiscoveryAgent.cs?rev=788233&r1=788232&r2=788233&view=diff
==============================================================================
--- 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/tags/1.1.0/src/main/csharp/Transport/Discovery/Multicast/MulticastDiscoveryAgent.cs
 (original)
+++ 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/tags/1.1.0/src/main/csharp/Transport/Discovery/Multicast/MulticastDiscoveryAgent.cs
 Thu Jun 25 01:12:07 2009
@@ -32,7 +32,7 @@
                public const int MAX_SOCKET_CONNECTION_RETRY_ATTEMPS = 3;
                public const int DEFAULT_BACKOFF_MILLISECONDS = 100;
                public const int BACKOFF_MULTIPLIER = 2;
-        public const string DEFAULT_DISCOVERY_URI_STRING = 
"multicast://239.255.2.3:6155";
+               public const string DEFAULT_DISCOVERY_URI_STRING = 
"multicast://239.255.2.3:6155";
                private const string TYPE_SUFFIX = "ActiveMQ-4.";
                private const string ALIVE = "alive";
                private const string DEAD = "dead";
@@ -69,10 +69,10 @@
                {
                        lock(stopstartSemaphore)
                        {
-                if (discoveryUri == null)
-                {
-                    discoveryUri = new Uri(DEFAULT_DISCOVERY_URI_STRING);
-                }
+                               if (discoveryUri == null)
+                               {
+                                       discoveryUri = new 
Uri(DEFAULT_DISCOVERY_URI_STRING);
+                               }
 
                                if(multicastSocket == null)
                                {
@@ -98,6 +98,7 @@
                                {
                                        Tracer.Info("Starting multicast 
discovery agent worker thread");
                                        worker = new Thread(new 
ThreadStart(worker_DoWork));
+                                       worker.IsBackground = true;
                                        worker.Start();
                                        isStarted = true;
                                }
@@ -182,15 +183,15 @@
                                        int numBytes = 
multicastSocket.Receive(buffer);
                                        receivedInfoRaw = 
System.Text.Encoding.UTF8.GetString(buffer, 0, numBytes);
                                        // We have to remove all of the null 
bytes if there are any otherwise we just
-                    // take the whole string as is.
-                    if (receivedInfoRaw.IndexOf("\0") != -1)
-                    {
-                        receivedInfo = receivedInfoRaw.Substring(0, 
receivedInfoRaw.IndexOf("\0"));
-                    }
-                    else
-                    {
-                        receivedInfo = receivedInfoRaw;
-                    }
+                                       // take the whole string as is.
+                                       if (receivedInfoRaw.IndexOf("\0") != -1)
+                                       {
+                                               receivedInfo = 
receivedInfoRaw.Substring(0, receivedInfoRaw.IndexOf("\0"));
+                                       }
+                                       else
+                                       {
+                                               receivedInfo = receivedInfoRaw;
+                                       }
 
                                        ProcessBrokerMessage(receivedInfo);
                                }
@@ -294,16 +295,16 @@
                        }
                }
 
-        #region Properties
+               #region Properties
 
-        /// <summary>
-        /// This property indicates whether or not async send is enabled.
-        /// </summary>
-        public Uri DiscoveryURI
-        {
-            get { return discoveryUri; }
-            set { discoveryUri = value; }
-        }
+               /// <summary>
+               /// This property indicates whether or not async send is 
enabled.
+               /// </summary>
+               public Uri DiscoveryURI
+               {
+                       get { return discoveryUri; }
+                       set { discoveryUri = value; }
+               }
 
                public bool IsStarted
                {
@@ -314,11 +315,11 @@
                {
                        get { return group; }
                        set { group = value; }
-        }
+               }
 
-        #endregion
+               #endregion
 
-        internal string MulticastType
+               internal string MulticastType
                {
                        get { return group + "." + TYPE_SUFFIX; }
                }


Reply via email to