internal static AmDbStatusInfo2 GetServerForDatabase(Guid mdbGuid) { AmConfig config = AmSystemManager.Instance.Config; if (config.IsUnknown) { AmTrace.Error("GetSFD: Invalid configuration (db={0})", new object[] { mdbGuid }); throw new AmInvalidConfiguration(config.LastError); } AmDbStateInfo stateInfo = config.DbState.Read(mdbGuid); return(AmServerDbStatusInfoCache.ConvertToDbStatusInfo(stateInfo)); }
internal AmDbStatusInfo2 GetEntry(Guid databaseGuid) { AmConfig config = AmSystemManager.Instance.Config; if (config.IsUnknown) { AmTrace.Error("GetSFD: Invalid configuration (db={0})", new object[] { databaseGuid }); throw new AmInvalidConfiguration(config.LastError); } string text = config.DbState.ReadStateString(databaseGuid); AmServerDbStatusInfoCache.StringStatusInfoPair stringStatusInfoPair = null; AmDbStatusInfo2 amDbStatusInfo = null; lock (this.m_locker) { this.m_cacheMap.TryGetValue(databaseGuid, out stringStatusInfoPair); } if (stringStatusInfoPair != null && text != null && string.Equals(text, stringStatusInfoPair.RawStateString)) { amDbStatusInfo = stringStatusInfoPair.StatusInfo; } else { AmDbStateInfo stateInfo = AmDbStateInfo.Parse(databaseGuid, text); amDbStatusInfo = AmServerDbStatusInfoCache.ConvertToDbStatusInfo(stateInfo); stringStatusInfoPair = new AmServerDbStatusInfoCache.StringStatusInfoPair(text, amDbStatusInfo); lock (this.m_locker) { AmTrace.Debug("Updating cache for database {0}.", new object[] { databaseGuid }); this.m_cacheMap[databaseGuid] = stringStatusInfoPair; } } return(amDbStatusInfo); }