Apache.NMS.ActiveMQ.Util.SimplePriorityMessageDispatchChannel.Close C# (CSharp) Method

Close() public method

public Close ( ) : void
return void
        public void Close()
        {
            lock(mutex)
            {
                if(!Closed)
                {
                    this.running = false;
                    this.closed = true;
                }

                Monitor.PulseAll(this.mutex);
            }
        }

Usage Example

 public void TestClose()
 {
     SimplePriorityMessageDispatchChannel channel = new SimplePriorityMessageDispatchChannel();
     channel.Start();
     Assert.IsTrue( channel.Running == true );
     Assert.IsTrue( channel.Closed == false );
     channel.Close();
     Assert.IsTrue( channel.Running == false );
     Assert.IsTrue( channel.Closed == true );
     channel.Start();
     Assert.IsTrue( channel.Running == false );
     Assert.IsTrue( channel.Closed == true );
 }