{"action":"created","comment":{"url":"https://api.github.com/repos/linkedin/gobblin/pulls/comments/57217346","id":57217346,"diff_hunk":"@@ -0,0 +1,55 @@\n+/*\n+ * Copyright (C) 2014-2016 LinkedIn Corp. All rights reserved.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use\n+ * this file except in compliance with the License. You may obtain a copy of the\n+ * License at  http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software distributed\n+ * under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n+ * CONDITIONS OF ANY KIND, either express or implied.\n+ */\n+\n+package gobblin.runtime.locks;\n+\n+import java.util.Properties;\n+\n+import gobblin.configuration.ConfigurationKeys;\n+\n+\n+/**\n+ * The factory used to create instances of {@link JobLock}.\n+ *\n+ * @author joelbaranick\n+ */\n+public class JobLockFactory {\n+  private JobLockFactory() {\n+  }\n+\n+  /**\n+   * Gets an instance of {@link JobLock}.\n+   *\n+   * @param properties the properties used to determine which instance of {@link JobLock} to create and the\n+   *                   relevant settings\n+   * @param jobLockEventListener the {@link JobLock} event listener\n+   * @return an instance of {@link JobLock}\n+   * @throws JobLockException throw when the {@link JobLock} fails to initialize\n+   */\n+  public static JobLock getJobLock(Properties properties, JobLockEventListener jobLockEventListener)\n+          throws JobLockException {\n+    JobLock jobLock;\n+    if (properties.containsKey(ConfigurationKeys.JOB_LOCK_TYPE)) {\n+      try {\n+        Class<?> jobLockClass = Class.forName(\n+                properties.getProperty(ConfigurationKeys.JOB_LOCK_TYPE, FileBasedJobLock.class.getSimpleName()));\n+        jobLock = (JobLock) jobLockClass.newInstance();\n+      } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {\n+        jobLock = new FileBasedJobLock();","path":"gobblin-runtime/src/main/java/gobblin/runtime/locks/JobLockFactory.java","position":47,"original_position":47,"commit_id":"15b5e24b7171fd60f17b32b517f358d995f902b6","original_commit_id":"15b5e24b7171fd60f17b32b517f358d995f902b6","user":{"login":"kadaan","id":1904898,"avatar_url":"https://avatars.githubusercontent.com/u/1904898?v=3","gravatar_id":"","url":"https://api.github.com/users/kadaan","html_url":"https://github.com/kadaan","followers_url":"https://api.github.com/users/kadaan/followers","following_url":"https://api.github.com/users/kadaan/following{/other_user}","gists_url":"https://api.github.com/users/kadaan/gists{/gist_id}","starred_url":"https://api.github.com/users/kadaan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kadaan/subscriptions","organizations_url":"https://api.github.com/users/kadaan/orgs","repos_url":"https://api.github.com/users/kadaan/repos","events_url":"https://api.github.com/users/kadaan/events{/privacy}","received_events_url":"https://api.github.com/users/kadaan/received_events","type":"User","site_admin":false},"body":"Yes, I will handle missing and invalid differently","created_at":"2016-03-23T18:57:19Z","updated_at":"2016-03-23T18:57:19Z","html_url":"https://github.com/linkedin/gobblin/pull/828#discussion_r57217346","pull_request_url":"https://api.github.com/repos/linkedin/gobblin/pulls/828","_links":{"self":{"href":"https://api.github.com/repos/linkedin/gobblin/pulls/comments/57217346"},"html":{"href":"https://github.com/linkedin/gobblin/pull/828#discussion_r57217346"},"pull_request":{"href":"https://api.github.com/repos/linkedin/gobblin/pulls/828"}}},"pull_request":{"url":"https://api.github.com/repos/linkedin/gobblin/pulls/828","id":62460257,"html_url":"https://github.com/linkedin/gobblin/pull/828","diff_url":"https://github.com/linkedin/gobblin/pull/828.diff","patch_url":"https://github.com/linkedin/gobblin/pull/828.patch","issue_url":"https://api.github.com/repos/linkedin/gobblin/issues/828","number":828,"state":"open","locked":false,"title":"Add zookeeper based job lock for gobblin yarn","user":{"login":"kadaan","id":1904898,"avatar_url":"https://avatars.githubusercontent.com/u/1904898?v=3","gravatar_id":"","url":"https://api.github.com/users/kadaan","html_url":"https://github.com/kadaan","followers_url":"https://api.github.com/users/kadaan/followers","following_url":"https://api.github.com/users/kadaan/following{/other_user}","gists_url":"https://api.github.com/users/kadaan/gists{/gist_id}","starred_url":"https://api.github.com/users/kadaan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kadaan/subscriptions","organizations_url":"https://api.github.com/users/kadaan/orgs","repos_url":"https://api.github.com/users/kadaan/repos","events_url":"https://api.github.com/users/kadaan/events{/privacy}","received_events_url":"https://api.github.com/users/kadaan/received_events","type":"User","site_admin":false},"body":"@sahilTakiar Here is the `ZookeeperBasedJobLock` that we discussed in #754.  The only part I'm a little unsure about is the cancellation of a running job if the connection to ZK is lost.  I think it is needed to ensure that duplicate jobs are not running, but I'm not sure if the mean of cancellation is correct.","created_at":"2016-03-10T21:38:40Z","updated_at":"2016-03-23T18:57:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"322a185b7e41c7184462ba80bf02003895eb7c93","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/linkedin/gobblin/pulls/828/commits","review_comments_url":"https://api.github.com/repos/linkedin/gobblin/pulls/828/comments","review_comment_url":"https://api.github.com/repos/linkedin/gobblin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/linkedin/gobblin/issues/828/comments","statuses_url":"https://api.github.com/repos/linkedin/gobblin/statuses/15b5e24b7171fd60f17b32b517f358d995f902b6","head":{"label":"kadaan:ZookeeperJobLock","ref":"ZookeeperJobLock","sha":"15b5e24b7171fd60f17b32b517f358d995f902b6","user":{"login":"kadaan","id":1904898,"avatar_url":"https://avatars.githubusercontent.com/u/1904898?v=3","gravatar_id":"","url":"https://api.github.com/users/kadaan","html_url":"https://github.com/kadaan","followers_url":"https://api.github.com/users/kadaan/followers","following_url":"https://api.github.com/users/kadaan/following{/other_user}","gists_url":"https://api.github.com/users/kadaan/gists{/gist_id}","starred_url":"https://api.github.com/users/kadaan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kadaan/subscriptions","organizations_url":"https://api.github.com/users/kadaan/orgs","repos_url":"https://api.github.com/users/kadaan/repos","events_url":"https://api.github.com/users/kadaan/events{/privacy}","received_events_url":"https://api.github.com/users/kadaan/received_events","type":"User","site_admin":false},"repo":{"id":47274294,"name":"gobblin","full_name":"kadaan/gobblin","owner":{"login":"kadaan","id":1904898,"avatar_url":"https://avatars.githubusercontent.com/u/1904898?v=3","gravatar_id":"","url":"https://api.github.com/users/kadaan","html_url":"https://github.com/kadaan","followers_url":"https://api.github.com/users/kadaan/followers","following_url":"https://api.github.com/users/kadaan/following{/other_user}","gists_url":"https://api.github.com/users/kadaan/gists{/gist_id}","starred_url":"https://api.github.com/users/kadaan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kadaan/subscriptions","organizations_url":"https://api.github.com/users/kadaan/orgs","repos_url":"https://api.github.com/users/kadaan/repos","events_url":"https://api.github.com/users/kadaan/events{/privacy}","received_events_url":"https://api.github.com/users/kadaan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kadaan/gobblin","description":"Universal data ingestion framework for Hadoop.","fork":true,"url":"https://api.github.com/repos/kadaan/gobblin","forks_url":"https://api.github.com/repos/kadaan/gobblin/forks","keys_url":"https://api.github.com/repos/kadaan/gobblin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kadaan/gobblin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kadaan/gobblin/teams","hooks_url":"https://api.github.com/repos/kadaan/gobblin/hooks","issue_events_url":"https://api.github.com/repos/kadaan/gobblin/issues/events{/number}","events_url":"https://api.github.com/repos/kadaan/gobblin/events","assignees_url":"https://api.github.com/repos/kadaan/gobblin/assignees{/user}","branches_url":"https://api.github.com/repos/kadaan/gobblin/branches{/branch}","tags_url":"https://api.github.com/repos/kadaan/gobblin/tags","blobs_url":"https://api.github.com/repos/kadaan/gobblin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kadaan/gobblin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kadaan/gobblin/git/refs{/sha}","trees_url":"https://api.github.com/repos/kadaan/gobblin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kadaan/gobblin/statuses/{sha}","languages_url":"https://api.github.com/repos/kadaan/gobblin/languages","stargazers_url":"https://api.github.com/repos/kadaan/gobblin/stargazers","contributors_url":"https://api.github.com/repos/kadaan/gobblin/contributors","subscribers_url":"https://api.github.com/repos/kadaan/gobblin/subscribers","subscription_url":"https://api.github.com/repos/kadaan/gobblin/subscription","commits_url":"https://api.github.com/repos/kadaan/gobblin/commits{/sha}","git_commits_url":"https://api.github.com/repos/kadaan/gobblin/git/commits{/sha}","comments_url":"https://api.github.com/repos/kadaan/gobblin/comments{/number}","issue_comment_url":"https://api.github.com/repos/kadaan/gobblin/issues/comments{/number}","contents_url":"https://api.github.com/repos/kadaan/gobblin/contents/{+path}","compare_url":"https://api.github.com/repos/kadaan/gobblin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kadaan/gobblin/merges","archive_url":"https://api.github.com/repos/kadaan/gobblin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kadaan/gobblin/downloads","issues_url":"https://api.github.com/repos/kadaan/gobblin/issues{/number}","pulls_url":"https://api.github.com/repos/kadaan/gobblin/pulls{/number}","milestones_url":"https://api.github.com/repos/kadaan/gobblin/milestones{/number}","notifications_url":"https://api.github.com/repos/kadaan/gobblin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kadaan/gobblin/labels{/name}","releases_url":"https://api.github.com/repos/kadaan/gobblin/releases{/id}","deployments_url":"https://api.github.com/repos/kadaan/gobblin/deployments","created_at":"2015-12-02T16:40:10Z","updated_at":"2016-01-11T23:41:37Z","pushed_at":"2016-03-23T05:44:04Z","git_url":"git://github.com/kadaan/gobblin.git","ssh_url":"git@github.com:kadaan/gobblin.git","clone_url":"https://github.com/kadaan/gobblin.git","svn_url":"https://github.com/kadaan/gobblin","homepage":"https://github.com/linkedin/gobblin/wiki","size":85478,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":3,"forks":2,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"linkedin:master","ref":"master","sha":"6fa4bd493b3acc1d20844b64100514ae8405cbe8","user":{"login":"linkedin","id":357098,"avatar_url":"https://avatars.githubusercontent.com/u/357098?v=3","gravatar_id":"","url":"https://api.github.com/users/linkedin","html_url":"https://github.com/linkedin","followers_url":"https://api.github.com/users/linkedin/followers","following_url":"https://api.github.com/users/linkedin/following{/other_user}","gists_url":"https://api.github.com/users/linkedin/gists{/gist_id}","starred_url":"https://api.github.com/users/linkedin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linkedin/subscriptions","organizations_url":"https://api.github.com/users/linkedin/orgs","repos_url":"https://api.github.com/users/linkedin/repos","events_url":"https://api.github.com/users/linkedin/events{/privacy}","received_events_url":"https://api.github.com/users/linkedin/received_events","type":"Organization","site_admin":false},"repo":{"id":27392543,"name":"gobblin","full_name":"linkedin/gobblin","owner":{"login":"linkedin","id":357098,"avatar_url":"https://avatars.githubusercontent.com/u/357098?v=3","gravatar_id":"","url":"https://api.github.com/users/linkedin","html_url":"https://github.com/linkedin","followers_url":"https://api.github.com/users/linkedin/followers","following_url":"https://api.github.com/users/linkedin/following{/other_user}","gists_url":"https://api.github.com/users/linkedin/gists{/gist_id}","starred_url":"https://api.github.com/users/linkedin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linkedin/subscriptions","organizations_url":"https://api.github.com/users/linkedin/orgs","repos_url":"https://api.github.com/users/linkedin/repos","events_url":"https://api.github.com/users/linkedin/events{/privacy}","received_events_url":"https://api.github.com/users/linkedin/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/linkedin/gobblin","description":"Universal data ingestion framework for Hadoop.","fork":false,"url":"https://api.github.com/repos/linkedin/gobblin","forks_url":"https://api.github.com/repos/linkedin/gobblin/forks","keys_url":"https://api.github.com/repos/linkedin/gobblin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/linkedin/gobblin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/linkedin/gobblin/teams","hooks_url":"https://api.github.com/repos/linkedin/gobblin/hooks","issue_events_url":"https://api.github.com/repos/linkedin/gobblin/issues/events{/number}","events_url":"https://api.github.com/repos/linkedin/gobblin/events","assignees_url":"https://api.github.com/repos/linkedin/gobblin/assignees{/user}","branches_url":"https://api.github.com/repos/linkedin/gobblin/branches{/branch}","tags_url":"https://api.github.com/repos/linkedin/gobblin/tags","blobs_url":"https://api.github.com/repos/linkedin/gobblin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/linkedin/gobblin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/linkedin/gobblin/git/refs{/sha}","trees_url":"https://api.github.com/repos/linkedin/gobblin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/linkedin/gobblin/statuses/{sha}","languages_url":"https://api.github.com/repos/linkedin/gobblin/languages","stargazers_url":"https://api.github.com/repos/linkedin/gobblin/stargazers","contributors_url":"https://api.github.com/repos/linkedin/gobblin/contributors","subscribers_url":"https://api.github.com/repos/linkedin/gobblin/subscribers","subscription_url":"https://api.github.com/repos/linkedin/gobblin/subscription","commits_url":"https://api.github.com/repos/linkedin/gobblin/commits{/sha}","git_commits_url":"https://api.github.com/repos/linkedin/gobblin/git/commits{/sha}","comments_url":"https://api.github.com/repos/linkedin/gobblin/comments{/number}","issue_comment_url":"https://api.github.com/repos/linkedin/gobblin/issues/comments{/number}","contents_url":"https://api.github.com/repos/linkedin/gobblin/contents/{+path}","compare_url":"https://api.github.com/repos/linkedin/gobblin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/linkedin/gobblin/merges","archive_url":"https://api.github.com/repos/linkedin/gobblin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/linkedin/gobblin/downloads","issues_url":"https://api.github.com/repos/linkedin/gobblin/issues{/number}","pulls_url":"https://api.github.com/repos/linkedin/gobblin/pulls{/number}","milestones_url":"https://api.github.com/repos/linkedin/gobblin/milestones{/number}","notifications_url":"https://api.github.com/repos/linkedin/gobblin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/linkedin/gobblin/labels{/name}","releases_url":"https://api.github.com/repos/linkedin/gobblin/releases{/id}","deployments_url":"https://api.github.com/repos/linkedin/gobblin/deployments","created_at":"2014-12-01T18:10:50Z","updated_at":"2016-03-23T13:41:25Z","pushed_at":"2016-03-23T18:19:22Z","git_url":"git://github.com/linkedin/gobblin.git","ssh_url":"git@github.com:linkedin/gobblin.git","clone_url":"https://github.com/linkedin/gobblin.git","svn_url":"https://github.com/linkedin/gobblin","homepage":"https://github.com/linkedin/gobblin/wiki","size":164952,"stargazers_count":484,"watchers_count":484,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":191,"mirror_url":null,"open_issues_count":71,"forks":191,"open_issues":71,"watchers":484,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/linkedin/gobblin/pulls/828"},"html":{"href":"https://github.com/linkedin/gobblin/pull/828"},"issue":{"href":"https://api.github.com/repos/linkedin/gobblin/issues/828"},"comments":{"href":"https://api.github.com/repos/linkedin/gobblin/issues/828/comments"},"review_comments":{"href":"https://api.github.com/repos/linkedin/gobblin/pulls/828/comments"},"review_comment":{"href":"https://api.github.com/repos/linkedin/gobblin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/linkedin/gobblin/pulls/828/commits"},"statuses":{"href":"https://api.github.com/repos/linkedin/gobblin/statuses/15b5e24b7171fd60f17b32b517f358d995f902b6"}}}}