Beispiel #1
0
        /// <summary>
        /// Stops the <see cref="RelayNode"/> server from accepting TCP/IP requests.
        /// </summary>
        public void Stop()
        {
            if (queuedMessageCounterTimer != null)
            {
                queuedMessageCounterTimer.Change(Timeout.Infinite, Timeout.Infinite);
                queuedMessageCounterTimer.Dispose();
            }

            var timer = Interlocked.Exchange(ref resetConnectionRefusalTimer, null);

            if (timer != null)
            {
                timer.Change(Timeout.Infinite, Timeout.Infinite);
                timer.Dispose();
            }

            if (RefuseOutOfClusterConnection)
            {
                RefuseOutOfClusterConnection = false;
            }

            if (log.IsInfoEnabled)
            {
                log.Info("Shutting down socket transport.");
            }
            SocketServerAdapter.Shutdown();

            if (log.IsInfoEnabled)
            {
                log.Info("Disposing Dispatcher.");
            }
            inDispatcher.Dispose();
            var od = outDispatcher;             //in case of config reload to null

            if (od != null)
            {
                outDispatcher.Dispose();
            }

            StopHttpServer();

            components.Shutdown();

            if (log.IsInfoEnabled)
            {
                log.Info("Resetting Counters");
            }

            if (counters != null)
            {
                counters.ResetCounters();
                counters.Shutdown();
                counters = null;
            }

            if (log.IsInfoEnabled)
            {
                log.Info("Relay Node Stopped.");
            }
        }