private HeatMapCapacityData GetServerCapacityDatum(DirectoryIdentity objectIdentity, bool refreshData, DirectoryIdentity localServerIdentity) { if (objectIdentity.Equals(localServerIdentity)) { return(this.serviceContext.LocalServerHeatMap.ToCapacityData()); } DirectoryServer server = (DirectoryServer)this.serviceContext.Directory.GetDirectoryObject(objectIdentity); HeatMapCapacityData capacitySummary; using (ILoadBalanceService loadBalanceClientForServer = this.serviceContext.ClientFactory.GetLoadBalanceClientForServer(server, false)) { capacitySummary = loadBalanceClientForServer.GetCapacitySummary(objectIdentity, refreshData); } return(capacitySummary); }
private HeatMapCapacityData GetDatabaseCapacityDatum(DirectoryIdentity objectIdentity, bool refreshData, DirectoryIdentity localServerIdentity) { DirectoryDatabase directoryDatabase = (DirectoryDatabase)this.serviceContext.Directory.GetDirectoryObject(objectIdentity); DirectoryServer directoryServer = directoryDatabase.ActivationOrder.FirstOrDefault <DirectoryServer>(); if (directoryServer == null || localServerIdentity.Equals(directoryServer.Identity)) { TopologyExtractorFactoryContext topologyExtractorFactoryContext = this.serviceContext.GetTopologyExtractorFactoryContext(); TopologyExtractorFactory loadBalancingLocalFactory = topologyExtractorFactoryContext.GetLoadBalancingLocalFactory(refreshData); LoadContainer loadContainer = loadBalancingLocalFactory.GetExtractor(directoryDatabase).ExtractTopology(); return(loadContainer.ToCapacityData()); } HeatMapCapacityData capacitySummary; using (ILoadBalanceService loadBalanceClientForDatabase = this.serviceContext.ClientFactory.GetLoadBalanceClientForDatabase(directoryDatabase)) { capacitySummary = loadBalanceClientForDatabase.GetCapacitySummary(objectIdentity, refreshData); } return(capacitySummary); }