{"action":"created","comment":{"url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/pulls/comments/27468036","id":27468036,"diff_hunk":"@@ -0,0 +1,110 @@\n+package redis.clients.jedis;\n+\n+import redis.clients.jedis.errors.SilentErrorHandler;\n+import redis.clients.jedis.exceptions.JedisConnectionException;\n+\n+import java.util.ArrayList;\n+import java.util.Arrays;\n+import java.util.Collections;\n+import java.util.List;\n+import java.util.concurrent.atomic.AtomicBoolean;\n+\n+/**\n+* Created by piotrturek on 29/03/15.\n+*/\n+class MasterListener extends Thread {\n+\n+    private ShardedJedisSentinelPool shardedJedisSentinelPool;\n+    protected List<String> masters;\n+    protected String host;\n+    protected int port;\n+    protected Jedis jedis;\n+    protected AtomicBoolean running = new AtomicBoolean(false);\n+    private MasterListenerErrorHandler errorHandler;\n+\n+    protected MasterListener(ShardedJedisSentinelPool shardedJedisSentinelPool) {\n+        this.shardedJedisSentinelPool = shardedJedisSentinelPool;\n+    }\n+\n+    public MasterListener(ShardedJedisSentinelPool shardedJedisSentinelPool, List<String> masters, String host, int port) {\n+        this.shardedJedisSentinelPool = shardedJedisSentinelPool;\n+        this.masters = masters;\n+        this.host = host;\n+        this.port = port;\n+        this.errorHandler = new SilentErrorHandler(\"Sentinel at \" + host + \" and port \" + port, shardedJedisSentinelPool.log);","path":"src/main/java/redis/clients/jedis/MasterListener.java","position":34,"original_position":34,"commit_id":"5c087aee3af99b653ec8ea43af687cc0aad6d3fc","original_commit_id":"5c087aee3af99b653ec8ea43af687cc0aad6d3fc","user":{"login":"turu","id":3460101,"avatar_url":"https://avatars.githubusercontent.com/u/3460101?v=3","gravatar_id":"","url":"https://api.github.com/users/turu","html_url":"https://github.com/turu","followers_url":"https://api.github.com/users/turu/followers","following_url":"https://api.github.com/users/turu/following{/other_user}","gists_url":"https://api.github.com/users/turu/gists{/gist_id}","starred_url":"https://api.github.com/users/turu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/turu/subscriptions","organizations_url":"https://api.github.com/users/turu/orgs","repos_url":"https://api.github.com/users/turu/repos","events_url":"https://api.github.com/users/turu/events{/privacy}","received_events_url":"https://api.github.com/users/turu/received_events","type":"User","site_admin":false},"body":"There are two reasons:\r\n- keep the behaviour consistent with previous version of the library and log as ConnectionPool\r\n- make it testable","created_at":"2015-03-31T10:31:27Z","updated_at":"2015-03-31T10:31:27Z","html_url":"https://github.com/fstech/sharded-jedis-sentinel-pool/pull/1#discussion_r27468036","pull_request_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/pulls/comments/27468036"},"html":{"href":"https://github.com/fstech/sharded-jedis-sentinel-pool/pull/1#discussion_r27468036"},"pull_request":{"href":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/pulls/1","id":32251733,"html_url":"https://github.com/fstech/sharded-jedis-sentinel-pool/pull/1","diff_url":"https://github.com/fstech/sharded-jedis-sentinel-pool/pull/1.diff","patch_url":"https://github.com/fstech/sharded-jedis-sentinel-pool/pull/1.patch","issue_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/issues/1","number":1,"state":"open","locked":false,"title":"Keep connection alive","user":{"login":"turu","id":3460101,"avatar_url":"https://avatars.githubusercontent.com/u/3460101?v=3","gravatar_id":"","url":"https://api.github.com/users/turu","html_url":"https://github.com/turu","followers_url":"https://api.github.com/users/turu/followers","following_url":"https://api.github.com/users/turu/following{/other_user}","gists_url":"https://api.github.com/users/turu/gists{/gist_id}","starred_url":"https://api.github.com/users/turu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/turu/subscriptions","organizations_url":"https://api.github.com/users/turu/orgs","repos_url":"https://api.github.com/users/turu/repos","events_url":"https://api.github.com/users/turu/events{/privacy}","received_events_url":"https://api.github.com/users/turu/received_events","type":"User","site_admin":false},"body":"- bumped jedis version (according to release notes, we can expect \"HUGE\" performance optimizations :P)\r\n- bumped embedded redis\r\n- removed dependency on Spring\r\n- started to refactor the pool by extracting inner classes outside of this mess\r\n- introduced an error handling strategy to MasterListener and refactored listener a bit\r\n- implemented a simple error handling strategy that logs connection errors as severe only when they occur less than predefined grace period away from the previous failure. otherwise it logs fine. this should handle both the case of a broken Sentinel and silent Rollbar at the same time\r\n- added integration test for master failover to check that this shit actually works :P ","created_at":"2015-03-30T18:09:05Z","updated_at":"2015-03-31T10:31:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"82b8fe222c5a9597ed8e41682b8efda0cb9b10dc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/pulls/1/commits","review_comments_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/pulls/1/comments","review_comment_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/issues/1/comments","statuses_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/statuses/5c087aee3af99b653ec8ea43af687cc0aad6d3fc","head":{"label":"fstech:keep_connection_alive","ref":"keep_connection_alive","sha":"5c087aee3af99b653ec8ea43af687cc0aad6d3fc","user":{"login":"fstech","id":973851,"avatar_url":"https://avatars.githubusercontent.com/u/973851?v=3","gravatar_id":"","url":"https://api.github.com/users/fstech","html_url":"https://github.com/fstech","followers_url":"https://api.github.com/users/fstech/followers","following_url":"https://api.github.com/users/fstech/following{/other_user}","gists_url":"https://api.github.com/users/fstech/gists{/gist_id}","starred_url":"https://api.github.com/users/fstech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fstech/subscriptions","organizations_url":"https://api.github.com/users/fstech/orgs","repos_url":"https://api.github.com/users/fstech/repos","events_url":"https://api.github.com/users/fstech/events{/privacy}","received_events_url":"https://api.github.com/users/fstech/received_events","type":"Organization","site_admin":false},"repo":{"id":29868352,"name":"sharded-jedis-sentinel-pool","full_name":"fstech/sharded-jedis-sentinel-pool","owner":{"login":"fstech","id":973851,"avatar_url":"https://avatars.githubusercontent.com/u/973851?v=3","gravatar_id":"","url":"https://api.github.com/users/fstech","html_url":"https://github.com/fstech","followers_url":"https://api.github.com/users/fstech/followers","following_url":"https://api.github.com/users/fstech/following{/other_user}","gists_url":"https://api.github.com/users/fstech/gists{/gist_id}","starred_url":"https://api.github.com/users/fstech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fstech/subscriptions","organizations_url":"https://api.github.com/users/fstech/orgs","repos_url":"https://api.github.com/users/fstech/repos","events_url":"https://api.github.com/users/fstech/events{/privacy}","received_events_url":"https://api.github.com/users/fstech/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fstech/sharded-jedis-sentinel-pool","description":"Sharded Jedis Sentinel Pool used to obtain ShardedJedis resources from HA Redis cluster","fork":true,"url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool","forks_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/forks","keys_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/teams","hooks_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/hooks","issue_events_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/issues/events{/number}","events_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/events","assignees_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/assignees{/user}","branches_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/branches{/branch}","tags_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/tags","blobs_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/git/refs{/sha}","trees_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/statuses/{sha}","languages_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/languages","stargazers_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/stargazers","contributors_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/contributors","subscribers_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/subscribers","subscription_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/subscription","commits_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/commits{/sha}","git_commits_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/git/commits{/sha}","comments_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/comments{/number}","issue_comment_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/issues/comments{/number}","contents_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/contents/{+path}","compare_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/merges","archive_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/downloads","issues_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/issues{/number}","pulls_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/pulls{/number}","milestones_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/milestones{/number}","notifications_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/labels{/name}","releases_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/releases{/id}","created_at":"2015-01-26T15:54:50Z","updated_at":"2015-01-27T16:53:12Z","pushed_at":"2015-03-30T18:09:06Z","git_url":"git://github.com/fstech/sharded-jedis-sentinel-pool.git","ssh_url":"git@github.com:fstech/sharded-jedis-sentinel-pool.git","clone_url":"https://github.com/fstech/sharded-jedis-sentinel-pool.git","svn_url":"https://github.com/fstech/sharded-jedis-sentinel-pool","homepage":"","size":183,"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":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"fstech:master","ref":"master","sha":"f5979c2b3dd6530945d0224ae8b81453b134a82d","user":{"login":"fstech","id":973851,"avatar_url":"https://avatars.githubusercontent.com/u/973851?v=3","gravatar_id":"","url":"https://api.github.com/users/fstech","html_url":"https://github.com/fstech","followers_url":"https://api.github.com/users/fstech/followers","following_url":"https://api.github.com/users/fstech/following{/other_user}","gists_url":"https://api.github.com/users/fstech/gists{/gist_id}","starred_url":"https://api.github.com/users/fstech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fstech/subscriptions","organizations_url":"https://api.github.com/users/fstech/orgs","repos_url":"https://api.github.com/users/fstech/repos","events_url":"https://api.github.com/users/fstech/events{/privacy}","received_events_url":"https://api.github.com/users/fstech/received_events","type":"Organization","site_admin":false},"repo":{"id":29868352,"name":"sharded-jedis-sentinel-pool","full_name":"fstech/sharded-jedis-sentinel-pool","owner":{"login":"fstech","id":973851,"avatar_url":"https://avatars.githubusercontent.com/u/973851?v=3","gravatar_id":"","url":"https://api.github.com/users/fstech","html_url":"https://github.com/fstech","followers_url":"https://api.github.com/users/fstech/followers","following_url":"https://api.github.com/users/fstech/following{/other_user}","gists_url":"https://api.github.com/users/fstech/gists{/gist_id}","starred_url":"https://api.github.com/users/fstech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fstech/subscriptions","organizations_url":"https://api.github.com/users/fstech/orgs","repos_url":"https://api.github.com/users/fstech/repos","events_url":"https://api.github.com/users/fstech/events{/privacy}","received_events_url":"https://api.github.com/users/fstech/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fstech/sharded-jedis-sentinel-pool","description":"Sharded Jedis Sentinel Pool used to obtain ShardedJedis resources from HA Redis cluster","fork":true,"url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool","forks_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/forks","keys_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/teams","hooks_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/hooks","issue_events_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/issues/events{/number}","events_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/events","assignees_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/assignees{/user}","branches_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/branches{/branch}","tags_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/tags","blobs_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/git/refs{/sha}","trees_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/statuses/{sha}","languages_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/languages","stargazers_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/stargazers","contributors_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/contributors","subscribers_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/subscribers","subscription_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/subscription","commits_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/commits{/sha}","git_commits_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/git/commits{/sha}","comments_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/comments{/number}","issue_comment_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/issues/comments{/number}","contents_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/contents/{+path}","compare_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/merges","archive_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/downloads","issues_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/issues{/number}","pulls_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/pulls{/number}","milestones_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/milestones{/number}","notifications_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/labels{/name}","releases_url":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/releases{/id}","created_at":"2015-01-26T15:54:50Z","updated_at":"2015-01-27T16:53:12Z","pushed_at":"2015-03-30T18:09:06Z","git_url":"git://github.com/fstech/sharded-jedis-sentinel-pool.git","ssh_url":"git@github.com:fstech/sharded-jedis-sentinel-pool.git","clone_url":"https://github.com/fstech/sharded-jedis-sentinel-pool.git","svn_url":"https://github.com/fstech/sharded-jedis-sentinel-pool","homepage":"","size":183,"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":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/pulls/1"},"html":{"href":"https://github.com/fstech/sharded-jedis-sentinel-pool/pull/1"},"issue":{"href":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/issues/1"},"comments":{"href":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/fstech/sharded-jedis-sentinel-pool/statuses/5c087aee3af99b653ec8ea43af687cc0aad6d3fc"}}}}