/* * Shutdown all dependency monitoring and firing of OnChanged notification. */ internal void DisposeInternal() { if (SetBit(DISPOSED)) { if (_filenames != null) { FileChangesMonitor fmon = HttpRuntime.FileChangesMonitor; string oneFilename = _filenames as string; if (oneFilename != null) { fmon.StopMonitoringPath(oneFilename, this); } else { string[] filenames = (string[])_filenames; foreach (string filename in filenames) { // ensure that we handle partially contructed // objects by checking filename for null if (filename != null) { fmon.StopMonitoringPath(filename, this); } } } } if (_entries != null) { CacheEntry oneEntry = _entries as CacheEntry; if (oneEntry != null) { oneEntry.RemoveCacheDependencyNotify(this); } else { CacheEntry[] entries = (CacheEntry[])_entries; foreach (CacheEntry entry in entries) { // ensure that we handle partially contructed // objects by checking entry for null if (entry != null) { entry.RemoveCacheDependencyNotify(this); } } } } _entryNotify = null; } }
private void DisposeOurself() { object obj2 = this._depFileInfos; object obj3 = this._entries; this._objNotify = null; this._depFileInfos = null; this._entries = null; if (obj2 != null) { FileChangesMonitor fileChangesMonitor = HttpRuntime.FileChangesMonitor; DepFileInfo info = obj2 as DepFileInfo; if (info != null) { fileChangesMonitor.StopMonitoringPath(info._filename, this); } else { DepFileInfo[] infoArray = (DepFileInfo[])obj2; foreach (DepFileInfo info2 in infoArray) { string alias = info2._filename; if (alias != null) { fileChangesMonitor.StopMonitoringPath(alias, this); } } } } if (obj3 != null) { CacheEntry entry = obj3 as CacheEntry; if (entry != null) { entry.RemoveCacheDependencyNotify(this); } else { CacheEntry[] entryArray = (CacheEntry[])obj3; foreach (CacheEntry entry2 in entryArray) { if (entry2 != null) { entry2.RemoveCacheDependencyNotify(this); } } } } }
void DisposeOurself() { // guarantee that we execute only once if an exception // is thrown from this function by nulling fields before // we access them object l_depFileInfos = _depFileInfos; object l_entries = _entries; _objNotify = null; _depFileInfos = null; _entries = null; // stop monitoring files if (l_depFileInfos != null) { FileChangesMonitor fmon = HttpRuntime.FileChangesMonitor; DepFileInfo oneDepFileInfo = l_depFileInfos as DepFileInfo; if (oneDepFileInfo != null) { fmon.StopMonitoringPath(oneDepFileInfo._filename, this); } else { DepFileInfo[] depFileInfos = (DepFileInfo[])l_depFileInfos; foreach (DepFileInfo depFileInfo in depFileInfos) { // ensure that we handle partially contructed // objects by checking filename for null string filename = depFileInfo._filename; if (filename != null) { fmon.StopMonitoringPath(filename, this); } } } } // stop monitoring cache items if (l_entries != null) { DepCacheInfo oneEntry = l_entries as DepCacheInfo; if (oneEntry != null) { oneEntry._cacheStore.RemoveDependent(oneEntry._key, this); } else { DepCacheInfo[] entries = (DepCacheInfo[])l_entries; foreach (DepCacheInfo entry in entries) { // ensure that we handle partially contructed // objects by checking entry for null if (entry != null) { entry._cacheStore.RemoveDependent(entry._key, this); } } } } #if USE_MEMORY_CACHE if (_fileChangeMonitor != null) { _fileChangeMonitor.Dispose(); } if (_entryChangeMonitor != null) { _entryChangeMonitor.Dispose(); } #endif }