コード例 #1
0
        //=========================================
        // Stoppable
        //=========================================

        public override void Stop()
        {
            Logger.Info($"DIRECTORY: stopping on node: {_localNode}");

            StopProcessing();

            _publisher?.Close();

            base.Stop();
        }
コード例 #2
0
        private void StopProcessing()
        {
            _stopped = true;

            if (_publisher != null)
            {
                try
                {
                    _publisher.Close();
                }
                catch
                {
                    // ignore
                }
                finally
                {
                    _publisher = null;
                }
            }

            if (_cancellableMessageProcessing != null)
            {
                try
                {
                    _cancellableMessageProcessing.Cancel();
                }
                catch
                {
                    // ignore
                }
                finally
                {
                    _cancellableMessageProcessing = null;
                }
            }

            if (_cancellablePublishing != null)
            {
                try
                {
                    _cancellablePublishing.Cancel();
                }
                catch
                {
                    // ignore
                }
                finally
                {
                    _cancellablePublishing = null;
                }
            }
        }