示例#1
0
 internal bool ResolveRoute(IRoutingKey routingKey, IRouteSelectorDiagnostics diagnostics, out IRoutingEntry foundEntry, out IList <IRoutingEntry> routingEntries)
 {
     routingEntries = new List <IRoutingEntry>();
     for (int i = 0; i < 5; i++)
     {
         diagnostics.ProcessRoutingKey(routingKey);
         IRoutingEntry routingEntry = ServerLocator.GetRoutingEntry(routingKey, this.sharedCacheLookupFactory, diagnostics);
         if (routingEntry != null)
         {
             diagnostics.ProcessRoutingEntry(routingEntry);
         }
         if (routingEntry == null)
         {
             routingEntry = ServerLocator.GetRoutingEntry(routingKey, this.locatorServiceLookupFactory, diagnostics);
             if (routingEntry != null)
             {
                 if (ServerLocator.IsMailboxServerCacheKey(routingEntry.Key) && !this.mailboxServerCacheClient.AddEntry(routingEntry))
                 {
                     string value = string.Format("[ServerLocator::ResolveRoute]: RoutingEntry returned from MBLS could not be added to MailboxServer cache: {0}", routingEntry);
                     diagnostics.AddErrorInfo(value);
                 }
                 if (ServerLocator.IsAnchorMailboxCacheKey(routingEntry.Key) && !this.anchorMailboxCacheClient.AddEntry(routingEntry))
                 {
                     string value2 = string.Format("[ServerLocator::ResolveRoute]: RoutingEntry returned from MBLS could not be added to AnchorMailbox cache: {0}", routingEntry);
                     diagnostics.AddErrorInfo(value2);
                 }
             }
             else
             {
                 string value3 = string.Format("[ServerLocator::ResolveRoute]: MBLS could not find entry for key {0}", routingKey);
                 diagnostics.AddErrorInfo(value3);
             }
         }
         if (routingEntry == null)
         {
             break;
         }
         routingEntries.Add(routingEntry);
         string text = ServerLocator.OrganizationNameForLogging(routingEntry.Key);
         if (!string.IsNullOrEmpty(text))
         {
             diagnostics.SetOrganization(text);
         }
         IRoutingKey routingKey2 = routingEntry.Destination.CreateRoutingKey();
         if (routingKey2 == null)
         {
             foundEntry = routingEntry;
             return(true);
         }
         routingKey = routingKey2;
     }
     foundEntry = null;
     return(false);
 }
 public void ProcessRoutingKey(IRoutingKey key)
 {
     if (ServerLocator.IsMailboxServerCacheKey(key))
     {
         PerfCounters.HttpProxyCacheCountersInstance.BackEndServerOverallCacheHitsRateBase.Increment();
         PerfCounters.IncrementMovingPercentagePerformanceCounterBase(PerfCounters.HttpProxyCacheCountersInstance.MovingPercentageBackEndServerOverallCacheHitsRate);
     }
     if (ServerLocator.IsAnchorMailboxCacheKey(key))
     {
         PerfCounters.HttpProxyCacheCountersInstance.OverallCacheEffectivenessRateBase.Increment();
         PerfCounters.HttpProxyCacheCountersInstance.AnchorMailboxOverallCacheHitsRateBase.Increment();
     }
 }
 public void ProcessRoutingEntry(IRoutingEntry entry)
 {
     if (ServerLocator.IsMailboxServerCacheKey(entry.Key))
     {
         PerfCounters.HttpProxyCacheCountersInstance.BackEndServerOverallCacheHitsRate.Increment();
         PerfCounters.UpdateMovingPercentagePerformanceCounter(PerfCounters.HttpProxyCacheCountersInstance.MovingPercentageBackEndServerOverallCacheHitsRate);
         return;
     }
     if (ServerLocator.IsAnchorMailboxCacheKey(entry.Key))
     {
         PerfCounters.HttpProxyCacheCountersInstance.AnchorMailboxOverallCacheHitsRate.Increment();
         PerfCounters.HttpProxyCacheCountersInstance.OverallCacheEffectivenessRate.Increment();
     }
 }