Enyim.Membase.MessageStreamListener.Stop C# (CSharp) Method

Stop() public method

Stops processing
public Stop ( ) : void
return void
		public void Stop()
		{
			if (log.IsDebugEnabled) log.Debug("Stopping the listener.");

			Interlocked.Exchange(ref this.stopCounter, 1);
			this.CleanupRequests();

			this.IsStarted = false;

			if (log.IsDebugEnabled) log.Debug("Stopped.");
		}

Usage Example

        /// <summary>
        /// Unsubscibes from a pooled listener, and destrpys it if no additionals subscribers are present.
        /// </summary>
        /// <param name="listener"></param>
        private void ReleaseListener(MessageStreamListener listener)
        {
            lock (ListenerSync)
            {
                listener.Unsubscribe(this.HandleMessage);

                var info = listenerRefs[listener];
                if (info.RefCount == 1)
                {
                    listenerRefs.Remove(listener);
                    listeners.Remove(info.HashKey);

                    try { using (listener) listener.Stop(); }
                    catch { }
                }
                else
                {
                    info.RefCount--;
                }
            }
        }
All Usage Examples Of Enyim.Membase.MessageStreamListener::Stop