protected override AnchorMailboxCacheEntry RefreshCacheEntry()
        {
            IConfigurationSession session = DirectoryHelper.GetConfigurationSession();

            MailboxDatabase[] array = DirectoryHelper.InvokeResourceForest(base.RequestContext.LatencyTracker, () => session.Find <MailboxDatabase>(session.GetExchangeConfigurationContainer().Id, QueryScope.SubTree, new ComparisonFilter(ComparisonOperator.Equal, DatabaseSchema.Name, this.DatabaseName), null, 1));
            if (array.Length == 0)
            {
                base.CheckForNullAndThrowIfApplicable <ADObjectId>(null);
                return(new AnchorMailboxCacheEntry());
            }
            return(new AnchorMailboxCacheEntry
            {
                Database = array[0].Id
            });
        }
        // Token: 0x06000103 RID: 259 RVA: 0x000063A8 File Offset: 0x000045A8
        protected override AnchorMailboxCacheEntry RefreshCacheEntry()
        {
            IConfigurationSession session = DirectoryHelper.GetConfigurationSession();

            MailboxDatabase[] array = DirectoryHelper.InvokeResourceForest(base.RequestContext.LatencyTracker, () => session.Find <MailboxDatabase>(session.GetExchangeConfigurationContainer("d:\\dbs\\sh\\e16df\\0212_214120_0\\cmd\\1g\\sources\\Dev\\Cafe\\src\\HttpProxy\\AnchorMailbox\\DatabaseNameAnchorMailbox.cs", 63, "RefreshCacheEntry").Id, 2, new ComparisonFilter(0, DatabaseSchema.Name, this.DatabaseName), null, 1, "d:\\dbs\\sh\\e16df\\0212_214120_0\\cmd\\1g\\sources\\Dev\\Cafe\\src\\HttpProxy\\AnchorMailbox\\DatabaseNameAnchorMailbox.cs", 62, "RefreshCacheEntry"), base.RequestContext.Logger, session);
            if (array.Length == 0)
            {
                base.CheckForNullAndThrowIfApplicable <ADObjectId>(null);
                return(new AnchorMailboxCacheEntry());
            }
            return(new AnchorMailboxCacheEntry
            {
                Database = array[0].Id
            });
        }
Example #3
0
        private void InternalRefresh()
        {
            Exception ex = null;

            Server[] array = null;
            try
            {
                ITopologyConfigurationSession configurationSession = DirectoryHelper.GetConfigurationSession();
                ADPagedReader <Server>        adpagedReader        = configurationSession.FindPaged <Server>(null, QueryScope.SubTree, DownLevelServerManager.ServerVersionFilter, null, 0);
                array = adpagedReader.ReadAllPages();
            }
            catch (ADTransientException ex2)
            {
                ex = ex2;
            }
            catch (DataValidationException ex3)
            {
                ex = ex3;
            }
            catch (DataSourceOperationException ex4)
            {
                ex = ex4;
            }
            if (ex != null)
            {
                ExTraceGlobals.VerboseTracer.TraceError <Exception>((long)this.GetHashCode(), "[DownLevelServerManager::RefreshServerMap]: Active Directory exception: {0}", ex);
                Diagnostics.Logger.LogEvent(FrontEndHttpProxyEventLogConstants.Tuple_ErrorRefreshDownLevelServerMap, null, new object[]
                {
                    HttpProxyGlobals.ProtocolType.ToString(),
                    ex.ToString()
                });
                return;
            }
            Dictionary <string, List <DownLevelServerStatusEntry> > downLevelServerMap = this.GetDownLevelServerMap();
            Dictionary <string, List <DownLevelServerStatusEntry> > dictionary         = new Dictionary <string, List <DownLevelServerStatusEntry> >(downLevelServerMap.Count, StringComparer.OrdinalIgnoreCase);

            Server[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                Server server = array2[i];
                if ((server.CurrentServerRole & ServerRole.ClientAccess) > ServerRole.None && server.ServerSite != null)
                {
                    List <DownLevelServerStatusEntry> list = null;
                    if (!dictionary.TryGetValue(server.ServerSite.DistinguishedName, out list))
                    {
                        list = new List <DownLevelServerStatusEntry>();
                        dictionary.Add(server.ServerSite.DistinguishedName, list);
                    }
                    DownLevelServerStatusEntry        downLevelServerStatusEntry = null;
                    List <DownLevelServerStatusEntry> list2 = null;
                    if (downLevelServerMap.TryGetValue(server.ServerSite.DistinguishedName, out list2))
                    {
                        downLevelServerStatusEntry = list2.Find((DownLevelServerStatusEntry x) => x.BackEndServer.Fqdn.Equals(server.Fqdn, StringComparison.OrdinalIgnoreCase));
                    }
                    if (downLevelServerStatusEntry == null)
                    {
                        downLevelServerStatusEntry = new DownLevelServerStatusEntry
                        {
                            BackEndServer = new BackEndServer(server.Fqdn, server.VersionNumber),
                            IsHealthy     = true
                        };
                    }
                    list.Add(downLevelServerStatusEntry);
                    list.Sort((DownLevelServerStatusEntry x, DownLevelServerStatusEntry y) => x.BackEndServer.Fqdn.CompareTo(y.BackEndServer.Fqdn));
                }
            }
            this.downLevelServers = dictionary;
            if (dictionary.Count > 0 && DownLevelServerManager.DownLevelServerPingEnabled.Value && this.pingManager == null)
            {
                this.pingManager = new DownLevelServerPingManager(new Func <Dictionary <string, List <DownLevelServerStatusEntry> > >(this.GetDownLevelServerMap));
            }
        }
        // Token: 0x060001F5 RID: 501 RVA: 0x00009C6C File Offset: 0x00007E6C
        private void InternalRefresh()
        {
            Exception ex = null;

            Server[] array = null;
            try
            {
                array = DirectoryHelper.GetConfigurationSession().FindPaged <Server>(null, 2, DownLevelServerManager.ServerVersionFilter, null, 0, "d:\\dbs\\sh\\e16df\\0212_214120_0\\cmd\\1g\\sources\\Dev\\Cafe\\src\\HttpProxy\\DownLevelServerManager\\DownLevelServerManager.cs", 910, "InternalRefresh").ReadAllPages();
            }
            catch (ADTransientException ex)
            {
            }
            catch (DataValidationException ex)
            {
            }
            catch (DataSourceOperationException ex)
            {
            }
            if (ex != null)
            {
                if (ExTraceGlobals.VerboseTracer.IsTraceEnabled(3))
                {
                    ExTraceGlobals.VerboseTracer.TraceError <Exception>((long)this.GetHashCode(), "[DownLevelServerManager::RefreshServerMap]: Active Directory exception: {0}", ex);
                }
                Diagnostics.Logger.LogEvent(FrontEndHttpProxyEventLogConstants.Tuple_ErrorRefreshDownLevelServerMap, null, new object[]
                {
                    HttpProxyGlobals.ProtocolType.ToString(),
                    ex.ToString()
                });
                return;
            }
            Dictionary <string, List <DownLevelServerStatusEntry> > downLevelServerMap = this.GetDownLevelServerMap();
            Dictionary <string, List <DownLevelServerStatusEntry> > dictionary         = new Dictionary <string, List <DownLevelServerStatusEntry> >(downLevelServerMap.Count, StringComparer.OrdinalIgnoreCase);

            Server[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                Server server = array2[i];
                if ((server.CurrentServerRole & 4) > 0 && server.ServerSite != null)
                {
                    List <DownLevelServerStatusEntry> list = null;
                    if (!dictionary.TryGetValue(server.ServerSite.DistinguishedName, out list))
                    {
                        list = new List <DownLevelServerStatusEntry>();
                        dictionary.Add(server.ServerSite.DistinguishedName, list);
                    }
                    DownLevelServerStatusEntry        downLevelServerStatusEntry = null;
                    List <DownLevelServerStatusEntry> list2 = null;
                    if (downLevelServerMap.TryGetValue(server.ServerSite.DistinguishedName, out list2))
                    {
                        downLevelServerStatusEntry = list2.Find((DownLevelServerStatusEntry x) => x.BackEndServer.Fqdn.Equals(server.Fqdn, StringComparison.OrdinalIgnoreCase));
                    }
                    if (downLevelServerStatusEntry == null)
                    {
                        downLevelServerStatusEntry = new DownLevelServerStatusEntry
                        {
                            BackEndServer = new BackEndServer(server.Fqdn, server.VersionNumber),
                            IsHealthy     = true
                        };
                    }
                    list.Add(downLevelServerStatusEntry);
                    list.Sort((DownLevelServerStatusEntry x, DownLevelServerStatusEntry y) => x.BackEndServer.Fqdn.CompareTo(y.BackEndServer.Fqdn));
                }
            }
            this.downLevelServers = dictionary;
            if (dictionary.Count > 0 && DownLevelServerManager.DownLevelServerPingEnabled.Value && this.pingManager == null)
            {
                this.pingManager = new DownLevelServerPingManager(new Func <Dictionary <string, List <DownLevelServerStatusEntry> > >(this.GetDownLevelServerMap));
            }
        }