{"action":"created","comment":{"url":"https://api.github.com/repos/grpc/grpc-java/pulls/comments/83732864","pull_request_review_id":4557521,"id":83732864,"diff_hunk":"@@ -0,0 +1,184 @@\n+/*\n+ * Copyright 2015, Google Inc. All rights reserved.\n+ *\n+ * Redistribution and use in source and binary forms, with or without\n+ * modification, are permitted provided that the following conditions are\n+ * met:\n+ *\n+ *    * Redistributions of source code must retain the above copyright\n+ * notice, this list of conditions and the following disclaimer.\n+ *    * Redistributions in binary form must reproduce the above\n+ * copyright notice, this list of conditions and the following disclaimer\n+ * in the documentation and/or other materials provided with the\n+ * distribution.\n+ *\n+ *    * Neither the name of Google Inc. nor the names of its\n+ * contributors may be used to endorse or promote products derived from\n+ * this software without specific prior written permission.\n+ *\n+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+package io.grpc;\n+\n+import com.google.common.annotations.VisibleForTesting;\n+import com.google.common.base.Preconditions;\n+\n+import io.grpc.internal.DnsNameResolverProvider;\n+import io.grpc.internal.LogExceptionRunnable;\n+import io.grpc.internal.SharedResourceHolder;\n+import io.grpc.internal.SharedResourceHolder.Resource;\n+\n+import java.net.InetAddress;\n+import java.net.UnknownHostException;\n+import java.util.List;\n+import java.util.concurrent.ExecutorService;\n+import java.util.concurrent.ScheduledExecutorService;\n+import java.util.concurrent.ScheduledFuture;\n+import java.util.concurrent.TimeUnit;\n+\n+import javax.annotation.concurrent.GuardedBy;\n+\n+/**\n+ * A DNS-based {@link NameResolver}.\n+ *\n+ * @see DnsNameResolverProvider */\n+public abstract class RefreshingNameResolver extends NameResolver {","path":"core/src/main/java/io/grpc/RefreshingNameResolver.java","position":56,"original_position":56,"commit_id":"0d99efb3ff0d8db5bfdac5bbbb51b088d080be6a","original_commit_id":"0d99efb3ff0d8db5bfdac5bbbb51b088d080be6a","user":{"login":"szantopeter","id":69414,"avatar_url":"https://avatars.githubusercontent.com/u/69414?v=3","gravatar_id":"","url":"https://api.github.com/users/szantopeter","html_url":"https://github.com/szantopeter","followers_url":"https://api.github.com/users/szantopeter/followers","following_url":"https://api.github.com/users/szantopeter/following{/other_user}","gists_url":"https://api.github.com/users/szantopeter/gists{/gist_id}","starred_url":"https://api.github.com/users/szantopeter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/szantopeter/subscriptions","organizations_url":"https://api.github.com/users/szantopeter/orgs","repos_url":"https://api.github.com/users/szantopeter/repos","events_url":"https://api.github.com/users/szantopeter/events{/privacy}","received_events_url":"https://api.github.com/users/szantopeter/received_events","type":"User","site_admin":false},"body":"@carl-mastrangelo changing the refresh interval is a valid scenario, that can be easily satisfied either now or later without introducing a breaking change. I can't think of all future scenarios, but the class is still quite closed, all methods are private. As long as the class remains backward compatible the internal structure can be still changed. Do you have a better approach to avoid duplication of the refresh logic in all name resolvers? \r\n\r\nActually this class is not as general as I originally thought, because not all refreshing name resolvers will need to poll it's source. PollingNameResolver would describe better the behavior of the class, and would sound less generic. What do you think about it?\r\n\r\n\r\n\r\nCan you think about any other scenario? \r\n\r\n","created_at":"2016-10-17T20:59:59Z","updated_at":"2016-10-17T20:59:59Z","html_url":"https://github.com/grpc/grpc-java/pull/2347#discussion_r83732864","pull_request_url":"https://api.github.com/repos/grpc/grpc-java/pulls/2347","_links":{"self":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/comments/83732864"},"html":{"href":"https://github.com/grpc/grpc-java/pull/2347#discussion_r83732864"},"pull_request":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/2347"}}},"pull_request":{"url":"https://api.github.com/repos/grpc/grpc-java/pulls/2347","id":89570735,"html_url":"https://github.com/grpc/grpc-java/pull/2347","diff_url":"https://github.com/grpc/grpc-java/pull/2347.diff","patch_url":"https://github.com/grpc/grpc-java/pull/2347.patch","issue_url":"https://api.github.com/repos/grpc/grpc-java/issues/2347","number":2347,"state":"open","locked":false,"title":"Factoring out RefreshingNameResolver from DnsNameResolver","user":{"login":"szantopeter","id":69414,"avatar_url":"https://avatars.githubusercontent.com/u/69414?v=3","gravatar_id":"","url":"https://api.github.com/users/szantopeter","html_url":"https://github.com/szantopeter","followers_url":"https://api.github.com/users/szantopeter/followers","following_url":"https://api.github.com/users/szantopeter/following{/other_user}","gists_url":"https://api.github.com/users/szantopeter/gists{/gist_id}","starred_url":"https://api.github.com/users/szantopeter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/szantopeter/subscriptions","organizations_url":"https://api.github.com/users/szantopeter/orgs","repos_url":"https://api.github.com/users/szantopeter/repos","events_url":"https://api.github.com/users/szantopeter/events{/privacy}","received_events_url":"https://api.github.com/users/szantopeter/received_events","type":"User","site_admin":false},"body":"DnsNameResolverProvider does two things :\r\n\r\n- Resolves server addresses from DNS\r\n- Periodically updates the server list\r\n\r\nI created two separate classes for the two distinct functionality. This is useful so new name resolvers don't have to duplicate the refresh logic ","created_at":"2016-10-17T07:07:09Z","updated_at":"2016-10-17T20:59:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9ef30e7b04c438ba500c9f4c09507376d057fd5b","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/grpc/grpc-java/pulls/2347/commits","review_comments_url":"https://api.github.com/repos/grpc/grpc-java/pulls/2347/comments","review_comment_url":"https://api.github.com/repos/grpc/grpc-java/pulls/comments{/number}","comments_url":"https://api.github.com/repos/grpc/grpc-java/issues/2347/comments","statuses_url":"https://api.github.com/repos/grpc/grpc-java/statuses/0d99efb3ff0d8db5bfdac5bbbb51b088d080be6a","head":{"label":"szantopeter:master","ref":"master","sha":"0d99efb3ff0d8db5bfdac5bbbb51b088d080be6a","user":{"login":"szantopeter","id":69414,"avatar_url":"https://avatars.githubusercontent.com/u/69414?v=3","gravatar_id":"","url":"https://api.github.com/users/szantopeter","html_url":"https://github.com/szantopeter","followers_url":"https://api.github.com/users/szantopeter/followers","following_url":"https://api.github.com/users/szantopeter/following{/other_user}","gists_url":"https://api.github.com/users/szantopeter/gists{/gist_id}","starred_url":"https://api.github.com/users/szantopeter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/szantopeter/subscriptions","organizations_url":"https://api.github.com/users/szantopeter/orgs","repos_url":"https://api.github.com/users/szantopeter/repos","events_url":"https://api.github.com/users/szantopeter/events{/privacy}","received_events_url":"https://api.github.com/users/szantopeter/received_events","type":"User","site_admin":false},"repo":{"id":71008733,"name":"grpc-java","full_name":"szantopeter/grpc-java","owner":{"login":"szantopeter","id":69414,"avatar_url":"https://avatars.githubusercontent.com/u/69414?v=3","gravatar_id":"","url":"https://api.github.com/users/szantopeter","html_url":"https://github.com/szantopeter","followers_url":"https://api.github.com/users/szantopeter/followers","following_url":"https://api.github.com/users/szantopeter/following{/other_user}","gists_url":"https://api.github.com/users/szantopeter/gists{/gist_id}","starred_url":"https://api.github.com/users/szantopeter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/szantopeter/subscriptions","organizations_url":"https://api.github.com/users/szantopeter/orgs","repos_url":"https://api.github.com/users/szantopeter/repos","events_url":"https://api.github.com/users/szantopeter/events{/privacy}","received_events_url":"https://api.github.com/users/szantopeter/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/szantopeter/grpc-java","description":"The Java gRPC implementation. HTTP/2 based RPC","fork":true,"url":"https://api.github.com/repos/szantopeter/grpc-java","forks_url":"https://api.github.com/repos/szantopeter/grpc-java/forks","keys_url":"https://api.github.com/repos/szantopeter/grpc-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/szantopeter/grpc-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/szantopeter/grpc-java/teams","hooks_url":"https://api.github.com/repos/szantopeter/grpc-java/hooks","issue_events_url":"https://api.github.com/repos/szantopeter/grpc-java/issues/events{/number}","events_url":"https://api.github.com/repos/szantopeter/grpc-java/events","assignees_url":"https://api.github.com/repos/szantopeter/grpc-java/assignees{/user}","branches_url":"https://api.github.com/repos/szantopeter/grpc-java/branches{/branch}","tags_url":"https://api.github.com/repos/szantopeter/grpc-java/tags","blobs_url":"https://api.github.com/repos/szantopeter/grpc-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/szantopeter/grpc-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/szantopeter/grpc-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/szantopeter/grpc-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/szantopeter/grpc-java/statuses/{sha}","languages_url":"https://api.github.com/repos/szantopeter/grpc-java/languages","stargazers_url":"https://api.github.com/repos/szantopeter/grpc-java/stargazers","contributors_url":"https://api.github.com/repos/szantopeter/grpc-java/contributors","subscribers_url":"https://api.github.com/repos/szantopeter/grpc-java/subscribers","subscription_url":"https://api.github.com/repos/szantopeter/grpc-java/subscription","commits_url":"https://api.github.com/repos/szantopeter/grpc-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/szantopeter/grpc-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/szantopeter/grpc-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/szantopeter/grpc-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/szantopeter/grpc-java/contents/{+path}","compare_url":"https://api.github.com/repos/szantopeter/grpc-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/szantopeter/grpc-java/merges","archive_url":"https://api.github.com/repos/szantopeter/grpc-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/szantopeter/grpc-java/downloads","issues_url":"https://api.github.com/repos/szantopeter/grpc-java/issues{/number}","pulls_url":"https://api.github.com/repos/szantopeter/grpc-java/pulls{/number}","milestones_url":"https://api.github.com/repos/szantopeter/grpc-java/milestones{/number}","notifications_url":"https://api.github.com/repos/szantopeter/grpc-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/szantopeter/grpc-java/labels{/name}","releases_url":"https://api.github.com/repos/szantopeter/grpc-java/releases{/id}","deployments_url":"https://api.github.com/repos/szantopeter/grpc-java/deployments","created_at":"2016-10-15T19:25:37Z","updated_at":"2016-10-15T19:25:39Z","pushed_at":"2016-10-17T13:50:34Z","git_url":"git://github.com/szantopeter/grpc-java.git","ssh_url":"git@github.com:szantopeter/grpc-java.git","clone_url":"https://github.com/szantopeter/grpc-java.git","svn_url":"https://github.com/szantopeter/grpc-java","homepage":"http://grpc.io","size":10622,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"grpc:master","ref":"master","sha":"46e46eb8bd06d58753ce9e68566eac2d68fb74b1","user":{"login":"grpc","id":7802525,"avatar_url":"https://avatars.githubusercontent.com/u/7802525?v=3","gravatar_id":"","url":"https://api.github.com/users/grpc","html_url":"https://github.com/grpc","followers_url":"https://api.github.com/users/grpc/followers","following_url":"https://api.github.com/users/grpc/following{/other_user}","gists_url":"https://api.github.com/users/grpc/gists{/gist_id}","starred_url":"https://api.github.com/users/grpc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grpc/subscriptions","organizations_url":"https://api.github.com/users/grpc/orgs","repos_url":"https://api.github.com/users/grpc/repos","events_url":"https://api.github.com/users/grpc/events{/privacy}","received_events_url":"https://api.github.com/users/grpc/received_events","type":"Organization","site_admin":false},"repo":{"id":27729926,"name":"grpc-java","full_name":"grpc/grpc-java","owner":{"login":"grpc","id":7802525,"avatar_url":"https://avatars.githubusercontent.com/u/7802525?v=3","gravatar_id":"","url":"https://api.github.com/users/grpc","html_url":"https://github.com/grpc","followers_url":"https://api.github.com/users/grpc/followers","following_url":"https://api.github.com/users/grpc/following{/other_user}","gists_url":"https://api.github.com/users/grpc/gists{/gist_id}","starred_url":"https://api.github.com/users/grpc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grpc/subscriptions","organizations_url":"https://api.github.com/users/grpc/orgs","repos_url":"https://api.github.com/users/grpc/repos","events_url":"https://api.github.com/users/grpc/events{/privacy}","received_events_url":"https://api.github.com/users/grpc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/grpc/grpc-java","description":"The Java gRPC implementation. HTTP/2 based RPC","fork":false,"url":"https://api.github.com/repos/grpc/grpc-java","forks_url":"https://api.github.com/repos/grpc/grpc-java/forks","keys_url":"https://api.github.com/repos/grpc/grpc-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/grpc/grpc-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/grpc/grpc-java/teams","hooks_url":"https://api.github.com/repos/grpc/grpc-java/hooks","issue_events_url":"https://api.github.com/repos/grpc/grpc-java/issues/events{/number}","events_url":"https://api.github.com/repos/grpc/grpc-java/events","assignees_url":"https://api.github.com/repos/grpc/grpc-java/assignees{/user}","branches_url":"https://api.github.com/repos/grpc/grpc-java/branches{/branch}","tags_url":"https://api.github.com/repos/grpc/grpc-java/tags","blobs_url":"https://api.github.com/repos/grpc/grpc-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/grpc/grpc-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/grpc/grpc-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/grpc/grpc-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/grpc/grpc-java/statuses/{sha}","languages_url":"https://api.github.com/repos/grpc/grpc-java/languages","stargazers_url":"https://api.github.com/repos/grpc/grpc-java/stargazers","contributors_url":"https://api.github.com/repos/grpc/grpc-java/contributors","subscribers_url":"https://api.github.com/repos/grpc/grpc-java/subscribers","subscription_url":"https://api.github.com/repos/grpc/grpc-java/subscription","commits_url":"https://api.github.com/repos/grpc/grpc-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/grpc/grpc-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/grpc/grpc-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/grpc/grpc-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/grpc/grpc-java/contents/{+path}","compare_url":"https://api.github.com/repos/grpc/grpc-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/grpc/grpc-java/merges","archive_url":"https://api.github.com/repos/grpc/grpc-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/grpc/grpc-java/downloads","issues_url":"https://api.github.com/repos/grpc/grpc-java/issues{/number}","pulls_url":"https://api.github.com/repos/grpc/grpc-java/pulls{/number}","milestones_url":"https://api.github.com/repos/grpc/grpc-java/milestones{/number}","notifications_url":"https://api.github.com/repos/grpc/grpc-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/grpc/grpc-java/labels{/name}","releases_url":"https://api.github.com/repos/grpc/grpc-java/releases{/id}","deployments_url":"https://api.github.com/repos/grpc/grpc-java/deployments","created_at":"2014-12-08T19:00:00Z","updated_at":"2016-10-17T19:03:30Z","pushed_at":"2016-10-17T18:22:21Z","git_url":"git://github.com/grpc/grpc-java.git","ssh_url":"git@github.com:grpc/grpc-java.git","clone_url":"https://github.com/grpc/grpc-java.git","svn_url":"https://github.com/grpc/grpc-java","homepage":"http://grpc.io","size":28453,"stargazers_count":2102,"watchers_count":2102,"language":"Java","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":true,"forks_count":609,"mirror_url":null,"open_issues_count":265,"forks":609,"open_issues":265,"watchers":2102,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/2347"},"html":{"href":"https://github.com/grpc/grpc-java/pull/2347"},"issue":{"href":"https://api.github.com/repos/grpc/grpc-java/issues/2347"},"comments":{"href":"https://api.github.com/repos/grpc/grpc-java/issues/2347/comments"},"review_comments":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/2347/comments"},"review_comment":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/2347/commits"},"statuses":{"href":"https://api.github.com/repos/grpc/grpc-java/statuses/0d99efb3ff0d8db5bfdac5bbbb51b088d080be6a"}}}}
{"actor":{"display_login":"szantopeter"}}