Exemple #1
0
            private bool AlertProxyMonitors(long current, long limit, RecycleLimitNotificationFrequency frequency)
            {
                bool requestGC = false;

                KeyValuePair <RecycleLimitMonitor, string>[] proxies = null;

                lock (this) {
                    if (_proxyMonitors.Count == 0)
                    {
                        StopTimer();
                        return(requestGC);
                    }

                    proxies = _proxyMonitors.ToArray <KeyValuePair <RecycleLimitMonitor, string> >();
                }

                foreach (KeyValuePair <RecycleLimitMonitor, string> pair in proxies)
                {
                    try {
                        var ac = _appManager.GetLockableAppDomainContext(pair.Value);
                        if (ac != null)
                        {
                            lock (ac) {
                                requestGC |= pair.Key.RaiseRecycleLimitEvent(current, limit, frequency);
                            }
                        }
                    }
                    catch (Exception e) {
                        // Unhandled Exceptions here will crash the process
                        Misc.ReportUnhandledException(e, new string[] { SR.GetString(SR.Unhandled_Monitor_Exception, "RaiseRecycleLimitEvent", "RecycleLimitMonitor") });
                    }
                }

                return(requestGC);
            }