Ejemplo n.º 1
0
        internal static void RemoveEntryFromClusdb(string serverName, string actionName)
        {
            using (IClusterDB clusterDB = ClusterDB.Open())
            {
                string keyName = AmThrottledActionTracker <TData> .ConstructRegKeyName(serverName);

                clusterDB.DeleteValue(keyName, actionName);
            }
        }
Ejemplo n.º 2
0
        private void InitializeFromClusdbInternal()
        {
            AmConfig config = AmSystemManager.Instance.Config;

            if (config.IsPAM)
            {
                AmDagConfig dagConfig = config.DagConfig;
                using (IClusterDB clusterDB = ClusterDB.Open())
                {
                    foreach (AmServerName amServerName in dagConfig.MemberServers)
                    {
                        string keyName = AmThrottledActionTracker <TData> .ConstructRegKeyName(amServerName.NetbiosName);

                        string[] value = clusterDB.GetValue <string[]>(keyName, this.ActionName, null);
                        if (value != null && value.Length > 0)
                        {
                            LinkedList <TData> linkedList = new LinkedList <TData>();
                            foreach (string text in value)
                            {
                                int num = text.IndexOf('=');
                                if (num != -1)
                                {
                                    string s       = text.Substring(0, num);
                                    string dataStr = null;
                                    if (num < text.Length - 1)
                                    {
                                        dataStr = text.Substring(num + 1);
                                    }
                                    ExDateTime actionTime = ExDateTime.Parse(s);
                                    TData      value2     = Activator.CreateInstance <TData>();
                                    value2.Initialize(actionTime, dataStr);
                                    linkedList.AddFirst(value2);
                                }
                            }
                            this.actionHistory[amServerName] = linkedList;
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private void Persist(AmServerName node)
        {
            LinkedList <TData> linkedList;

            if (this.actionHistory.TryGetValue(node, out linkedList) && linkedList != null && linkedList.Count > 0)
            {
                using (IClusterDB clusterDB = ClusterDB.Open())
                {
                    List <string> list = new List <string>();
                    foreach (TData tdata in linkedList)
                    {
                        string arg     = tdata.Time.UniversalTime.ToString("o");
                        string dataStr = tdata.DataStr;
                        string item    = string.Format("{0}{1}{2}", arg, '=', dataStr);
                        list.Add(item);
                    }
                    string[] propetyValue = list.ToArray();
                    string   keyName      = AmThrottledActionTracker <TData> .ConstructRegKeyName(node.NetbiosName);

                    clusterDB.SetValue <string[]>(keyName, this.ActionName, propetyValue);
                }
            }
        }