/// <summary> /// Executes in two distinct scenarios. /// /// 1. If disposing is true, the method has been called directly /// or indirectly by a user's code via the Dispose method. /// Both managed and unmanaged resources can be disposed. /// /// 2. If disposing is false, the method has been called by the /// runtime from inside the finalizer and you should not reference (access) /// other managed objects, as they already have been garbage collected. /// Only unmanaged resources can be disposed. /// </summary> /// <param name="disposing"></param> /// <remarks> /// If any exceptions are thrown, that is fine. /// If the method is being done in a finalizer, it will be ignored. /// If it is thrown by client code calling Dispose, /// it needs to be handled by fixing the bug. /// /// If subclasses override this method, they should call the base implementation. /// </remarks> private void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (m_isDisposed) { return; } if (disposing) { if (m_wsCache != null) { m_wsCache.Clear(); } if (m_delayedAtomicReferences != null) { m_delayedAtomicReferences.Clear(); } if (m_delayedVecterReferences != null) { m_delayedVecterReferences.Clear(); } if (m_cachedFlids != null) { m_cachedFlids.Clear(); } if (m_tsf != null) { m_tsf.Dispose(); } } // Dispose unmanaged resources here, whether disposing is true or false. if (m_itsf != null) { if (Marshal.IsComObject(m_itsf)) { Marshal.ReleaseComObject(m_itsf); } m_itsf = null; } m_tsf = null; m_metaDataCache = null; m_realDataCache = null; m_wsCache = null; m_delayedAtomicReferences = null; m_delayedVecterReferences = null; m_cachedFlids = null; m_isDisposed = true; }
/// <summary> /// Executes in two distinct scenarios. /// /// 1. If disposing is true, the method has been called directly /// or indirectly by a user's code via the Dispose method. /// Both managed and unmanaged resources can be disposed. /// /// 2. If disposing is false, the method has been called by the /// runtime from inside the finalizer and you should not reference (access) /// other managed objects, as they already have been garbage collected. /// Only unmanaged resources can be disposed. /// </summary> /// <param name="disposing"></param> /// <remarks> /// If any exceptions are thrown, that is fine. /// If the method is being done in a finalizer, it will be ignored. /// If it is thrown by client code calling Dispose, /// it needs to be handled by fixing the bug. /// /// If subclasses override this method, they should call the base implementation. /// </remarks> private void Dispose(bool disposing) { System.Diagnostics.Debug.WriteLineIf(!disposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** "); // Must not be run more than once. if (m_isDisposed) { return; } if (disposing) { if (m_wsCache != null) { m_wsCache.Clear(); } if (m_delayedAtomicReferences != null) { m_delayedAtomicReferences.Clear(); } if (m_delayedVecterReferences != null) { m_delayedVecterReferences.Clear(); } if (m_cachedFlids != null) { m_cachedFlids.Clear(); } if (m_realDataCache != null) { m_realDataCache.Dispose(); } } // Dispose unmanaged resources here, whether disposing is true or false. m_tsf = null; m_metaDataCache = null; m_realDataCache = null; m_wsCache = null; m_delayedAtomicReferences = null; m_delayedVecterReferences = null; m_cachedFlids = null; m_isDisposed = true; }
/// <summary> /// Constructor. /// </summary> public RealCacheLoader() { m_tsf = new TsStringfactory(m_itsf, m_wsCache); }
/// <summary> /// Executes in two distinct scenarios. /// /// 1. If disposing is true, the method has been called directly /// or indirectly by a user's code via the Dispose method. /// Both managed and unmanaged resources can be disposed. /// /// 2. If disposing is false, the method has been called by the /// runtime from inside the finalizer and you should not reference (access) /// other managed objects, as they already have been garbage collected. /// Only unmanaged resources can be disposed. /// </summary> /// <param name="disposing"></param> /// <remarks> /// If any exceptions are thrown, that is fine. /// If the method is being done in a finalizer, it will be ignored. /// If it is thrown by client code calling Dispose, /// it needs to be handled by fixing the bug. /// /// If subclasses override this method, they should call the base implementation. /// </remarks> private void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (m_isDisposed) return; if (disposing) { if (m_wsCache != null) m_wsCache.Clear(); if (m_delayedAtomicReferences != null) m_delayedAtomicReferences.Clear(); if (m_delayedVecterReferences != null) m_delayedVecterReferences.Clear(); if (m_cachedFlids != null) m_cachedFlids.Clear(); if (m_tsf != null) m_tsf.Dispose(); } // Dispose unmanaged resources here, whether disposing is true or false. if (m_itsf != null) { if (Marshal.IsComObject(m_itsf)) Marshal.ReleaseComObject(m_itsf); m_itsf = null; } m_tsf = null; m_metaDataCache = null; m_realDataCache = null; m_wsCache = null; m_delayedAtomicReferences = null; m_delayedVecterReferences = null; m_cachedFlids = null; m_isDisposed = true; }