{"action":"created","comment":{"url":"https://api.github.com/repos/line/armeria/pulls/comments/178244165","pull_request_review_id":108275797,"id":178244165,"diff_hunk":"@@ -67,58 +70,80 @@ public ZooKeeperEndpointGroup(String zkConnectionStr, String zNodePath, int sess\n      */\n     public ZooKeeperEndpointGroup(String zkConnectionStr, String zNodePath, int sessionTimeout,\n                                   NodeValueCodec nodeValueCodec) {\n-        zooKeeperConnector = new ZooKeeperConnector(zkConnectionStr, zNodePath, sessionTimeout,\n-                                                    createListener());\n+        checkArgument(!isNullOrEmpty(zNodePath), \"zNodePath\");\n+        checkArgument(sessionTimeout > 0, \"sessionTimeout: %s (expected: > 0)\",\n+                      sessionTimeout);\n         this.nodeValueCodec = requireNonNull(nodeValueCodec, \"nodeValueCodec\");\n-        zooKeeperConnector.connect();\n-    }\n-\n-    @Override\n-    public void close() {\n-        zooKeeperConnector.close(true);\n+        this.internalClient = true;\n+        this.client = CuratorFrameworkFactory.builder()\n+                                             .connectString(zkConnectionStr)\n+                                             .retryPolicy(Constants.DEFAULT_RETRY_POLICY)\n+                                             .sessionTimeoutMs(sessionTimeout)\n+                                             .build();\n+        client.start();\n+        pathChildrenCache = new PathChildrenCache(client, zNodePath, true);\n+        pathChildrenCache.getListenable().addListener((c, event) -> {\n+            switch (event.getType()) {\n+                case CHILD_ADDED:\n+                    addEndpoint(this.nodeValueCodec.decode(event.getData().getData()));\n+                    break;\n+                case CHILD_REMOVED:\n+                    removeEndpoint(this.nodeValueCodec.decode(event.getData().getData()));\n+                    break;\n+                default:\n+                    break;\n+            }\n+        });\n+        try {\n+            pathChildrenCache.start();\n+        } catch (Exception e) {\n+            throw new IllegalStateException(e);\n+        }\n     }\n \n     /**\n-     * Create a {@link ZooKeeperListener} listens specific ZooKeeper events.\n-     * @return  {@link ZooKeeperListener}\n+     * Create a ZooKeeper-based {@link EndpointGroup}, endpoints will be retrieved from a node's all children's\n+     * node value using {@link NodeValueCodec}.\n+     * @param client the curator framework instance.\n+     * @param zNodePath       a zNode path e.g. {@code \"/groups/productionGroups\"}\n+     * @param nodeValueCodec  the nodeValueCodec","path":"zookeeper/src/main/java/com/linecorp/armeria/client/zookeeper/ZooKeeperEndpointGroup.java","position":100,"original_position":100,"commit_id":"4a59da8a65d78f1b83c7640c0c1ef79eaca3561f","original_commit_id":"4a59da8a65d78f1b83c7640c0c1ef79eaca3561f","user":{"login":"trustin","id":173918,"avatar_url":"https://avatars0.githubusercontent.com/u/173918?v=4","gravatar_id":"","url":"https://api.github.com/users/trustin","html_url":"https://github.com/trustin","followers_url":"https://api.github.com/users/trustin/followers","following_url":"https://api.github.com/users/trustin/following{/other_user}","gists_url":"https://api.github.com/users/trustin/gists{/gist_id}","starred_url":"https://api.github.com/users/trustin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trustin/subscriptions","organizations_url":"https://api.github.com/users/trustin/orgs","repos_url":"https://api.github.com/users/trustin/repos","events_url":"https://api.github.com/users/trustin/events{/privacy}","received_events_url":"https://api.github.com/users/trustin/received_events","type":"User","site_admin":false},"body":"`the nodeValueCodec` -> `the {@link NodeValueCodec}`","created_at":"2018-03-30T07:14:14Z","updated_at":"2018-03-30T07:38:10Z","html_url":"https://github.com/line/armeria/pull/1044#discussion_r178244165","pull_request_url":"https://api.github.com/repos/line/armeria/pulls/1044","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/line/armeria/pulls/comments/178244165"},"html":{"href":"https://github.com/line/armeria/pull/1044#discussion_r178244165"},"pull_request":{"href":"https://api.github.com/repos/line/armeria/pulls/1044"}}},"pull_request":{"url":"https://api.github.com/repos/line/armeria/pulls/1044","id":172432067,"html_url":"https://github.com/line/armeria/pull/1044","diff_url":"https://github.com/line/armeria/pull/1044.diff","patch_url":"https://github.com/line/armeria/pull/1044.patch","issue_url":"https://api.github.com/repos/line/armeria/issues/1044","number":1044,"state":"open","locked":false,"title":"Remove ZooKeeperUpdatingListener, Add ZookeeperRegisterBuilder","user":{"login":"dongjinleekr","id":2375128,"avatar_url":"https://avatars2.githubusercontent.com/u/2375128?v=4","gravatar_id":"","url":"https://api.github.com/users/dongjinleekr","html_url":"https://github.com/dongjinleekr","followers_url":"https://api.github.com/users/dongjinleekr/followers","following_url":"https://api.github.com/users/dongjinleekr/following{/other_user}","gists_url":"https://api.github.com/users/dongjinleekr/gists{/gist_id}","starred_url":"https://api.github.com/users/dongjinleekr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dongjinleekr/subscriptions","organizations_url":"https://api.github.com/users/dongjinleekr/orgs","repos_url":"https://api.github.com/users/dongjinleekr/repos","events_url":"https://api.github.com/users/dongjinleekr/events{/privacy}","received_events_url":"https://api.github.com/users/dongjinleekr/received_events","type":"User","site_admin":false},"body":"Resolves #1007 & #1035.","created_at":"2018-03-02T06:35:11Z","updated_at":"2018-03-30T07:38:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"68f5e12d162c1908f63999c5fd7834344e7593ef","assignee":null,"assignees":[],"requested_reviewers":[{"login":"hyangtack","id":8417787,"avatar_url":"https://avatars1.githubusercontent.com/u/8417787?v=4","gravatar_id":"","url":"https://api.github.com/users/hyangtack","html_url":"https://github.com/hyangtack","followers_url":"https://api.github.com/users/hyangtack/followers","following_url":"https://api.github.com/users/hyangtack/following{/other_user}","gists_url":"https://api.github.com/users/hyangtack/gists{/gist_id}","starred_url":"https://api.github.com/users/hyangtack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyangtack/subscriptions","organizations_url":"https://api.github.com/users/hyangtack/orgs","repos_url":"https://api.github.com/users/hyangtack/repos","events_url":"https://api.github.com/users/hyangtack/events{/privacy}","received_events_url":"https://api.github.com/users/hyangtack/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":632570305,"url":"https://api.github.com/repos/line/armeria/labels/breaking-change","name":"breaking-change","color":"fc2929","default":false},{"id":287373881,"url":"https://api.github.com/repos/line/armeria/labels/new-feature","name":"new-feature","color":"009800","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/line/armeria/pulls/1044/commits","review_comments_url":"https://api.github.com/repos/line/armeria/pulls/1044/comments","review_comment_url":"https://api.github.com/repos/line/armeria/pulls/comments{/number}","comments_url":"https://api.github.com/repos/line/armeria/issues/1044/comments","statuses_url":"https://api.github.com/repos/line/armeria/statuses/4a59da8a65d78f1b83c7640c0c1ef79eaca3561f","head":{"label":"dongjinleekr:feature/issue-1007","ref":"feature/issue-1007","sha":"4a59da8a65d78f1b83c7640c0c1ef79eaca3561f","user":{"login":"dongjinleekr","id":2375128,"avatar_url":"https://avatars2.githubusercontent.com/u/2375128?v=4","gravatar_id":"","url":"https://api.github.com/users/dongjinleekr","html_url":"https://github.com/dongjinleekr","followers_url":"https://api.github.com/users/dongjinleekr/followers","following_url":"https://api.github.com/users/dongjinleekr/following{/other_user}","gists_url":"https://api.github.com/users/dongjinleekr/gists{/gist_id}","starred_url":"https://api.github.com/users/dongjinleekr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dongjinleekr/subscriptions","organizations_url":"https://api.github.com/users/dongjinleekr/orgs","repos_url":"https://api.github.com/users/dongjinleekr/repos","events_url":"https://api.github.com/users/dongjinleekr/events{/privacy}","received_events_url":"https://api.github.com/users/dongjinleekr/received_events","type":"User","site_admin":false},"repo":{"id":62859657,"name":"armeria","full_name":"dongjinleekr/armeria","owner":{"login":"dongjinleekr","id":2375128,"avatar_url":"https://avatars2.githubusercontent.com/u/2375128?v=4","gravatar_id":"","url":"https://api.github.com/users/dongjinleekr","html_url":"https://github.com/dongjinleekr","followers_url":"https://api.github.com/users/dongjinleekr/followers","following_url":"https://api.github.com/users/dongjinleekr/following{/other_user}","gists_url":"https://api.github.com/users/dongjinleekr/gists{/gist_id}","starred_url":"https://api.github.com/users/dongjinleekr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dongjinleekr/subscriptions","organizations_url":"https://api.github.com/users/dongjinleekr/orgs","repos_url":"https://api.github.com/users/dongjinleekr/repos","events_url":"https://api.github.com/users/dongjinleekr/events{/privacy}","received_events_url":"https://api.github.com/users/dongjinleekr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dongjinleekr/armeria","description":"Asynchronous RPC/API client/server library built on top of Java 8, Netty 4.1, HTTP/2, and Thrift","fork":true,"url":"https://api.github.com/repos/dongjinleekr/armeria","forks_url":"https://api.github.com/repos/dongjinleekr/armeria/forks","keys_url":"https://api.github.com/repos/dongjinleekr/armeria/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dongjinleekr/armeria/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dongjinleekr/armeria/teams","hooks_url":"https://api.github.com/repos/dongjinleekr/armeria/hooks","issue_events_url":"https://api.github.com/repos/dongjinleekr/armeria/issues/events{/number}","events_url":"https://api.github.com/repos/dongjinleekr/armeria/events","assignees_url":"https://api.github.com/repos/dongjinleekr/armeria/assignees{/user}","branches_url":"https://api.github.com/repos/dongjinleekr/armeria/branches{/branch}","tags_url":"https://api.github.com/repos/dongjinleekr/armeria/tags","blobs_url":"https://api.github.com/repos/dongjinleekr/armeria/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dongjinleekr/armeria/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dongjinleekr/armeria/git/refs{/sha}","trees_url":"https://api.github.com/repos/dongjinleekr/armeria/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dongjinleekr/armeria/statuses/{sha}","languages_url":"https://api.github.com/repos/dongjinleekr/armeria/languages","stargazers_url":"https://api.github.com/repos/dongjinleekr/armeria/stargazers","contributors_url":"https://api.github.com/repos/dongjinleekr/armeria/contributors","subscribers_url":"https://api.github.com/repos/dongjinleekr/armeria/subscribers","subscription_url":"https://api.github.com/repos/dongjinleekr/armeria/subscription","commits_url":"https://api.github.com/repos/dongjinleekr/armeria/commits{/sha}","git_commits_url":"https://api.github.com/repos/dongjinleekr/armeria/git/commits{/sha}","comments_url":"https://api.github.com/repos/dongjinleekr/armeria/comments{/number}","issue_comment_url":"https://api.github.com/repos/dongjinleekr/armeria/issues/comments{/number}","contents_url":"https://api.github.com/repos/dongjinleekr/armeria/contents/{+path}","compare_url":"https://api.github.com/repos/dongjinleekr/armeria/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dongjinleekr/armeria/merges","archive_url":"https://api.github.com/repos/dongjinleekr/armeria/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dongjinleekr/armeria/downloads","issues_url":"https://api.github.com/repos/dongjinleekr/armeria/issues{/number}","pulls_url":"https://api.github.com/repos/dongjinleekr/armeria/pulls{/number}","milestones_url":"https://api.github.com/repos/dongjinleekr/armeria/milestones{/number}","notifications_url":"https://api.github.com/repos/dongjinleekr/armeria/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dongjinleekr/armeria/labels{/name}","releases_url":"https://api.github.com/repos/dongjinleekr/armeria/releases{/id}","deployments_url":"https://api.github.com/repos/dongjinleekr/armeria/deployments","created_at":"2016-07-08T04:53:51Z","updated_at":"2018-03-27T08:11:56Z","pushed_at":"2018-03-30T05:58:42Z","git_url":"git://github.com/dongjinleekr/armeria.git","ssh_url":"git@github.com:dongjinleekr/armeria.git","clone_url":"https://github.com/dongjinleekr/armeria.git","svn_url":"https://github.com/dongjinleekr/armeria","homepage":"http://line.github.io/armeria/","size":29523,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"line:master","ref":"master","sha":"2f7e74bf7522aac4aabe0d6cb90185889febdc4c","user":{"login":"line","id":13128444,"avatar_url":"https://avatars2.githubusercontent.com/u/13128444?v=4","gravatar_id":"","url":"https://api.github.com/users/line","html_url":"https://github.com/line","followers_url":"https://api.github.com/users/line/followers","following_url":"https://api.github.com/users/line/following{/other_user}","gists_url":"https://api.github.com/users/line/gists{/gist_id}","starred_url":"https://api.github.com/users/line/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/line/subscriptions","organizations_url":"https://api.github.com/users/line/orgs","repos_url":"https://api.github.com/users/line/repos","events_url":"https://api.github.com/users/line/events{/privacy}","received_events_url":"https://api.github.com/users/line/received_events","type":"Organization","site_admin":false},"repo":{"id":46251204,"name":"armeria","full_name":"line/armeria","owner":{"login":"line","id":13128444,"avatar_url":"https://avatars2.githubusercontent.com/u/13128444?v=4","gravatar_id":"","url":"https://api.github.com/users/line","html_url":"https://github.com/line","followers_url":"https://api.github.com/users/line/followers","following_url":"https://api.github.com/users/line/following{/other_user}","gists_url":"https://api.github.com/users/line/gists{/gist_id}","starred_url":"https://api.github.com/users/line/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/line/subscriptions","organizations_url":"https://api.github.com/users/line/orgs","repos_url":"https://api.github.com/users/line/repos","events_url":"https://api.github.com/users/line/events{/privacy}","received_events_url":"https://api.github.com/users/line/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/line/armeria","description":"Asynchronous RPC/REST library built on top of Java 8, Netty, HTTP/2, Thrift and gRPC","fork":false,"url":"https://api.github.com/repos/line/armeria","forks_url":"https://api.github.com/repos/line/armeria/forks","keys_url":"https://api.github.com/repos/line/armeria/keys{/key_id}","collaborators_url":"https://api.github.com/repos/line/armeria/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/line/armeria/teams","hooks_url":"https://api.github.com/repos/line/armeria/hooks","issue_events_url":"https://api.github.com/repos/line/armeria/issues/events{/number}","events_url":"https://api.github.com/repos/line/armeria/events","assignees_url":"https://api.github.com/repos/line/armeria/assignees{/user}","branches_url":"https://api.github.com/repos/line/armeria/branches{/branch}","tags_url":"https://api.github.com/repos/line/armeria/tags","blobs_url":"https://api.github.com/repos/line/armeria/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/line/armeria/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/line/armeria/git/refs{/sha}","trees_url":"https://api.github.com/repos/line/armeria/git/trees{/sha}","statuses_url":"https://api.github.com/repos/line/armeria/statuses/{sha}","languages_url":"https://api.github.com/repos/line/armeria/languages","stargazers_url":"https://api.github.com/repos/line/armeria/stargazers","contributors_url":"https://api.github.com/repos/line/armeria/contributors","subscribers_url":"https://api.github.com/repos/line/armeria/subscribers","subscription_url":"https://api.github.com/repos/line/armeria/subscription","commits_url":"https://api.github.com/repos/line/armeria/commits{/sha}","git_commits_url":"https://api.github.com/repos/line/armeria/git/commits{/sha}","comments_url":"https://api.github.com/repos/line/armeria/comments{/number}","issue_comment_url":"https://api.github.com/repos/line/armeria/issues/comments{/number}","contents_url":"https://api.github.com/repos/line/armeria/contents/{+path}","compare_url":"https://api.github.com/repos/line/armeria/compare/{base}...{head}","merges_url":"https://api.github.com/repos/line/armeria/merges","archive_url":"https://api.github.com/repos/line/armeria/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/line/armeria/downloads","issues_url":"https://api.github.com/repos/line/armeria/issues{/number}","pulls_url":"https://api.github.com/repos/line/armeria/pulls{/number}","milestones_url":"https://api.github.com/repos/line/armeria/milestones{/number}","notifications_url":"https://api.github.com/repos/line/armeria/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/line/armeria/labels{/name}","releases_url":"https://api.github.com/repos/line/armeria/releases{/id}","deployments_url":"https://api.github.com/repos/line/armeria/deployments","created_at":"2015-11-16T04:04:01Z","updated_at":"2018-03-30T06:22:56Z","pushed_at":"2018-03-30T06:22:54Z","git_url":"git://github.com/line/armeria.git","ssh_url":"git@github.com:line/armeria.git","clone_url":"https://github.com/line/armeria.git","svn_url":"https://github.com/line/armeria","homepage":"https://line.github.io/armeria/","size":31114,"stargazers_count":1175,"watchers_count":1175,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":277,"mirror_url":null,"archived":false,"open_issues_count":109,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":277,"open_issues":109,"watchers":1175,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/line/armeria/pulls/1044"},"html":{"href":"https://github.com/line/armeria/pull/1044"},"issue":{"href":"https://api.github.com/repos/line/armeria/issues/1044"},"comments":{"href":"https://api.github.com/repos/line/armeria/issues/1044/comments"},"review_comments":{"href":"https://api.github.com/repos/line/armeria/pulls/1044/comments"},"review_comment":{"href":"https://api.github.com/repos/line/armeria/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/line/armeria/pulls/1044/commits"},"statuses":{"href":"https://api.github.com/repos/line/armeria/statuses/4a59da8a65d78f1b83c7640c0c1ef79eaca3561f"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"trustin"}}