Author: jgomes
Date: Tue Feb 28 23:42:51 2012
New Revision: 1294897

URL: http://svn.apache.org/viewvc?rev=1294897&view=rev
Log:
Trigger the fault tolerant recovery logic when a connection exception occurs.
Fixes [AMQNET-371]. (See https://issues.apache.org/jira/browse/AMQNET-371)

Modified:
    
activemq/activemq-dotnet/Apache.NMS.Stomp/branches/1.5.x/src/main/csharp/Connection.cs

Modified: 
activemq/activemq-dotnet/Apache.NMS.Stomp/branches/1.5.x/src/main/csharp/Connection.cs
URL: 
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/branches/1.5.x/src/main/csharp/Connection.cs?rev=1294897&r1=1294896&r2=1294897&view=diff
==============================================================================
--- 
activemq/activemq-dotnet/Apache.NMS.Stomp/branches/1.5.x/src/main/csharp/Connection.cs
 (original)
+++ 
activemq/activemq-dotnet/Apache.NMS.Stomp/branches/1.5.x/src/main/csharp/Connection.cs
 Tue Feb 28 23:42:51 2012
@@ -721,14 +721,27 @@ namespace Apache.NMS.Stomp
 
         internal void OnException(Exception error)
         {
-            // Will fire an exception listener callback if there's any set.
-            OnAsyncException(error);
+            if(this.transport.IsFaultTolerant)
+            {
+                Tracer.ErrorFormat("Attempting recovery from Exception: {0}", 
error.Message);
+                while(null != (error = error.InnerException))
+                {
+                    Tracer.ErrorFormat("   {0}", error.Message);
+                }
 
-            if(!this.closing.Value && !this.closed.Value)
+                OnTransportInterrupted(this.transport);
+            }
+            else
             {
-                // Perform the actual work in another thread to avoid lock 
contention
-                // and allow the caller to continue on in its error cleanup.
-                executor.QueueUserWorkItem(AsyncOnExceptionHandler, error);
+                // Will fire an exception listener callback if there's any set.
+                OnAsyncException(error);
+
+                if(!this.closing.Value && !this.closed.Value)
+                {
+                    // Perform the actual work in another thread to avoid lock 
contention
+                    // and allow the caller to continue on in its error 
cleanup.
+                    executor.QueueUserWorkItem(AsyncOnExceptionHandler, error);
+                }
             }
         }
 


Reply via email to