Esempio n. 1
0
        private void UpdateData(Stat stat, string data, string path)
        {
            int version = stat.Version;

            byte[] configBytes = TextConvertor.GetBytesFromTextAscii(data);
            ZkActions.SetData(path, configBytes, version);
        }
        private void StressSetData()
        {
            DeletePreviousData();
            ZkActions.Create(Path, textConvertor.GetBytesFromTextAscii(STRESSING), Ids.OPEN_ACL_UNSAFE,
                             CreateMode.Persistent);
            string path = string.Concat(Path, "/", Thread.CurrentThread.Name);

            while (KeepRunning)
            {
                Stat stat = ZkActions.Exists(path, false);
                if (stat != null)
                {
                    int    version     = stat.Version;
                    byte[] configBytes = textConvertor.GetBytesFromTextAscii(STRESSING);
                    ZkActions.SetData(path, configBytes, version);
                }
                else
                {
                    ZkActions.Create(path, textConvertor.GetBytesFromTextAscii(STRESSING), Ids.OPEN_ACL_UNSAFE,
                                     CreateMode.Persistent);
                }
                Thread.Sleep(INTERVAL_IN_MILLISECONDS);
            }
        }