Contour.Transport.RabbitMQ.Internal.RabbitBus.Shutdown C# (CSharp) 메소드

Shutdown() 공개 메소드

The shutdown.
public Shutdown ( ) : void
리턴 void
        public override void Shutdown()
        {
            this.logger.InfoFormat(
                "Shutting down [{0}] with endpoint [{1}].",
                this.GetType().Name,
                this.Endpoint);

            this.IsShuttingDown = true;

            this.Stop();

            if (this.ListenerRegistry != null)
            {
                this.logger.Trace(m => m("{0}: disposing listener registry.", this.Endpoint));
                this.ListenerRegistry.Dispose();
                this.ListenerRegistry = null;
            }

            if (this.ProducerRegistry != null)
            {
                this.logger.Trace(m => m("{0}: disposing producer registry.", this.Endpoint));
                this.ProducerRegistry.Dispose();
                this.ProducerRegistry = null;
            }

            this.logger.Trace(m => m("{0}: resetting state.", this.Endpoint));
            this.IsConfigured = false;

            // если не ожидать завершения задачи до сброса флага IsShuttingDown,
            // тогда в случае ошибок (например, когда обработчик пытается отправить сообщение в шину, а она в состоятии закрытия)
            // задача может не успеть закрыться и она входит в бесконечное ожидание в методе Restart -> ResetRestartTask.
            this.restartTask.Wait();
            this.IsShuttingDown = false;
        }