Apache.NMS.ActiveMQ.Transport.Failover.FailoverTransport.HandleTransportFailure C# (CSharp) Method

HandleTransportFailure() public method

public HandleTransportFailure ( Exception e ) : void
e Exception
return void
        public void HandleTransportFailure(Exception e)
        {
            ITransport transport = connectedTransport.GetAndSet(null);
            if(transport != null)
            {
                transport.Command = disposedOnCommand;
                transport.Exception = disposedOnException;
                try
                {
                    transport.Stop();
                }
                catch(Exception ex)
                {
                    ex.GetType();	// Ignore errors but this lets us see the error during debugging
                }

                lock(reconnectMutex)
                {
                    bool reconnectOk = false;
                    if(started)
                    {
                        Tracer.WarnFormat("Transport failed to {0}, attempting to automatically reconnect due to: {1}", ConnectedTransportURI.ToString(), e.Message);
                        reconnectOk = true;
                    }

                    initialized = false;
                    failedConnectTransportURI = ConnectedTransportURI;
                    ConnectedTransportURI = null;
                    connected = false;

                    if(this.Interrupted != null)
                    {
                        this.Interrupted(transport);
                    }

                    if(reconnectOk)
                    {
                        reconnectTask.Wakeup();
                    }
                }
            }
        }