/// <summary> /// For the new Configuration Record Table, compare it to the Global Configuration Record Table (this) /// add, delete or replace configuration records and update the application monitor referencing the records. /// /// NOTE: If this function throws an exception we have to kill the application because we will have an /// inconsistent configuration. /// </summary> /// <param name="ActivateProcessList"></param> private void Update( Hashtable configNew) { // First iteration adds / changes configuration records to the Global Configuration Record Table foreach (DictionaryEntry d in configNew) { ConfigurationRecord newcfr = ((ConfigurationRecord)(d.Value)); // If there is old configuration record then remove it because it will be replaced with new one ConfigurationRecord oldcfr = GetConfigRec(newcfr.m_sqlServer, newcfr.m_database, newcfr.m_schema, newcfr.m_queue); if (oldcfr != null) { RemoveFrom(oldcfr); } AddTo(newcfr); Global.AppMonitorMgr.InsertOrUpdate(newcfr); } // Second iteration deletes configuration records ArrayList listToDelete = new ArrayList(); foreach (DictionaryEntry d in m_configRT) { ConfigurationRecord oldcfr = ((ConfigurationRecord)(d.Value)); // New Configuration Record Table does NOT contain the entry string key = GetKey(oldcfr); if (!configNew.Contains(key)) { listToDelete.Add(oldcfr); } } foreach (ConfigurationRecord oldcfr in listToDelete) { // Add to the list to remove from the Global Configuration Record Table RemoveFrom(oldcfr); ApplicationMonitor am = Global.AppMonitorMgr.GetApplicationMonitor(oldcfr.m_sqlServer, oldcfr.m_database, oldcfr.m_schema, oldcfr.m_queue); if (am != null) { am.ResetConfig(); } } }