コード例 #1
0
ファイル: AmDbState.cs プロジェクト: YHZX2013/exchange_diff
        internal bool Write(AmDbStateInfo state, bool isBestEffort)
        {
            bool result = false;

            try
            {
                ActiveManagerServerPerfmon.DatabaseStateInfoWrites.Increment();
                ActiveManagerServerPerfmon.DatabaseStateInfoWritesPerSec.Increment();
                this.WriteInternal(state.DatabaseGuid.ToString(), state.ToString(), state.ActiveServer);
                result = true;
            }
            catch (ClusterException ex)
            {
                AmTrace.Error("Attempt write persistent database state for Database '{0}' failed with error: {1}", new object[]
                {
                    state.DatabaseGuid,
                    ex
                });
                if (!isBestEffort)
                {
                    throw;
                }
            }
            return(result);
        }
コード例 #2
0
        // Token: 0x06000313 RID: 787 RVA: 0x00011B78 File Offset: 0x0000FD78
        internal static AmDbStateInfo ReplaceProperty(AmDbStateInfo oldStateInfo, AmDbStateInfo.PropertyNames propName, string propValue)
        {
            bool          isPropExist = false;
            string        str         = oldStateInfo.ToString();
            StringBuilder sb          = new StringBuilder(500);

            AmDbStateInfo.ParseNameValuePairs(str, delegate(string name, string value)
            {
                if (AmDbStateInfo.IsMatching(name, propName))
                {
                    if (!isPropExist)
                    {
                        AmDbStateInfo.AppendNameValue(sb, propName.ToString(), propValue);
                        isPropExist = true;
                        return;
                    }
                }
                else
                {
                    AmDbStateInfo.AppendNameValue(sb, name, value);
                }
            });
            if (!isPropExist)
            {
                AmDbStateInfo.AppendNameValue(sb, propName.ToString(), propValue);
            }
            return(AmDbStateInfo.Parse(oldStateInfo.DatabaseGuid, sb.ToString()));
        }