コード例 #1
0
        private void RefreshDatabase(DatabaseWithForest database)
        {
            ExTraceGlobals.VerboseTracer.TraceDebug <string>((long)this.GetHashCode(), "[MailboxServerCache::RefreshDatabase]: Refreshing cache for database {0}.", database.Database.ToString());
            Diagnostics.Logger.LogEvent(FrontEndHttpProxyEventLogConstants.Tuple_RefreshingDatabaseBackEndServer, null, new object[]
            {
                HttpProxyGlobals.ProtocolType,
                database.Database,
                database.ResourceForest
            });
            Dictionary <Guid, BackEndServer> dictionary = null;
            bool flag = true;

            try
            {
                using (MailboxServerLocator mailboxServerLocator = MailboxServerLocator.CreateWithResourceForestFqdn(database.Database, string.IsNullOrEmpty(database.ResourceForest) ? null : new Fqdn(database.ResourceForest)))
                {
                    PerfCounters.HttpProxyCountersInstance.MailboxServerLocatorCalls.Increment();
                    mailboxServerLocator.GetServer();
                    dictionary = mailboxServerLocator.AvailabilityGroupServers;
                    flag       = mailboxServerLocator.IsSourceCachedData;
                    PerfCounters.HttpProxyCountersInstance.MailboxServerLocatorLatency.RawValue = mailboxServerLocator.Latency;
                    PerfCounters.HttpProxyCountersInstance.MailboxServerLocatorAverageLatency.IncrementBy(mailboxServerLocator.Latency);
                    PerfCounters.HttpProxyCountersInstance.MailboxServerLocatorAverageLatencyBase.Increment();
                    PerfCounters.UpdateMovingAveragePerformanceCounter(PerfCounters.HttpProxyCountersInstance.MovingAverageMailboxServerLocatorLatency, mailboxServerLocator.Latency);
                    PerfCounters.IncrementMovingPercentagePerformanceCounterBase(PerfCounters.HttpProxyCountersInstance.MovingPercentageMailboxServerLocatorRetriedCalls);
                    if (mailboxServerLocator.LocatorServiceHosts.Length > 1)
                    {
                        PerfCounters.HttpProxyCountersInstance.MailboxServerLocatorRetriedCalls.Increment();
                        PerfCounters.UpdateMovingPercentagePerformanceCounter(PerfCounters.HttpProxyCountersInstance.MovingPercentageMailboxServerLocatorRetriedCalls);
                    }
                }
            }
            catch (Exception ex)
            {
                ExTraceGlobals.VerboseTracer.TraceError <Guid, string, Exception>((long)this.GetHashCode(), "[MailboxServerCache::CacheRefreshEntry]: MailboxServerLocator throws exception when locating database {0} in forest {1}. Error: {2}", database.Database, database.ResourceForest, ex);
                Diagnostics.Logger.LogEvent(FrontEndHttpProxyEventLogConstants.Tuple_ErrorRefreshingDatabaseBackEndServer, database.Database.ToString(), new object[]
                {
                    HttpProxyGlobals.ProtocolType,
                    database.Database,
                    database.ResourceForest,
                    ex.ToString()
                });
                if (ex is ServerLocatorClientException || ex is ServerLocatorClientTransientException || ex is MailboxServerLocatorException || ex is AmServerTransientException || ex is AmServerException)
                {
                    PerfCounters.HttpProxyCountersInstance.MailboxServerLocatorFailedCalls.Increment();
                    PerfCounters.UpdateMovingPercentagePerformanceCounter(PerfCounters.HttpProxyCountersInstance.MovingPercentageMailboxServerLocatorFailedCalls);
                }
                else if (!(ex is DatabaseNotFoundException) && !(ex is ADTransientException) && !(ex is DataValidationException) && !(ex is DataSourceOperationException))
                {
                    throw;
                }
            }
            if (dictionary != null)
            {
                this.PopulateCache(dictionary, database.ResourceForest, database.InitiatingRequestId, flag, this.AlwaysRefresh || !flag);
            }
        }
コード例 #2
0
 private void RegisterRefresh(DatabaseWithForest database)
 {
     lock (this.refreshLock)
     {
         ExTraceGlobals.VerboseTracer.TraceDebug <string>((long)this.GetHashCode(), "[MailboxServerCache::RegisterRefresh]: Enqueueing database {0}.", database.Database.ToString());
         this.refreshQueue.Enqueue(database);
         this.UpdateQueueLengthCounter();
         MailboxServerCache.refreshWorkerSignal.Set();
     }
 }
コード例 #3
0
        // Token: 0x06000246 RID: 582 RVA: 0x0000B4CC File Offset: 0x000096CC
        private void RefreshDatabase(DatabaseWithForest database)
        {
            if (ExTraceGlobals.VerboseTracer.IsTraceEnabled(1))
            {
                ExTraceGlobals.VerboseTracer.TraceDebug <string>((long)this.GetHashCode(), "[MailboxServerCache::RefreshDatabase]: Refreshing cache for database {0}.", database.Database.ToString());
            }
            Diagnostics.Logger.LogEvent(FrontEndHttpProxyEventLogConstants.Tuple_RefreshingDatabaseBackEndServer, null, new object[]
            {
                HttpProxyGlobals.ProtocolType,
                database.Database,
                database.ResourceForest
            });
            Dictionary <Guid, DatabaseToServerMappingInfo> dictionary = null;

            try
            {
                using (MailboxServerLocator mailboxServerLocator = MailboxServerLocator.Create(database.Database, null, database.ResourceForest, true, GuardedSlsExecution.MailboxServerLocatorCallbacks, null))
                {
                    PerfCounters.HttpProxyCountersInstance.MailboxServerLocatorCalls.Increment();
                    mailboxServerLocator.GetServer();
                    dictionary = mailboxServerLocator.AvailabilityGroupDatabaseToServerMappings;
                    bool isSourceCachedData = mailboxServerLocator.IsSourceCachedData;
                    PerfCounters.HttpProxyCountersInstance.MailboxServerLocatorLatency.RawValue = mailboxServerLocator.Latency;
                    PerfCounters.HttpProxyCountersInstance.MailboxServerLocatorAverageLatency.IncrementBy(mailboxServerLocator.Latency);
                    PerfCounters.HttpProxyCountersInstance.MailboxServerLocatorAverageLatencyBase.Increment();
                    PerfCounters.UpdateMovingAveragePerformanceCounter(PerfCounters.HttpProxyCountersInstance.MovingAverageMailboxServerLocatorLatency, mailboxServerLocator.Latency);
                    PerfCounters.IncrementMovingPercentagePerformanceCounterBase(PerfCounters.HttpProxyCountersInstance.MovingPercentageMailboxServerLocatorRetriedCalls);
                    if (mailboxServerLocator.LocatorServiceHosts.Length > 1)
                    {
                        PerfCounters.HttpProxyCountersInstance.MailboxServerLocatorRetriedCalls.Increment();
                        PerfCounters.UpdateMovingPercentagePerformanceCounter(PerfCounters.HttpProxyCountersInstance.MovingPercentageMailboxServerLocatorRetriedCalls);
                    }
                }
            }
            catch (Exception ex)
            {
                if (ExTraceGlobals.VerboseTracer.IsTraceEnabled(3))
                {
                    ExTraceGlobals.VerboseTracer.TraceError <Guid, string, Exception>((long)this.GetHashCode(), "[MailboxServerCache::RefreshDatabase]: MailboxServerLocator threw exception when locating database {0} in forest {1}. Error: {2}", database.Database, database.ResourceForest, ex);
                }
                Diagnostics.Logger.LogEvent(FrontEndHttpProxyEventLogConstants.Tuple_ErrorRefreshingDatabaseBackEndServer, database.Database.ToString(), new object[]
                {
                    HttpProxyGlobals.ProtocolType,
                    database.Database,
                    database.ResourceForest,
                    ex.ToString()
                });
                if (ex is ServerLocatorClientException || ex is ServerLocatorClientTransientException || ex is MailboxServerLocatorException || ex is AmServerTransientException || ex is AmServerException)
                {
                    PerfCounters.HttpProxyCountersInstance.MailboxServerLocatorFailedCalls.Increment();
                    PerfCounters.UpdateMovingPercentagePerformanceCounter(PerfCounters.HttpProxyCountersInstance.MovingPercentageMailboxServerLocatorFailedCalls);
                }
                else if (!(ex is DatabaseNotFoundException) && !(ex is ADTransientException) && !(ex is DataValidationException) && !(ex is DataSourceOperationException) && !(ex is DagDecomException))
                {
                    throw;
                }
            }
            if (dictionary != null)
            {
                this.PopulateCache(dictionary, database.ResourceForest);
            }
        }