Author: rupertlssmith
Date: Tue Oct  9 07:05:30 2007
New Revision: 583173

URL: http://svn.apache.org/viewvc?rev=583173&view=rev
Log:
Changed exception handler to propagate unknown exceptions to all method 
listeners, rather than throw it back to the caller.

Modified:
    
incubator/qpid/branches/M2.1/dotnet/Qpid.Client/Client/Protocol/AMQProtocolListener.cs

Modified: 
incubator/qpid/branches/M2.1/dotnet/Qpid.Client/Client/Protocol/AMQProtocolListener.cs
URL: 
http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/dotnet/Qpid.Client/Client/Protocol/AMQProtocolListener.cs?rev=583173&r1=583172&r2=583173&view=diff
==============================================================================
--- 
incubator/qpid/branches/M2.1/dotnet/Qpid.Client/Client/Protocol/AMQProtocolListener.cs
 (original)
+++ 
incubator/qpid/branches/M2.1/dotnet/Qpid.Client/Client/Protocol/AMQProtocolListener.cs
 Tue Oct  9 07:05:30 2007
@@ -161,20 +161,20 @@
         /// <summary>
         /// Receives notification of any IO exceptions on the connection.
         ///
-        /// <p/>Upon receipt of a connection closed exception, the fail-over 
process is attempted. If the fail-over fails, then all method listeners
-        /// and the application connection object are notified of the 
connection failure exception.
+        /// <p/>Upon receipt of a connection closed exception or any 
IOException, the fail-over process is attempted. If the fail-over fails, then
+        /// all method listeners and the application connection object are 
notified of the connection failure exception.
         ///
-        /// <p/>This exception handler only deals with 
AMQConnectionClosedExceptions, any other exception types are thrown back to the 
caller.
+        /// <p/>All other exception types are propagated to all method 
listeners.
         /// </summary>
         public void OnException(Exception cause)
         {
             _log.Warn("public void OnException(Exception cause = " + cause + 
"): called");
 
-            if (cause is AMQConnectionClosedException || cause is 
System.IO.IOException)
+            // Ensure that the method listener set cannot be changed whilst 
this exception is propagated to all listeners. This also 
+            // ensures that this exception is fully propagated to all 
listeners, before another one can be processed.
+            lock (_lock)
             {
-                // Ensure that the method listener set cannot be changed 
whilst this exception is propagated to all listeners. This also 
-                // ensures that this exception is fully propagated to all 
listeners, before another one can be processed.
-                lock (_lock)
+                if (cause is AMQConnectionClosedException || cause is 
System.IO.IOException)
                 {
                     // Try a fail-over because the connection has failed.
                     FailoverState failoverState = AttemptFailover();
@@ -190,11 +190,12 @@
                         _connection.ExceptionReceived(cause);
                     }
                 }
-            }
-            // Throw the exception back to the caller if it is not of a known 
type, to ensure unhandled runtimes are not swallowed.
-            else
-            {
-                throw cause;
+                // Notify all method listeners of the exception.
+                else
+                {
+                    PropagateExceptionToWaiters(cause);
+                    _connection.ExceptionReceived(cause);
+                }
             }
         }
 


Reply via email to