/// <summary> /// Checks to see if deployment configuration has changed, by adding or removing silos. /// If so, it updates the list of all silo names and creates a new resource balancer. /// This should occure rarely. /// </summary> private BestFitBalancer <string, QueueId> GetBalancer() { var allSiloNames = deploymentConfig.GetAllSiloInstanceNames(); // rebuild balancer with new list of instance names return(new BestFitBalancer <string, QueueId>(allSiloNames, allQueues)); }
/// <summary> /// Called when the status of a silo in the cluster changes. /// - Update list of silos if silos have been added or removed from the deployment /// - Update the list of active silos /// - Notify listeners if necessary /// </summary> /// <param name="updatedSilo">Silo which status has changed</param> /// <param name="status">new silo status</param> public void SiloStatusChangeNotification(SiloAddress updatedSilo, SiloStatus status) { bool changed = false; var newSiloNames = deploymentConfig.GetAllSiloInstanceNames(); lock (activeSiloNames) { // if silo names has changed, deployment has been changed so we need to update silo names changed |= UpdateAllSiloNames(newSiloNames); // if a silo status has changed, update list of active silos changed |= UpdateActiveSilos(updatedSilo, status); } // if no change, don't notify if (changed) { NotifyListeners().Ignore(); } }