Exemplo n.º 1
0
        /// <summary>
        /// new
        /// </summary>
        /// <param name="zk"></param>
        /// <param name="path"></param>
        /// <param name="callback"></param>
        /// <exception cref="ArgumentNullException">zk is null.</exception>
        /// <exception cref="ArgumentNullException">callback is null.</exception>
        public ChildrenWatcher(IZookClient zk, string path, Action<string[]> callback)
        {
            if (zk == null) throw new ArgumentNullException("zk");
            if (callback == null) throw new ArgumentNullException("callback");

            this._zk = zk;
            this._path = path;
            this._callback = callback;

            this._wrapper = new WatcherWrapper(_ => { if (!this._isStop) this.ListChildren(); });
            this._zk.KeeperStateChanged += this.KeeperStateChanged;

            this.ListChildren();
        }
Exemplo n.º 2
0
        /// <summary>
        /// new
        /// </summary>
        /// <param name="zk"></param>
        /// <param name="path"></param>
        /// <param name="callback"></param>
        /// <exception cref="ArgumentNullException">zk is null.</exception>
        /// <exception cref="ArgumentNullException">callback is null.</exception>
        public ChildrenWatcher(IZookClient zk, string path, Action <string[]> callback)
        {
            if (zk == null)
            {
                throw new ArgumentNullException("zk");
            }
            if (callback == null)
            {
                throw new ArgumentNullException("callback");
            }

            this._zk       = zk;
            this._path     = path;
            this._callback = callback;

            this._wrapper = new WatcherWrapper(_ => { if (!this._isStop)
                                                      {
                                                          this.ListChildren();
                                                      }
                                               });
            this._zk.KeeperStateChanged += this.KeeperStateChanged;

            this.ListChildren();
        }