diff options
| author | Rupert Smith <rupertlssmith@apache.org> | 2007-10-09 14:05:30 +0000 |
|---|---|---|
| committer | Rupert Smith <rupertlssmith@apache.org> | 2007-10-09 14:05:30 +0000 |
| commit | a93de90ef7be612fbc0891f014b827be8785bf3c (patch) | |
| tree | 0a1ad0a7471c06ed1725dc91a1b58c49ac45107f /dotnet/Qpid.Client/Client/Protocol | |
| parent | 40f341143ed889af6f0b40c7e3256f6b78220488 (diff) | |
| download | qpid-python-a93de90ef7be612fbc0891f014b827be8785bf3c.tar.gz | |
Changed exception handler to propagate unknown exceptions to all method listeners, rather than throw it back to the caller.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/M2.1@583173 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'dotnet/Qpid.Client/Client/Protocol')
| -rw-r--r-- | dotnet/Qpid.Client/Client/Protocol/AMQProtocolListener.cs | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/dotnet/Qpid.Client/Client/Protocol/AMQProtocolListener.cs b/dotnet/Qpid.Client/Client/Protocol/AMQProtocolListener.cs index 3d31d6c2f3..c51538b70e 100644 --- a/dotnet/Qpid.Client/Client/Protocol/AMQProtocolListener.cs +++ b/dotnet/Qpid.Client/Client/Protocol/AMQProtocolListener.cs @@ -161,20 +161,20 @@ namespace Apache.Qpid.Client.Protocol /// <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 @@ namespace Apache.Qpid.Client.Protocol _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); + } } } |
