{"action":"created","comment":{"url":"https://api.github.com/repos/apache/storm/pulls/comments/50978024","id":50978024,"diff_hunk":"@@ -0,0 +1,135 @@\n+/**\n+ * Licensed to the Apache Software Foundation (ASF) under one\n+ * or more contributor license agreements.  See the NOTICE file\n+ * distributed with this work for additional information\n+ * regarding copyright ownership.  The ASF licenses this file\n+ * to you under the Apache License, Version 2.0 (the\n+ * \"License\"); you may not use this file except in compliance\n+ * with the License.  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+package org.apache.storm.zookeeper;\n+\n+import org.apache.curator.framework.CuratorFramework;\n+import org.apache.curator.framework.recipes.leader.LeaderLatch;\n+import org.apache.curator.framework.recipes.leader.LeaderLatchListener;\n+import org.apache.curator.framework.recipes.leader.Participant;\n+import org.apache.storm.nimbus.ILeaderElector;\n+import org.apache.storm.nimbus.NimbusInfo;\n+import org.apache.storm.utils.Utils;\n+import org.slf4j.Logger;\n+import org.slf4j.LoggerFactory;\n+\n+import java.io.IOException;\n+import java.util.ArrayList;\n+import java.util.Collection;\n+import java.util.List;\n+import java.util.Map;\n+import java.util.concurrent.atomic.AtomicReference;\n+\n+\n+public class LeaderElectorImp implements ILeaderElector {\n+    private static Logger LOG = LoggerFactory.getLogger(LeaderElectorImp.class);\n+    private Map conf;\n+    private List<String> servers;\n+    private CuratorFramework zk;\n+    private String leaderlockPath;\n+    private String id;\n+    private AtomicReference<LeaderLatch> leaderLatch;\n+    private AtomicReference<LeaderLatchListener> leaderLatchListener;","path":"storm-core/src/jvm/org/apache/storm/zookeeper/LeaderElectorImp.java","position":46,"original_position":46,"commit_id":"d66ae23ec4e0aa49a285025acac9406c500e2c62","original_commit_id":"d66ae23ec4e0aa49a285025acac9406c500e2c62","user":{"login":"hustfxj","id":7270212,"avatar_url":"https://avatars.githubusercontent.com/u/7270212?v=3","gravatar_id":"","url":"https://api.github.com/users/hustfxj","html_url":"https://github.com/hustfxj","followers_url":"https://api.github.com/users/hustfxj/followers","following_url":"https://api.github.com/users/hustfxj/following{/other_user}","gists_url":"https://api.github.com/users/hustfxj/gists{/gist_id}","starred_url":"https://api.github.com/users/hustfxj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hustfxj/subscriptions","organizations_url":"https://api.github.com/users/hustfxj/orgs","repos_url":"https://api.github.com/users/hustfxj/repos","events_url":"https://api.github.com/users/hustfxj/events{/privacy}","received_events_url":"https://api.github.com/users/hustfxj/received_events","type":"User","site_admin":false},"body":"ok","created_at":"2016-01-27T12:40:56Z","updated_at":"2016-01-27T12:40:56Z","html_url":"https://github.com/apache/storm/pull/1047#discussion_r50978024","pull_request_url":"https://api.github.com/repos/apache/storm/pulls/1047","_links":{"self":{"href":"https://api.github.com/repos/apache/storm/pulls/comments/50978024"},"html":{"href":"https://github.com/apache/storm/pull/1047#discussion_r50978024"},"pull_request":{"href":"https://api.github.com/repos/apache/storm/pulls/1047"}}},"pull_request":{"url":"https://api.github.com/repos/apache/storm/pulls/1047","id":57185715,"html_url":"https://github.com/apache/storm/pull/1047","diff_url":"https://github.com/apache/storm/pull/1047.diff","patch_url":"https://github.com/apache/storm/pull/1047.patch","issue_url":"https://api.github.com/repos/apache/storm/issues/1047","number":1047,"state":"open","locked":false,"title":"[STORM-1257] port backtype.storm.zookeeper to java","user":{"login":"hustfxj","id":7270212,"avatar_url":"https://avatars.githubusercontent.com/u/7270212?v=3","gravatar_id":"","url":"https://api.github.com/users/hustfxj","html_url":"https://github.com/hustfxj","followers_url":"https://api.github.com/users/hustfxj/followers","following_url":"https://api.github.com/users/hustfxj/following{/other_user}","gists_url":"https://api.github.com/users/hustfxj/gists{/gist_id}","starred_url":"https://api.github.com/users/hustfxj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hustfxj/subscriptions","organizations_url":"https://api.github.com/users/hustfxj/orgs","repos_url":"https://api.github.com/users/hustfxj/repos","events_url":"https://api.github.com/users/hustfxj/events{/privacy}","received_events_url":"https://api.github.com/users/hustfxj/received_events","type":"User","site_admin":false},"body":"1.  Port \"org.apache.storm.zookeeper\" to java at \"org.apache.storm.zookeeper.Zookeeper\".\r\n2.  Update all the callings to the config functions.\r\n3.  Deleted most functions in zookeeper.clj except a few: mk-client (because of \"watcher\" which is derived by clojure in some .clj files).\r\n4.  add the package \"Callback\", where callback functions put. I am merging clusters and timer which involves lots of callback functions. I put them into package \"Callback\".","created_at":"2016-01-26T09:17:09Z","updated_at":"2016-01-27T12:40:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1167da9b6342f4b4b518869927fcfb5cf657a453","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/storm/pulls/1047/commits","review_comments_url":"https://api.github.com/repos/apache/storm/pulls/1047/comments","review_comment_url":"https://api.github.com/repos/apache/storm/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/storm/issues/1047/comments","statuses_url":"https://api.github.com/repos/apache/storm/statuses/d66ae23ec4e0aa49a285025acac9406c500e2c62","head":{"label":"hustfxj:zookeeper","ref":"zookeeper","sha":"d66ae23ec4e0aa49a285025acac9406c500e2c62","user":{"login":"hustfxj","id":7270212,"avatar_url":"https://avatars.githubusercontent.com/u/7270212?v=3","gravatar_id":"","url":"https://api.github.com/users/hustfxj","html_url":"https://github.com/hustfxj","followers_url":"https://api.github.com/users/hustfxj/followers","following_url":"https://api.github.com/users/hustfxj/following{/other_user}","gists_url":"https://api.github.com/users/hustfxj/gists{/gist_id}","starred_url":"https://api.github.com/users/hustfxj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hustfxj/subscriptions","organizations_url":"https://api.github.com/users/hustfxj/orgs","repos_url":"https://api.github.com/users/hustfxj/repos","events_url":"https://api.github.com/users/hustfxj/events{/privacy}","received_events_url":"https://api.github.com/users/hustfxj/received_events","type":"User","site_admin":false},"repo":{"id":50340543,"name":"storm","full_name":"hustfxj/storm","owner":{"login":"hustfxj","id":7270212,"avatar_url":"https://avatars.githubusercontent.com/u/7270212?v=3","gravatar_id":"","url":"https://api.github.com/users/hustfxj","html_url":"https://github.com/hustfxj","followers_url":"https://api.github.com/users/hustfxj/followers","following_url":"https://api.github.com/users/hustfxj/following{/other_user}","gists_url":"https://api.github.com/users/hustfxj/gists{/gist_id}","starred_url":"https://api.github.com/users/hustfxj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hustfxj/subscriptions","organizations_url":"https://api.github.com/users/hustfxj/orgs","repos_url":"https://api.github.com/users/hustfxj/repos","events_url":"https://api.github.com/users/hustfxj/events{/privacy}","received_events_url":"https://api.github.com/users/hustfxj/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hustfxj/storm","description":"Mirror of Apache Storm","fork":true,"url":"https://api.github.com/repos/hustfxj/storm","forks_url":"https://api.github.com/repos/hustfxj/storm/forks","keys_url":"https://api.github.com/repos/hustfxj/storm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hustfxj/storm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hustfxj/storm/teams","hooks_url":"https://api.github.com/repos/hustfxj/storm/hooks","issue_events_url":"https://api.github.com/repos/hustfxj/storm/issues/events{/number}","events_url":"https://api.github.com/repos/hustfxj/storm/events","assignees_url":"https://api.github.com/repos/hustfxj/storm/assignees{/user}","branches_url":"https://api.github.com/repos/hustfxj/storm/branches{/branch}","tags_url":"https://api.github.com/repos/hustfxj/storm/tags","blobs_url":"https://api.github.com/repos/hustfxj/storm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hustfxj/storm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hustfxj/storm/git/refs{/sha}","trees_url":"https://api.github.com/repos/hustfxj/storm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hustfxj/storm/statuses/{sha}","languages_url":"https://api.github.com/repos/hustfxj/storm/languages","stargazers_url":"https://api.github.com/repos/hustfxj/storm/stargazers","contributors_url":"https://api.github.com/repos/hustfxj/storm/contributors","subscribers_url":"https://api.github.com/repos/hustfxj/storm/subscribers","subscription_url":"https://api.github.com/repos/hustfxj/storm/subscription","commits_url":"https://api.github.com/repos/hustfxj/storm/commits{/sha}","git_commits_url":"https://api.github.com/repos/hustfxj/storm/git/commits{/sha}","comments_url":"https://api.github.com/repos/hustfxj/storm/comments{/number}","issue_comment_url":"https://api.github.com/repos/hustfxj/storm/issues/comments{/number}","contents_url":"https://api.github.com/repos/hustfxj/storm/contents/{+path}","compare_url":"https://api.github.com/repos/hustfxj/storm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hustfxj/storm/merges","archive_url":"https://api.github.com/repos/hustfxj/storm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hustfxj/storm/downloads","issues_url":"https://api.github.com/repos/hustfxj/storm/issues{/number}","pulls_url":"https://api.github.com/repos/hustfxj/storm/pulls{/number}","milestones_url":"https://api.github.com/repos/hustfxj/storm/milestones{/number}","notifications_url":"https://api.github.com/repos/hustfxj/storm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hustfxj/storm/labels{/name}","releases_url":"https://api.github.com/repos/hustfxj/storm/releases{/id}","deployments_url":"https://api.github.com/repos/hustfxj/storm/deployments","created_at":"2016-01-25T09:34:58Z","updated_at":"2016-01-25T09:35:02Z","pushed_at":"2016-01-26T09:13:25Z","git_url":"git://github.com/hustfxj/storm.git","ssh_url":"git@github.com:hustfxj/storm.git","clone_url":"https://github.com/hustfxj/storm.git","svn_url":"https://github.com/hustfxj/storm","homepage":null,"size":154392,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"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":"apache:master","ref":"master","sha":"ecce1ceb06e40e15d838e583e708bb7e077389de","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":14135470,"name":"storm","full_name":"apache/storm","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/storm","description":"Mirror of Apache Storm","fork":false,"url":"https://api.github.com/repos/apache/storm","forks_url":"https://api.github.com/repos/apache/storm/forks","keys_url":"https://api.github.com/repos/apache/storm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/storm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/storm/teams","hooks_url":"https://api.github.com/repos/apache/storm/hooks","issue_events_url":"https://api.github.com/repos/apache/storm/issues/events{/number}","events_url":"https://api.github.com/repos/apache/storm/events","assignees_url":"https://api.github.com/repos/apache/storm/assignees{/user}","branches_url":"https://api.github.com/repos/apache/storm/branches{/branch}","tags_url":"https://api.github.com/repos/apache/storm/tags","blobs_url":"https://api.github.com/repos/apache/storm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/storm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/storm/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/storm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/storm/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/storm/languages","stargazers_url":"https://api.github.com/repos/apache/storm/stargazers","contributors_url":"https://api.github.com/repos/apache/storm/contributors","subscribers_url":"https://api.github.com/repos/apache/storm/subscribers","subscription_url":"https://api.github.com/repos/apache/storm/subscription","commits_url":"https://api.github.com/repos/apache/storm/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/storm/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/storm/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/storm/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/storm/contents/{+path}","compare_url":"https://api.github.com/repos/apache/storm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/storm/merges","archive_url":"https://api.github.com/repos/apache/storm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/storm/downloads","issues_url":"https://api.github.com/repos/apache/storm/issues{/number}","pulls_url":"https://api.github.com/repos/apache/storm/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/storm/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/storm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/storm/labels{/name}","releases_url":"https://api.github.com/repos/apache/storm/releases{/id}","deployments_url":"https://api.github.com/repos/apache/storm/deployments","created_at":"2013-11-05T08:00:14Z","updated_at":"2016-01-27T12:08:14Z","pushed_at":"2016-01-27T10:39:50Z","git_url":"git://github.com/apache/storm.git","ssh_url":"git@github.com:apache/storm.git","clone_url":"https://github.com/apache/storm.git","svn_url":"https://github.com/apache/storm","homepage":null,"size":157594,"stargazers_count":2785,"watchers_count":2785,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":2090,"mirror_url":"git://git.apache.org/storm.git","open_issues_count":67,"forks":2090,"open_issues":67,"watchers":2785,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/storm/pulls/1047"},"html":{"href":"https://github.com/apache/storm/pull/1047"},"issue":{"href":"https://api.github.com/repos/apache/storm/issues/1047"},"comments":{"href":"https://api.github.com/repos/apache/storm/issues/1047/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/storm/pulls/1047/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/storm/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/storm/pulls/1047/commits"},"statuses":{"href":"https://api.github.com/repos/apache/storm/statuses/d66ae23ec4e0aa49a285025acac9406c500e2c62"}}}}