private void StopTask(CancellationToken cancellationToken)
{
if (!this.IsConfigured)
{
return;
}
this.logger.Trace(m => m("{0}: marking as not ready.", this.Endpoint));
this.ready.Reset();
this.OnStopping();
this.logger.Trace(m => m("{0}: stopping bus components.", this.Endpoint));
this.ComponentTracker.StopAll();
if (this.ListenerRegistry != null)
{
this.logger.Trace(m => m("{0}: resetting listener registry.", this.Endpoint));
this.ListenerRegistry.Reset();
}
if (this.ProducerRegistry != null)
{
this.logger.Trace(m => m("{0}: resetting producer registry.", this.Endpoint));
this.ProducerRegistry.Reset();
}
this.DropConnection();
this.OnStopped();
}