Trigger the fault tolerant recovery logic when a connection exception occurs. Fixes [AMQNET-371]. (See https://issues.apache.org/jira/browse/AMQNET-371)
Project: http://git-wip-us.apache.org/repos/asf/activemq-nms-stomp/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-nms-stomp/commit/07cda020 Tree: http://git-wip-us.apache.org/repos/asf/activemq-nms-stomp/tree/07cda020 Diff: http://git-wip-us.apache.org/repos/asf/activemq-nms-stomp/diff/07cda020 Branch: refs/heads/1.5.x Commit: 07cda020cd8a26bdb1e97c402344a86991140289 Parents: 8e02b74 Author: Jim Gomes <jgo...@apache.org> Authored: Tue Feb 28 23:42:51 2012 +0000 Committer: Jim Gomes <jgo...@apache.org> Committed: Tue Feb 28 23:42:51 2012 +0000 ---------------------------------------------------------------------- src/main/csharp/Connection.cs | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-nms-stomp/blob/07cda020/src/main/csharp/Connection.cs ---------------------------------------------------------------------- diff --git a/src/main/csharp/Connection.cs b/src/main/csharp/Connection.cs index 4ca6aa5..16f664a 100755 --- a/src/main/csharp/Connection.cs +++ b/src/main/csharp/Connection.cs @@ -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); + } } }