Ejemplo n.º 1
0
        private void InitDisposableMembers()
        {
            bool dispose = true;

            try {
                _cacheMemoryMonitor = new CacheMemoryMonitor(_memoryCache, _configCacheMemoryLimitMegabytes);
                _timer  = new Timer(new TimerCallback(CacheManagerTimerCallback), null, _configPollingInterval, _configPollingInterval);
                dispose = false;
            }
            finally {
                if (dispose)
                {
                    Dispose();
                }
            }
        }
Ejemplo n.º 2
0
        private void InitDisposableMembers()
        {
            bool flag = true;

            try
            {
                this._cacheMemoryMonitor = new CacheMemoryMonitor(this._memoryCache, this._configCacheMemoryLimitMegabytes);
                this._timer = new Timer(new TimerCallback(this.CacheManagerTimerCallback), null, this._configPollingInterval, this._configPollingInterval);
                flag        = false;
            }
            finally
            {
                if (flag)
                {
                    this.Dispose();
                }
            }
        }
Ejemplo n.º 3
0
        private void InitDisposableMembers()
        {
            bool dispose = true;

            try
            {
                _cacheMemoryMonitor = new CacheMemoryMonitor(_memoryCache, _configCacheMemoryLimitMegabytes);
                Timer timer;
                // Don't capture the current ExecutionContext and its AsyncLocals onto the timer causing them to live forever
                bool restoreFlow = false;
                try
                {
                    if (!ExecutionContext.IsFlowSuppressed())
                    {
                        ExecutionContext.SuppressFlow();
                        restoreFlow = true;
                    }

                    timer = new Timer(new TimerCallback(CacheManagerTimerCallback), null, _configPollingInterval, _configPollingInterval);
                }
                finally
                {
                    // Restore the current ExecutionContext
                    if (restoreFlow)
                    {
                        ExecutionContext.RestoreFlow();
                    }
                }

                _timerHandleRef = new GCHandleRef <Timer>(timer);
                dispose         = false;
            }
            finally
            {
                if (dispose)
                {
                    Dispose();
                }
            }
        }
 private void InitDisposableMembers() {
     bool dispose = true;
     try {
         _cacheMemoryMonitor = new CacheMemoryMonitor(_memoryCache, _configCacheMemoryLimitMegabytes);
         _timer = new Timer(new TimerCallback(CacheManagerTimerCallback), null, _configPollingInterval, _configPollingInterval);
         dispose = false;
     }
     finally {
         if (dispose) {
             Dispose();
         }
     }
 }
 private void InitDisposableMembers()
 {
     bool flag = true;
     try
     {
         this._cacheMemoryMonitor = new CacheMemoryMonitor(this._memoryCache, this._configCacheMemoryLimitMegabytes);
         this._timer = new Timer(new TimerCallback(this.CacheManagerTimerCallback), null, this._configPollingInterval, this._configPollingInterval);
         flag = false;
     }
     finally
     {
         if (flag)
         {
             this.Dispose();
         }
     }
 }