{"action":"created","comment":{"url":"https://api.github.com/repos/grpc/grpc-java/pulls/comments/168845476","pull_request_review_id":97285596,"id":168845476,"diff_hunk":"@@ -0,0 +1,163 @@\n+/*\n+ * Copyright 2018, gRPC Authors All rights reserved.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package io.grpc.internal;\n+\n+import com.google.common.annotations.VisibleForTesting;\n+import io.grpc.ManagedChannel;\n+import java.lang.ref.Reference;\n+import java.lang.ref.ReferenceQueue;\n+import java.lang.ref.SoftReference;\n+import java.lang.ref.WeakReference;\n+import java.util.concurrent.ConcurrentHashMap;\n+import java.util.concurrent.ConcurrentMap;\n+import java.util.logging.Level;\n+import java.util.logging.LogRecord;\n+import java.util.logging.Logger;\n+\n+class ManagedChannelOrphanWrapper extends ForwardingManagedChannel {\n+  private static final ReferenceQueue<ManagedChannelOrphanWrapper> REFQUEUE =","path":"core/src/main/java/io/grpc/internal/ManagedChannelOrphanWrapper.java","position":32,"original_position":32,"commit_id":"a2b700d8dde117daa5141238310446e6e2fcbb06","original_commit_id":"a2b700d8dde117daa5141238310446e6e2fcbb06","user":{"login":"carl-mastrangelo","id":8943572,"avatar_url":"https://avatars0.githubusercontent.com/u/8943572?v=4","gravatar_id":"","url":"https://api.github.com/users/carl-mastrangelo","html_url":"https://github.com/carl-mastrangelo","followers_url":"https://api.github.com/users/carl-mastrangelo/followers","following_url":"https://api.github.com/users/carl-mastrangelo/following{/other_user}","gists_url":"https://api.github.com/users/carl-mastrangelo/gists{/gist_id}","starred_url":"https://api.github.com/users/carl-mastrangelo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carl-mastrangelo/subscriptions","organizations_url":"https://api.github.com/users/carl-mastrangelo/orgs","repos_url":"https://api.github.com/users/carl-mastrangelo/repos","events_url":"https://api.github.com/users/carl-mastrangelo/events{/privacy}","received_events_url":"https://api.github.com/users/carl-mastrangelo/received_events","type":"User","site_admin":false},"body":"queues arent constant, so they should not get a constant name.","created_at":"2018-02-16T19:12:21Z","updated_at":"2018-02-16T19:18:27Z","html_url":"https://github.com/grpc/grpc-java/pull/4093#discussion_r168845476","pull_request_url":"https://api.github.com/repos/grpc/grpc-java/pulls/4093","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/comments/168845476"},"html":{"href":"https://github.com/grpc/grpc-java/pull/4093#discussion_r168845476"},"pull_request":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/4093"}}},"pull_request":{"url":"https://api.github.com/repos/grpc/grpc-java/pulls/4093","id":169694260,"html_url":"https://github.com/grpc/grpc-java/pull/4093","diff_url":"https://github.com/grpc/grpc-java/pull/4093.diff","patch_url":"https://github.com/grpc/grpc-java/pull/4093.patch","issue_url":"https://api.github.com/repos/grpc/grpc-java/issues/4093","number":4093,"state":"open","locked":false,"title":"core: move ManagedChannelImpl orphan check to wrapper class","user":{"login":"zpencer","id":2819812,"avatar_url":"https://avatars0.githubusercontent.com/u/2819812?v=4","gravatar_id":"","url":"https://api.github.com/users/zpencer","html_url":"https://github.com/zpencer","followers_url":"https://api.github.com/users/zpencer/followers","following_url":"https://api.github.com/users/zpencer/following{/other_user}","gists_url":"https://api.github.com/users/zpencer/gists{/gist_id}","starred_url":"https://api.github.com/users/zpencer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zpencer/subscriptions","organizations_url":"https://api.github.com/users/zpencer/orgs","repos_url":"https://api.github.com/users/zpencer/repos","events_url":"https://api.github.com/users/zpencer/events{/privacy}","received_events_url":"https://api.github.com/users/zpencer/received_events","type":"User","site_admin":false},"body":"Spoke with ejona and determined that okhttp and netty libraries will\r\nretain hard references to ManagedChannelImpl via its non static nested\r\nclasses. Moving the orphan check to a wrapper class solves this\r\nproblem.\r\n\r\n- Added ForwardingManagedChannel + test\r\n- To make testing easier: added OrphanWrappableManagedChannel,\r\n  let refqueue and ref set be passed into the reference.\r\n- Add integration tests for wrapper","created_at":"2018-02-16T18:28:49Z","updated_at":"2018-02-16T19:18:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0dbb8662ce212be5b46be049ac0e6e2242918c76","assignee":{"login":"ejona86","id":2811396,"avatar_url":"https://avatars2.githubusercontent.com/u/2811396?v=4","gravatar_id":"","url":"https://api.github.com/users/ejona86","html_url":"https://github.com/ejona86","followers_url":"https://api.github.com/users/ejona86/followers","following_url":"https://api.github.com/users/ejona86/following{/other_user}","gists_url":"https://api.github.com/users/ejona86/gists{/gist_id}","starred_url":"https://api.github.com/users/ejona86/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ejona86/subscriptions","organizations_url":"https://api.github.com/users/ejona86/orgs","repos_url":"https://api.github.com/users/ejona86/repos","events_url":"https://api.github.com/users/ejona86/events{/privacy}","received_events_url":"https://api.github.com/users/ejona86/received_events","type":"User","site_admin":false},"assignees":[{"login":"ejona86","id":2811396,"avatar_url":"https://avatars2.githubusercontent.com/u/2811396?v=4","gravatar_id":"","url":"https://api.github.com/users/ejona86","html_url":"https://github.com/ejona86","followers_url":"https://api.github.com/users/ejona86/followers","following_url":"https://api.github.com/users/ejona86/following{/other_user}","gists_url":"https://api.github.com/users/ejona86/gists{/gist_id}","starred_url":"https://api.github.com/users/ejona86/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ejona86/subscriptions","organizations_url":"https://api.github.com/users/ejona86/orgs","repos_url":"https://api.github.com/users/ejona86/repos","events_url":"https://api.github.com/users/ejona86/events{/privacy}","received_events_url":"https://api.github.com/users/ejona86/received_events","type":"User","site_admin":false},{"login":"carl-mastrangelo","id":8943572,"avatar_url":"https://avatars0.githubusercontent.com/u/8943572?v=4","gravatar_id":"","url":"https://api.github.com/users/carl-mastrangelo","html_url":"https://github.com/carl-mastrangelo","followers_url":"https://api.github.com/users/carl-mastrangelo/followers","following_url":"https://api.github.com/users/carl-mastrangelo/following{/other_user}","gists_url":"https://api.github.com/users/carl-mastrangelo/gists{/gist_id}","starred_url":"https://api.github.com/users/carl-mastrangelo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carl-mastrangelo/subscriptions","organizations_url":"https://api.github.com/users/carl-mastrangelo/orgs","repos_url":"https://api.github.com/users/carl-mastrangelo/repos","events_url":"https://api.github.com/users/carl-mastrangelo/events{/privacy}","received_events_url":"https://api.github.com/users/carl-mastrangelo/received_events","type":"User","site_admin":false}],"requested_reviewers":[{"login":"ejona86","id":2811396,"avatar_url":"https://avatars2.githubusercontent.com/u/2811396?v=4","gravatar_id":"","url":"https://api.github.com/users/ejona86","html_url":"https://github.com/ejona86","followers_url":"https://api.github.com/users/ejona86/followers","following_url":"https://api.github.com/users/ejona86/following{/other_user}","gists_url":"https://api.github.com/users/ejona86/gists{/gist_id}","starred_url":"https://api.github.com/users/ejona86/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ejona86/subscriptions","organizations_url":"https://api.github.com/users/ejona86/orgs","repos_url":"https://api.github.com/users/ejona86/repos","events_url":"https://api.github.com/users/ejona86/events{/privacy}","received_events_url":"https://api.github.com/users/ejona86/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/grpc/grpc-java/pulls/4093/commits","review_comments_url":"https://api.github.com/repos/grpc/grpc-java/pulls/4093/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/4093/comments","statuses_url":"https://api.github.com/repos/grpc/grpc-java/statuses/a2b700d8dde117daa5141238310446e6e2fcbb06","head":{"label":"zpencer:separate-orphan-class","ref":"separate-orphan-class","sha":"a2b700d8dde117daa5141238310446e6e2fcbb06","user":{"login":"zpencer","id":2819812,"avatar_url":"https://avatars0.githubusercontent.com/u/2819812?v=4","gravatar_id":"","url":"https://api.github.com/users/zpencer","html_url":"https://github.com/zpencer","followers_url":"https://api.github.com/users/zpencer/followers","following_url":"https://api.github.com/users/zpencer/following{/other_user}","gists_url":"https://api.github.com/users/zpencer/gists{/gist_id}","starred_url":"https://api.github.com/users/zpencer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zpencer/subscriptions","organizations_url":"https://api.github.com/users/zpencer/orgs","repos_url":"https://api.github.com/users/zpencer/repos","events_url":"https://api.github.com/users/zpencer/events{/privacy}","received_events_url":"https://api.github.com/users/zpencer/received_events","type":"User","site_admin":false},"repo":{"id":89497167,"name":"grpc-java","full_name":"zpencer/grpc-java","owner":{"login":"zpencer","id":2819812,"avatar_url":"https://avatars0.githubusercontent.com/u/2819812?v=4","gravatar_id":"","url":"https://api.github.com/users/zpencer","html_url":"https://github.com/zpencer","followers_url":"https://api.github.com/users/zpencer/followers","following_url":"https://api.github.com/users/zpencer/following{/other_user}","gists_url":"https://api.github.com/users/zpencer/gists{/gist_id}","starred_url":"https://api.github.com/users/zpencer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zpencer/subscriptions","organizations_url":"https://api.github.com/users/zpencer/orgs","repos_url":"https://api.github.com/users/zpencer/repos","events_url":"https://api.github.com/users/zpencer/events{/privacy}","received_events_url":"https://api.github.com/users/zpencer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zpencer/grpc-java","description":"The Java gRPC implementation. HTTP/2 based RPC","fork":true,"url":"https://api.github.com/repos/zpencer/grpc-java","forks_url":"https://api.github.com/repos/zpencer/grpc-java/forks","keys_url":"https://api.github.com/repos/zpencer/grpc-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zpencer/grpc-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zpencer/grpc-java/teams","hooks_url":"https://api.github.com/repos/zpencer/grpc-java/hooks","issue_events_url":"https://api.github.com/repos/zpencer/grpc-java/issues/events{/number}","events_url":"https://api.github.com/repos/zpencer/grpc-java/events","assignees_url":"https://api.github.com/repos/zpencer/grpc-java/assignees{/user}","branches_url":"https://api.github.com/repos/zpencer/grpc-java/branches{/branch}","tags_url":"https://api.github.com/repos/zpencer/grpc-java/tags","blobs_url":"https://api.github.com/repos/zpencer/grpc-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zpencer/grpc-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zpencer/grpc-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/zpencer/grpc-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zpencer/grpc-java/statuses/{sha}","languages_url":"https://api.github.com/repos/zpencer/grpc-java/languages","stargazers_url":"https://api.github.com/repos/zpencer/grpc-java/stargazers","contributors_url":"https://api.github.com/repos/zpencer/grpc-java/contributors","subscribers_url":"https://api.github.com/repos/zpencer/grpc-java/subscribers","subscription_url":"https://api.github.com/repos/zpencer/grpc-java/subscription","commits_url":"https://api.github.com/repos/zpencer/grpc-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/zpencer/grpc-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/zpencer/grpc-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/zpencer/grpc-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/zpencer/grpc-java/contents/{+path}","compare_url":"https://api.github.com/repos/zpencer/grpc-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zpencer/grpc-java/merges","archive_url":"https://api.github.com/repos/zpencer/grpc-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zpencer/grpc-java/downloads","issues_url":"https://api.github.com/repos/zpencer/grpc-java/issues{/number}","pulls_url":"https://api.github.com/repos/zpencer/grpc-java/pulls{/number}","milestones_url":"https://api.github.com/repos/zpencer/grpc-java/milestones{/number}","notifications_url":"https://api.github.com/repos/zpencer/grpc-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zpencer/grpc-java/labels{/name}","releases_url":"https://api.github.com/repos/zpencer/grpc-java/releases{/id}","deployments_url":"https://api.github.com/repos/zpencer/grpc-java/deployments","created_at":"2017-04-26T15:28:10Z","updated_at":"2017-04-26T15:28:13Z","pushed_at":"2018-02-16T18:39:47Z","git_url":"git://github.com/zpencer/grpc-java.git","ssh_url":"git@github.com:zpencer/grpc-java.git","clone_url":"https://github.com/zpencer/grpc-java.git","svn_url":"https://github.com/zpencer/grpc-java","homepage":"http://grpc.io","size":19942,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":false,"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":"grpc:master","ref":"master","sha":"0c27e719ae427c78e9090afff9fa8ecad6f91b74","user":{"login":"grpc","id":7802525,"avatar_url":"https://avatars1.githubusercontent.com/u/7802525?v=4","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://avatars1.githubusercontent.com/u/7802525?v=4","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":"2018-02-16T13:58:09Z","pushed_at":"2018-02-16T18:39:48Z","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":"https://grpc.io","size":21821,"stargazers_count":3776,"watchers_count":3776,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":true,"forks_count":1210,"mirror_url":null,"archived":false,"open_issues_count":367,"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":1210,"open_issues":367,"watchers":3776,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/4093"},"html":{"href":"https://github.com/grpc/grpc-java/pull/4093"},"issue":{"href":"https://api.github.com/repos/grpc/grpc-java/issues/4093"},"comments":{"href":"https://api.github.com/repos/grpc/grpc-java/issues/4093/comments"},"review_comments":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/4093/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/4093/commits"},"statuses":{"href":"https://api.github.com/repos/grpc/grpc-java/statuses/a2b700d8dde117daa5141238310446e6e2fcbb06"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"carl-mastrangelo"}}