public void Dispose()
        {
            lock (senderList.SyncRoot)
            {
                foreach (DedicatedMessageSender dmSender in senderList)
                {
                    if (dmSender.IsAlive)
                    {
                        try
                        {
                            _ncacheLog.Flush();
#if !NETCORE
                            dmSender.Abort();
#else
                            dmSender.Interrupt();
#endif
                        }
                        catch (Exception)
                        {
                        }
                    }
                }
                senderList.Clear();
                mq.close(false);
            }
        }
Exemple #2
0
        public void Dispose()
        {
            if (_msgQueue != null && !_msgQueue.Closed)
            {
                _msgQueue.close(true);
                _msgQueue = null;
            }

            try
            {
                if (_priNagglingMgr != null && _priNagglingMgr.IsAlive)
                {
#if !NETCORE
                    _priNagglingMgr.Abort();
#elif NETCORE
                    _priNagglingMgr.Interrupt();
#endif
                }

                if (_secNagglingMgr != null && _secNagglingMgr.IsAlive)
                {
#if !NETCORE
                    _secNagglingMgr.Abort();
#elif NETCORE
                    _secNagglingMgr.Interrupt();
#endif
                }
            }
            catch (Exception) { }
        }
Exemple #3
0
        public void Dispose()
        {
            if (_msgQueue != null && !_msgQueue.Closed)
            {
                _msgQueue.close(true);
                _msgQueue = null;
            }

            try
            {
                if (_priNagglingMgr != null && _priNagglingMgr.IsAlive)
                {
                    _priNagglingMgr.Abort();
                }

                if (_secNagglingMgr != null && _secNagglingMgr.IsAlive)
                {
                    _secNagglingMgr.Abort();
                }
            }
            catch (Exception) { }
        }
Exemple #4
0
        /// <summary>Used internally. If overridden, call parent's method first </summary>
        public virtual void  stopInternal()
        {
            if (up_queue != null)
            {
                up_queue.close(false); // this should terminate up_handler thread
            }
            if (up_handler != null && up_handler.IsAlive)
            {
                try
                {
                    up_handler.Join(THREAD_JOIN_TIMEOUT);
                }
                catch (System.Exception e)
                {
                    stack.NCacheLog.Error("Protocol.stopInternal()", "up_handler.Join " + e.Message);
                }
                if (up_handler != null && up_handler.IsAlive)
                {
                    up_handler.Interrupt();                     // still alive ? let's just kill it without mercy...
                    try
                    {
                        up_handler.Join(THREAD_JOIN_TIMEOUT);
                    }
                    catch (System.Exception e)
                    {
                        stack.NCacheLog.Error("Protocol.stopInternal()", "up_handler.Join " + e.Message);
                    }
                    if (up_handler != null && up_handler.IsAlive)
                    {
                        stack.NCacheLog.Error("Protocol", "up_handler thread for " + Name + " was interrupted (in order to be terminated), but is still alive");
                    }
                }
            }
            up_handler = null;

            if (down_queue != null)
            {
                down_queue.close(false); // this should terminate down_handler thread
            }
            if (down_handler != null && down_handler.IsAlive)
            {
                try
                {
                    down_handler.Join(THREAD_JOIN_TIMEOUT);
                }
                catch (System.Exception e)
                {
                    stack.NCacheLog.Error("Protocol.stopInternal()", "down_handler.Join " + e.Message);
                }
                if (down_handler != null && down_handler.IsAlive)
                {
                    down_handler.Interrupt();                     // still alive ? let's just kill it without mercy...
                    try
                    {
                        down_handler.Join(THREAD_JOIN_TIMEOUT);
                    }
                    catch (System.Exception e)
                    {
                        stack.NCacheLog.Error("Protocol.stopInternal()", "down_handler.Join " + e.Message);
                    }
                    if (down_handler != null && down_handler.IsAlive)
                    {
                        stack.NCacheLog.Error("Protocol", "down_handler thread for " + Name + " was interrupted (in order to be terminated), but is is still alive");
                    }
                }
            }
            down_handler = null;
        }