{"action":"created","comment":{"url":"https://api.github.com/repos/ReactiveX/RxNetty/pulls/comments/72935710","id":72935710,"diff_hunk":"@@ -289,18 +380,47 @@ public Subscription subscribe(MetricEventsListener<? extends ClientMetricsEvent<\n         @Override\n         public void run() {\n             try {\n-                Iterator<PooledConnection<I,O>> iterator = idleConnections.iterator(); // Weakly consistent iterator\n-                while (iterator.hasNext()) {\n-                    PooledConnection<I, O> idleConnection = iterator.next();\n-                    if (!idleConnection.isUsable() && idleConnection.claim()) {\n-                        iterator.remove();\n-                        discardConnection(idleConnection); // Don't use pool.discard() as that won't do anything if the\n-                                                           // connection isn't there in the idle queue, which is the case here.\n+                Lock lock = shutdownLock.readLock();\n+                boolean lockAquired = lock.tryLock();\n+                if (lockAquired) {\n+                    try {\n+                        Iterator<PooledConnection<I,O>> iterator = idleConnections.iterator(); // Weakly consistent iterator\n+                        while (iterator.hasNext()) {\n+                            PooledConnection<I, O> idleConnection = iterator.next();\n+                            if (!idleConnection.isUsable() && idleConnection.claim()) {\n+                                iterator.remove();\n+                                discardConnection(idleConnection); // Don't use pool.discard() as that won't do anything if the\n+                                // connection isn't there in the idle queue, which is the case here.\n+                            }\n+                        }\n+                    } finally {\n+                        lock.unlock();\n                     }\n                 }\n             } catch (Exception e) {\n                 logger.error(\"Exception in the idle connection cleanup task. This does NOT stop the next schedule of the task. \", e);\n             }\n         }\n     }\n+\n+    private class ShutdownTask implements Runnable {","path":"rxnetty/src/main/java/io/reactivex/netty/client/ConnectionPoolImpl.java","position":303,"original_position":303,"commit_id":"4b8fed676887b3bd590985b1c671dbf4c3d37e31","original_commit_id":"4b8fed676887b3bd590985b1c671dbf4c3d37e31","user":{"login":"NiteshKant","id":820005,"avatar_url":"https://avatars.githubusercontent.com/u/820005?v=3","gravatar_id":"","url":"https://api.github.com/users/NiteshKant","html_url":"https://github.com/NiteshKant","followers_url":"https://api.github.com/users/NiteshKant/followers","following_url":"https://api.github.com/users/NiteshKant/following{/other_user}","gists_url":"https://api.github.com/users/NiteshKant/gists{/gist_id}","starred_url":"https://api.github.com/users/NiteshKant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NiteshKant/subscriptions","organizations_url":"https://api.github.com/users/NiteshKant/orgs","repos_url":"https://api.github.com/users/NiteshKant/repos","events_url":"https://api.github.com/users/NiteshKant/events{/privacy}","received_events_url":"https://api.github.com/users/NiteshKant/received_events","type":"User","site_admin":false},"body":"class not used anymore?","created_at":"2016-08-01T07:48:19Z","updated_at":"2016-08-01T07:48:19Z","html_url":"https://github.com/ReactiveX/RxNetty/pull/525#discussion_r72935710","pull_request_url":"https://api.github.com/repos/ReactiveX/RxNetty/pulls/525","_links":{"self":{"href":"https://api.github.com/repos/ReactiveX/RxNetty/pulls/comments/72935710"},"html":{"href":"https://github.com/ReactiveX/RxNetty/pull/525#discussion_r72935710"},"pull_request":{"href":"https://api.github.com/repos/ReactiveX/RxNetty/pulls/525"}}},"pull_request":{"url":"https://api.github.com/repos/ReactiveX/RxNetty/pulls/525","id":75797469,"html_url":"https://github.com/ReactiveX/RxNetty/pull/525","diff_url":"https://github.com/ReactiveX/RxNetty/pull/525.diff","patch_url":"https://github.com/ReactiveX/RxNetty/pull/525.patch","issue_url":"https://api.github.com/repos/ReactiveX/RxNetty/issues/525","number":525,"state":"open","locked":false,"title":"Allow to return connections even if pool was already closed","user":{"login":"soemeier","id":1157427,"avatar_url":"https://avatars.githubusercontent.com/u/1157427?v=3","gravatar_id":"","url":"https://api.github.com/users/soemeier","html_url":"https://github.com/soemeier","followers_url":"https://api.github.com/users/soemeier/followers","following_url":"https://api.github.com/users/soemeier/following{/other_user}","gists_url":"https://api.github.com/users/soemeier/gists{/gist_id}","starred_url":"https://api.github.com/users/soemeier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soemeier/subscriptions","organizations_url":"https://api.github.com/users/soemeier/orgs","repos_url":"https://api.github.com/users/soemeier/repos","events_url":"https://api.github.com/users/soemeier/events{/privacy}","received_events_url":"https://api.github.com/users/soemeier/received_events","type":"User","site_admin":false},"body":"Fix for #523. I think I have also fixed the problem the you mentioned if the subscriber is being called when the pool is shutDown.","created_at":"2016-06-30T10:43:59Z","updated_at":"2016-08-01T07:48:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e07012d62eefba33fcee3e8ee5924ddf2acfaeff","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ReactiveX/RxNetty/pulls/525/commits","review_comments_url":"https://api.github.com/repos/ReactiveX/RxNetty/pulls/525/comments","review_comment_url":"https://api.github.com/repos/ReactiveX/RxNetty/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ReactiveX/RxNetty/issues/525/comments","statuses_url":"https://api.github.com/repos/ReactiveX/RxNetty/statuses/4b8fed676887b3bd590985b1c671dbf4c3d37e31","head":{"label":"soemeier:0.4.x","ref":"0.4.x","sha":"4b8fed676887b3bd590985b1c671dbf4c3d37e31","user":{"login":"soemeier","id":1157427,"avatar_url":"https://avatars.githubusercontent.com/u/1157427?v=3","gravatar_id":"","url":"https://api.github.com/users/soemeier","html_url":"https://github.com/soemeier","followers_url":"https://api.github.com/users/soemeier/followers","following_url":"https://api.github.com/users/soemeier/following{/other_user}","gists_url":"https://api.github.com/users/soemeier/gists{/gist_id}","starred_url":"https://api.github.com/users/soemeier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soemeier/subscriptions","organizations_url":"https://api.github.com/users/soemeier/orgs","repos_url":"https://api.github.com/users/soemeier/repos","events_url":"https://api.github.com/users/soemeier/events{/privacy}","received_events_url":"https://api.github.com/users/soemeier/received_events","type":"User","site_admin":false},"repo":{"id":62295957,"name":"RxNetty","full_name":"soemeier/RxNetty","owner":{"login":"soemeier","id":1157427,"avatar_url":"https://avatars.githubusercontent.com/u/1157427?v=3","gravatar_id":"","url":"https://api.github.com/users/soemeier","html_url":"https://github.com/soemeier","followers_url":"https://api.github.com/users/soemeier/followers","following_url":"https://api.github.com/users/soemeier/following{/other_user}","gists_url":"https://api.github.com/users/soemeier/gists{/gist_id}","starred_url":"https://api.github.com/users/soemeier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soemeier/subscriptions","organizations_url":"https://api.github.com/users/soemeier/orgs","repos_url":"https://api.github.com/users/soemeier/repos","events_url":"https://api.github.com/users/soemeier/events{/privacy}","received_events_url":"https://api.github.com/users/soemeier/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/soemeier/RxNetty","description":"Reactive Extension (Rx) Adaptor for Netty","fork":true,"url":"https://api.github.com/repos/soemeier/RxNetty","forks_url":"https://api.github.com/repos/soemeier/RxNetty/forks","keys_url":"https://api.github.com/repos/soemeier/RxNetty/keys{/key_id}","collaborators_url":"https://api.github.com/repos/soemeier/RxNetty/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/soemeier/RxNetty/teams","hooks_url":"https://api.github.com/repos/soemeier/RxNetty/hooks","issue_events_url":"https://api.github.com/repos/soemeier/RxNetty/issues/events{/number}","events_url":"https://api.github.com/repos/soemeier/RxNetty/events","assignees_url":"https://api.github.com/repos/soemeier/RxNetty/assignees{/user}","branches_url":"https://api.github.com/repos/soemeier/RxNetty/branches{/branch}","tags_url":"https://api.github.com/repos/soemeier/RxNetty/tags","blobs_url":"https://api.github.com/repos/soemeier/RxNetty/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/soemeier/RxNetty/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/soemeier/RxNetty/git/refs{/sha}","trees_url":"https://api.github.com/repos/soemeier/RxNetty/git/trees{/sha}","statuses_url":"https://api.github.com/repos/soemeier/RxNetty/statuses/{sha}","languages_url":"https://api.github.com/repos/soemeier/RxNetty/languages","stargazers_url":"https://api.github.com/repos/soemeier/RxNetty/stargazers","contributors_url":"https://api.github.com/repos/soemeier/RxNetty/contributors","subscribers_url":"https://api.github.com/repos/soemeier/RxNetty/subscribers","subscription_url":"https://api.github.com/repos/soemeier/RxNetty/subscription","commits_url":"https://api.github.com/repos/soemeier/RxNetty/commits{/sha}","git_commits_url":"https://api.github.com/repos/soemeier/RxNetty/git/commits{/sha}","comments_url":"https://api.github.com/repos/soemeier/RxNetty/comments{/number}","issue_comment_url":"https://api.github.com/repos/soemeier/RxNetty/issues/comments{/number}","contents_url":"https://api.github.com/repos/soemeier/RxNetty/contents/{+path}","compare_url":"https://api.github.com/repos/soemeier/RxNetty/compare/{base}...{head}","merges_url":"https://api.github.com/repos/soemeier/RxNetty/merges","archive_url":"https://api.github.com/repos/soemeier/RxNetty/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/soemeier/RxNetty/downloads","issues_url":"https://api.github.com/repos/soemeier/RxNetty/issues{/number}","pulls_url":"https://api.github.com/repos/soemeier/RxNetty/pulls{/number}","milestones_url":"https://api.github.com/repos/soemeier/RxNetty/milestones{/number}","notifications_url":"https://api.github.com/repos/soemeier/RxNetty/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/soemeier/RxNetty/labels{/name}","releases_url":"https://api.github.com/repos/soemeier/RxNetty/releases{/id}","deployments_url":"https://api.github.com/repos/soemeier/RxNetty/deployments","created_at":"2016-06-30T08:59:32Z","updated_at":"2016-06-30T08:59:35Z","pushed_at":"2016-07-18T13:23:21Z","git_url":"git://github.com/soemeier/RxNetty.git","ssh_url":"git@github.com:soemeier/RxNetty.git","clone_url":"https://github.com/soemeier/RxNetty.git","svn_url":"https://github.com/soemeier/RxNetty","homepage":null,"size":6582,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"0.5.x"}},"base":{"label":"ReactiveX:0.4.x","ref":"0.4.x","sha":"5a067fcfb97a4833f308009d93b9c8721cea4eb9","user":{"login":"ReactiveX","id":6407041,"avatar_url":"https://avatars.githubusercontent.com/u/6407041?v=3","gravatar_id":"","url":"https://api.github.com/users/ReactiveX","html_url":"https://github.com/ReactiveX","followers_url":"https://api.github.com/users/ReactiveX/followers","following_url":"https://api.github.com/users/ReactiveX/following{/other_user}","gists_url":"https://api.github.com/users/ReactiveX/gists{/gist_id}","starred_url":"https://api.github.com/users/ReactiveX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ReactiveX/subscriptions","organizations_url":"https://api.github.com/users/ReactiveX/orgs","repos_url":"https://api.github.com/users/ReactiveX/repos","events_url":"https://api.github.com/users/ReactiveX/events{/privacy}","received_events_url":"https://api.github.com/users/ReactiveX/received_events","type":"Organization","site_admin":false},"repo":{"id":14401179,"name":"RxNetty","full_name":"ReactiveX/RxNetty","owner":{"login":"ReactiveX","id":6407041,"avatar_url":"https://avatars.githubusercontent.com/u/6407041?v=3","gravatar_id":"","url":"https://api.github.com/users/ReactiveX","html_url":"https://github.com/ReactiveX","followers_url":"https://api.github.com/users/ReactiveX/followers","following_url":"https://api.github.com/users/ReactiveX/following{/other_user}","gists_url":"https://api.github.com/users/ReactiveX/gists{/gist_id}","starred_url":"https://api.github.com/users/ReactiveX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ReactiveX/subscriptions","organizations_url":"https://api.github.com/users/ReactiveX/orgs","repos_url":"https://api.github.com/users/ReactiveX/repos","events_url":"https://api.github.com/users/ReactiveX/events{/privacy}","received_events_url":"https://api.github.com/users/ReactiveX/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ReactiveX/RxNetty","description":"Reactive Extension (Rx) Adaptor for Netty","fork":false,"url":"https://api.github.com/repos/ReactiveX/RxNetty","forks_url":"https://api.github.com/repos/ReactiveX/RxNetty/forks","keys_url":"https://api.github.com/repos/ReactiveX/RxNetty/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ReactiveX/RxNetty/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ReactiveX/RxNetty/teams","hooks_url":"https://api.github.com/repos/ReactiveX/RxNetty/hooks","issue_events_url":"https://api.github.com/repos/ReactiveX/RxNetty/issues/events{/number}","events_url":"https://api.github.com/repos/ReactiveX/RxNetty/events","assignees_url":"https://api.github.com/repos/ReactiveX/RxNetty/assignees{/user}","branches_url":"https://api.github.com/repos/ReactiveX/RxNetty/branches{/branch}","tags_url":"https://api.github.com/repos/ReactiveX/RxNetty/tags","blobs_url":"https://api.github.com/repos/ReactiveX/RxNetty/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ReactiveX/RxNetty/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ReactiveX/RxNetty/git/refs{/sha}","trees_url":"https://api.github.com/repos/ReactiveX/RxNetty/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ReactiveX/RxNetty/statuses/{sha}","languages_url":"https://api.github.com/repos/ReactiveX/RxNetty/languages","stargazers_url":"https://api.github.com/repos/ReactiveX/RxNetty/stargazers","contributors_url":"https://api.github.com/repos/ReactiveX/RxNetty/contributors","subscribers_url":"https://api.github.com/repos/ReactiveX/RxNetty/subscribers","subscription_url":"https://api.github.com/repos/ReactiveX/RxNetty/subscription","commits_url":"https://api.github.com/repos/ReactiveX/RxNetty/commits{/sha}","git_commits_url":"https://api.github.com/repos/ReactiveX/RxNetty/git/commits{/sha}","comments_url":"https://api.github.com/repos/ReactiveX/RxNetty/comments{/number}","issue_comment_url":"https://api.github.com/repos/ReactiveX/RxNetty/issues/comments{/number}","contents_url":"https://api.github.com/repos/ReactiveX/RxNetty/contents/{+path}","compare_url":"https://api.github.com/repos/ReactiveX/RxNetty/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ReactiveX/RxNetty/merges","archive_url":"https://api.github.com/repos/ReactiveX/RxNetty/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ReactiveX/RxNetty/downloads","issues_url":"https://api.github.com/repos/ReactiveX/RxNetty/issues{/number}","pulls_url":"https://api.github.com/repos/ReactiveX/RxNetty/pulls{/number}","milestones_url":"https://api.github.com/repos/ReactiveX/RxNetty/milestones{/number}","notifications_url":"https://api.github.com/repos/ReactiveX/RxNetty/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ReactiveX/RxNetty/labels{/name}","releases_url":"https://api.github.com/repos/ReactiveX/RxNetty/releases{/id}","deployments_url":"https://api.github.com/repos/ReactiveX/RxNetty/deployments","created_at":"2013-11-14T16:52:06Z","updated_at":"2016-08-01T06:36:34Z","pushed_at":"2016-08-01T07:31:27Z","git_url":"git://github.com/ReactiveX/RxNetty.git","ssh_url":"git@github.com:ReactiveX/RxNetty.git","clone_url":"https://github.com/ReactiveX/RxNetty.git","svn_url":"https://github.com/ReactiveX/RxNetty","homepage":null,"size":7747,"stargazers_count":585,"watchers_count":585,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":151,"mirror_url":null,"open_issues_count":51,"forks":151,"open_issues":51,"watchers":585,"default_branch":"0.5.x"}},"_links":{"self":{"href":"https://api.github.com/repos/ReactiveX/RxNetty/pulls/525"},"html":{"href":"https://github.com/ReactiveX/RxNetty/pull/525"},"issue":{"href":"https://api.github.com/repos/ReactiveX/RxNetty/issues/525"},"comments":{"href":"https://api.github.com/repos/ReactiveX/RxNetty/issues/525/comments"},"review_comments":{"href":"https://api.github.com/repos/ReactiveX/RxNetty/pulls/525/comments"},"review_comment":{"href":"https://api.github.com/repos/ReactiveX/RxNetty/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ReactiveX/RxNetty/pulls/525/commits"},"statuses":{"href":"https://api.github.com/repos/ReactiveX/RxNetty/statuses/4b8fed676887b3bd590985b1c671dbf4c3d37e31"}}}}
{"actor":{"display_login":"NiteshKant"}}