Sure, thanks for checking this out. 
As per your last suggestion, here's a version which closes and disposes the
consumer and session, and only disposes the connection.

public void Disconnect()
        {
            try
            {
                if (consumer != null)
                {
                    consumer.Close();
                    consumer.Dispose();
                }

                if (session != null)
                {
                    session.Close();
                    session.Dispose();
                }

                if (connection != null)
                {
                    connection.Dispose();
                }

            }
            catch (Exception ex)
            {
                Console.WriteLine("ERROR DISCONNECTING: " + ex.StackTrace);
            }
        }


FYI I'm using ActiveMQ 4.1.1 and have tried this with the latest NMS code
from Subversion.



Dris wrote:
> 
> Can you post a piece of code like the one in your original post, but
> including your cleanup code (I can't see the calls to dispose etc. in the
> original post). I will compile it and run it on my set up (4.1.1 + some
> fairly recent version of NMS) and see what happens. 
> 
> Chris
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Orphan-connections-from-.NET-clients-tf3879502s2354.html#a11301140
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to