Exemplo n.º 1
0
        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or
        /// resetting unmanaged resources.
        /// </summary>
        /// <param name="disposing"></param>
        private void Dispose(bool disposing)
        {
            lock (this)
            {
                if (SerializationContext != null)
                {
                    CompactFormatterServices.UnregisterAllCustomCompactTypes(SerializationContext);
                }


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

                if (ExpiryMgr != null)
                {
                    ExpiryMgr.Dispose();
                    ExpiryMgr = null;
                }
                if (MessageManager != null)
                {
                    MessageManager.StopMessageProcessing();
                    MessageManager = null;
                }
                if (CacheImpl != null)
                {
                    CacheImpl.Dispose();
                    CacheImpl = null;
                }
                if (TimeSched != null)
                {
                    TimeSched.Dispose();
                    TimeSched = null;
                }
                if (AsyncProc != null)
                {
                    AsyncProc.Stop();
                    AsyncProc = null;
                }

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

                if (disposing)
                {
                    GC.SuppressFinalize(this);
                }
            }
        }