예제 #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._watcher = new WatcherAction(_ => this.ListChildren());
            this._zk.KeeperStateChanged += this.KeeperStateChanged;

            this.ListChildren();
        }
예제 #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._watcher = new WatcherAction(_ => this.ListChildren());
            this._zk.KeeperStateChanged += this.KeeperStateChanged;

            this.ListChildren();
        }