{"action":"created","comment":{"url":"https://api.github.com/repos/amplab/tachyon/pulls/comments/41767996","id":41767996,"diff_hunk":"@@ -0,0 +1,81 @@\n+/*\n+ * Licensed to the University of California, Berkeley under one or more contributor license\n+ * agreements. See the NOTICE file distributed with this work for additional information regarding\n+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the\n+ * \"License\"); you may not use this file except in compliance with the License. You may obtain a\n+ * 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 distributed under the License\n+ * is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\n+ * or implied. See the License for the specific language governing permissions and limitations under\n+ * the License.\n+ */\n+\n+package tachyon.heartbeat;\n+\n+import java.util.HashMap;\n+import java.util.Map;\n+\n+import org.slf4j.Logger;\n+import org.slf4j.LoggerFactory;\n+\n+import tachyon.Constants;\n+\n+/**\n+ * This class is a singleton for storing and retrieving heartbeat related information.\n+ */\n+public class HeartbeatContext {\n+  private static final Logger LOG = LoggerFactory.getLogger(Constants.LOGGER_TYPE);\n+  private static Map<String, String> sExecutorTimerClasses;\n+\n+  // Names of different heartbeat timer classes.\n+  public static final String SLEEPING_TIMER_CLASS = \"tachyon.heartbeat.SleepingTimer\";\n+  public static final String SCHEDULED_TIMER_CLASS = \"tachyon.heartbeat.ScheduledTimer\";\n+\n+  // Names of different hearbeat executors.\n+  public static final String MASTER_CHECKPOINT_SCHEDULING = \"Master Checkpoint Scheduling\";\n+  public static final String MASTER_FILE_RECOMPUTATION = \"Master File Recomputation\";\n+  public static final String MASTER_LOST_WORKER_DETECTION = \"Master Lost Worker Detection\";\n+  public static final String MASTER_TTL_CHECK = \"Master TTL Check\";\n+  public static final String WORKER_LINEAGE_SYNC = \"Worker Lineage Sync\";\n+  public static final String WORKER_CLIENT = \"Worker Client\";\n+\n+  static {\n+    sExecutorTimerClasses = new HashMap<String, String>();\n+    sExecutorTimerClasses.put(MASTER_CHECKPOINT_SCHEDULING, SLEEPING_TIMER_CLASS);\n+    sExecutorTimerClasses.put(MASTER_FILE_RECOMPUTATION, SLEEPING_TIMER_CLASS);\n+    sExecutorTimerClasses.put(MASTER_LOST_WORKER_DETECTION, SLEEPING_TIMER_CLASS);\n+    sExecutorTimerClasses.put(MASTER_TTL_CHECK, SLEEPING_TIMER_CLASS);\n+    sExecutorTimerClasses.put(WORKER_LINEAGE_SYNC, SLEEPING_TIMER_CLASS);\n+    sExecutorTimerClasses.put(WORKER_CLIENT, SLEEPING_TIMER_CLASS);\n+  }\n+\n+  /**\n+   * @param name a name of a heartbeat executor\n+   * @return the timer class to use for the executor","path":"common/src/main/java/tachyon/heartbeat/HeartbeatContext.java","position":57,"original_position":57,"commit_id":"9accfda3fa17d9cb566a858d11969215773a116b","original_commit_id":"9accfda3fa17d9cb566a858d11969215773a116b","user":{"login":"jsimsa","id":1072079,"avatar_url":"https://avatars.githubusercontent.com/u/1072079?v=3","gravatar_id":"","url":"https://api.github.com/users/jsimsa","html_url":"https://github.com/jsimsa","followers_url":"https://api.github.com/users/jsimsa/followers","following_url":"https://api.github.com/users/jsimsa/following{/other_user}","gists_url":"https://api.github.com/users/jsimsa/gists{/gist_id}","starred_url":"https://api.github.com/users/jsimsa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsimsa/subscriptions","organizations_url":"https://api.github.com/users/jsimsa/orgs","repos_url":"https://api.github.com/users/jsimsa/repos","events_url":"https://api.github.com/users/jsimsa/events{/privacy}","received_events_url":"https://api.github.com/users/jsimsa/received_events","type":"User","site_admin":false},"body":"Done.","created_at":"2015-10-12T15:25:27Z","updated_at":"2015-10-12T15:25:27Z","html_url":"https://github.com/amplab/tachyon/pull/1763#discussion_r41767996","pull_request_url":"https://api.github.com/repos/amplab/tachyon/pulls/1763","_links":{"self":{"href":"https://api.github.com/repos/amplab/tachyon/pulls/comments/41767996"},"html":{"href":"https://github.com/amplab/tachyon/pull/1763#discussion_r41767996"},"pull_request":{"href":"https://api.github.com/repos/amplab/tachyon/pulls/1763"}}},"pull_request":{"url":"https://api.github.com/repos/amplab/tachyon/pulls/1763","id":47348823,"html_url":"https://github.com/amplab/tachyon/pull/1763","diff_url":"https://github.com/amplab/tachyon/pull/1763.diff","patch_url":"https://github.com/amplab/tachyon/pull/1763.patch","issue_url":"https://api.github.com/repos/amplab/tachyon/issues/1763","number":1763,"state":"open","locked":false,"title":"[TACHYON-1114] Improving Testing of Heartbeat-based logic","user":{"login":"jsimsa","id":1072079,"avatar_url":"https://avatars.githubusercontent.com/u/1072079?v=3","gravatar_id":"","url":"https://api.github.com/users/jsimsa","html_url":"https://github.com/jsimsa","followers_url":"https://api.github.com/users/jsimsa/followers","following_url":"https://api.github.com/users/jsimsa/following{/other_user}","gists_url":"https://api.github.com/users/jsimsa/gists{/gist_id}","starred_url":"https://api.github.com/users/jsimsa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsimsa/subscriptions","organizations_url":"https://api.github.com/users/jsimsa/orgs","repos_url":"https://api.github.com/users/jsimsa/repos","events_url":"https://api.github.com/users/jsimsa/events{/privacy}","received_events_url":"https://api.github.com/users/jsimsa/received_events","type":"User","site_admin":false},"body":"This PR addresses: https://tachyon.atlassian.net/browse/TACHYON-1114?filter=-1\r\n\r\nAs an example use of this improvement, the test of the TTL logic in FileSystemMasterTest has been modified to stop relying on timers (speeding the test up from 5 seconds to > 0.1s).","created_at":"2015-10-10T16:31:57Z","updated_at":"2015-10-12T15:25:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5b314b9e9851c503d4126af12587c022ef470f46","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/amplab/tachyon/pulls/1763/commits","review_comments_url":"https://api.github.com/repos/amplab/tachyon/pulls/1763/comments","review_comment_url":"https://api.github.com/repos/amplab/tachyon/pulls/comments{/number}","comments_url":"https://api.github.com/repos/amplab/tachyon/issues/1763/comments","statuses_url":"https://api.github.com/repos/amplab/tachyon/statuses/9accfda3fa17d9cb566a858d11969215773a116b","head":{"label":"jsimsa:testing","ref":"testing","sha":"9accfda3fa17d9cb566a858d11969215773a116b","user":{"login":"jsimsa","id":1072079,"avatar_url":"https://avatars.githubusercontent.com/u/1072079?v=3","gravatar_id":"","url":"https://api.github.com/users/jsimsa","html_url":"https://github.com/jsimsa","followers_url":"https://api.github.com/users/jsimsa/followers","following_url":"https://api.github.com/users/jsimsa/following{/other_user}","gists_url":"https://api.github.com/users/jsimsa/gists{/gist_id}","starred_url":"https://api.github.com/users/jsimsa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsimsa/subscriptions","organizations_url":"https://api.github.com/users/jsimsa/orgs","repos_url":"https://api.github.com/users/jsimsa/repos","events_url":"https://api.github.com/users/jsimsa/events{/privacy}","received_events_url":"https://api.github.com/users/jsimsa/received_events","type":"User","site_admin":false},"repo":{"id":41324456,"name":"tachyon","full_name":"jsimsa/tachyon","owner":{"login":"jsimsa","id":1072079,"avatar_url":"https://avatars.githubusercontent.com/u/1072079?v=3","gravatar_id":"","url":"https://api.github.com/users/jsimsa","html_url":"https://github.com/jsimsa","followers_url":"https://api.github.com/users/jsimsa/followers","following_url":"https://api.github.com/users/jsimsa/following{/other_user}","gists_url":"https://api.github.com/users/jsimsa/gists{/gist_id}","starred_url":"https://api.github.com/users/jsimsa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsimsa/subscriptions","organizations_url":"https://api.github.com/users/jsimsa/orgs","repos_url":"https://api.github.com/users/jsimsa/repos","events_url":"https://api.github.com/users/jsimsa/events{/privacy}","received_events_url":"https://api.github.com/users/jsimsa/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jsimsa/tachyon","description":" A Reliable Memory Centric Distributed Storage System","fork":true,"url":"https://api.github.com/repos/jsimsa/tachyon","forks_url":"https://api.github.com/repos/jsimsa/tachyon/forks","keys_url":"https://api.github.com/repos/jsimsa/tachyon/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jsimsa/tachyon/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jsimsa/tachyon/teams","hooks_url":"https://api.github.com/repos/jsimsa/tachyon/hooks","issue_events_url":"https://api.github.com/repos/jsimsa/tachyon/issues/events{/number}","events_url":"https://api.github.com/repos/jsimsa/tachyon/events","assignees_url":"https://api.github.com/repos/jsimsa/tachyon/assignees{/user}","branches_url":"https://api.github.com/repos/jsimsa/tachyon/branches{/branch}","tags_url":"https://api.github.com/repos/jsimsa/tachyon/tags","blobs_url":"https://api.github.com/repos/jsimsa/tachyon/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jsimsa/tachyon/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jsimsa/tachyon/git/refs{/sha}","trees_url":"https://api.github.com/repos/jsimsa/tachyon/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jsimsa/tachyon/statuses/{sha}","languages_url":"https://api.github.com/repos/jsimsa/tachyon/languages","stargazers_url":"https://api.github.com/repos/jsimsa/tachyon/stargazers","contributors_url":"https://api.github.com/repos/jsimsa/tachyon/contributors","subscribers_url":"https://api.github.com/repos/jsimsa/tachyon/subscribers","subscription_url":"https://api.github.com/repos/jsimsa/tachyon/subscription","commits_url":"https://api.github.com/repos/jsimsa/tachyon/commits{/sha}","git_commits_url":"https://api.github.com/repos/jsimsa/tachyon/git/commits{/sha}","comments_url":"https://api.github.com/repos/jsimsa/tachyon/comments{/number}","issue_comment_url":"https://api.github.com/repos/jsimsa/tachyon/issues/comments{/number}","contents_url":"https://api.github.com/repos/jsimsa/tachyon/contents/{+path}","compare_url":"https://api.github.com/repos/jsimsa/tachyon/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jsimsa/tachyon/merges","archive_url":"https://api.github.com/repos/jsimsa/tachyon/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jsimsa/tachyon/downloads","issues_url":"https://api.github.com/repos/jsimsa/tachyon/issues{/number}","pulls_url":"https://api.github.com/repos/jsimsa/tachyon/pulls{/number}","milestones_url":"https://api.github.com/repos/jsimsa/tachyon/milestones{/number}","notifications_url":"https://api.github.com/repos/jsimsa/tachyon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jsimsa/tachyon/labels{/name}","releases_url":"https://api.github.com/repos/jsimsa/tachyon/releases{/id}","created_at":"2015-08-24T20:06:14Z","updated_at":"2015-08-24T20:06:16Z","pushed_at":"2015-10-10T16:39:27Z","git_url":"git://github.com/jsimsa/tachyon.git","ssh_url":"git@github.com:jsimsa/tachyon.git","clone_url":"https://github.com/jsimsa/tachyon.git","svn_url":"https://github.com/jsimsa/tachyon","homepage":"http://tachyon-project.org","size":26103,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"amplab:master","ref":"master","sha":"40a7bd1d15415e395caa9e1e93a2ebded896c3af","user":{"login":"amplab","id":1438454,"avatar_url":"https://avatars.githubusercontent.com/u/1438454?v=3","gravatar_id":"","url":"https://api.github.com/users/amplab","html_url":"https://github.com/amplab","followers_url":"https://api.github.com/users/amplab/followers","following_url":"https://api.github.com/users/amplab/following{/other_user}","gists_url":"https://api.github.com/users/amplab/gists{/gist_id}","starred_url":"https://api.github.com/users/amplab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amplab/subscriptions","organizations_url":"https://api.github.com/users/amplab/orgs","repos_url":"https://api.github.com/users/amplab/repos","events_url":"https://api.github.com/users/amplab/events{/privacy}","received_events_url":"https://api.github.com/users/amplab/received_events","type":"Organization","site_admin":false},"repo":{"id":7276954,"name":"tachyon","full_name":"amplab/tachyon","owner":{"login":"amplab","id":1438454,"avatar_url":"https://avatars.githubusercontent.com/u/1438454?v=3","gravatar_id":"","url":"https://api.github.com/users/amplab","html_url":"https://github.com/amplab","followers_url":"https://api.github.com/users/amplab/followers","following_url":"https://api.github.com/users/amplab/following{/other_user}","gists_url":"https://api.github.com/users/amplab/gists{/gist_id}","starred_url":"https://api.github.com/users/amplab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amplab/subscriptions","organizations_url":"https://api.github.com/users/amplab/orgs","repos_url":"https://api.github.com/users/amplab/repos","events_url":"https://api.github.com/users/amplab/events{/privacy}","received_events_url":"https://api.github.com/users/amplab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/amplab/tachyon","description":"Memory Centric Reliable Distributed Storage","fork":false,"url":"https://api.github.com/repos/amplab/tachyon","forks_url":"https://api.github.com/repos/amplab/tachyon/forks","keys_url":"https://api.github.com/repos/amplab/tachyon/keys{/key_id}","collaborators_url":"https://api.github.com/repos/amplab/tachyon/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/amplab/tachyon/teams","hooks_url":"https://api.github.com/repos/amplab/tachyon/hooks","issue_events_url":"https://api.github.com/repos/amplab/tachyon/issues/events{/number}","events_url":"https://api.github.com/repos/amplab/tachyon/events","assignees_url":"https://api.github.com/repos/amplab/tachyon/assignees{/user}","branches_url":"https://api.github.com/repos/amplab/tachyon/branches{/branch}","tags_url":"https://api.github.com/repos/amplab/tachyon/tags","blobs_url":"https://api.github.com/repos/amplab/tachyon/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/amplab/tachyon/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/amplab/tachyon/git/refs{/sha}","trees_url":"https://api.github.com/repos/amplab/tachyon/git/trees{/sha}","statuses_url":"https://api.github.com/repos/amplab/tachyon/statuses/{sha}","languages_url":"https://api.github.com/repos/amplab/tachyon/languages","stargazers_url":"https://api.github.com/repos/amplab/tachyon/stargazers","contributors_url":"https://api.github.com/repos/amplab/tachyon/contributors","subscribers_url":"https://api.github.com/repos/amplab/tachyon/subscribers","subscription_url":"https://api.github.com/repos/amplab/tachyon/subscription","commits_url":"https://api.github.com/repos/amplab/tachyon/commits{/sha}","git_commits_url":"https://api.github.com/repos/amplab/tachyon/git/commits{/sha}","comments_url":"https://api.github.com/repos/amplab/tachyon/comments{/number}","issue_comment_url":"https://api.github.com/repos/amplab/tachyon/issues/comments{/number}","contents_url":"https://api.github.com/repos/amplab/tachyon/contents/{+path}","compare_url":"https://api.github.com/repos/amplab/tachyon/compare/{base}...{head}","merges_url":"https://api.github.com/repos/amplab/tachyon/merges","archive_url":"https://api.github.com/repos/amplab/tachyon/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/amplab/tachyon/downloads","issues_url":"https://api.github.com/repos/amplab/tachyon/issues{/number}","pulls_url":"https://api.github.com/repos/amplab/tachyon/pulls{/number}","milestones_url":"https://api.github.com/repos/amplab/tachyon/milestones{/number}","notifications_url":"https://api.github.com/repos/amplab/tachyon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/amplab/tachyon/labels{/name}","releases_url":"https://api.github.com/repos/amplab/tachyon/releases{/id}","created_at":"2012-12-21T17:43:46Z","updated_at":"2015-10-12T12:52:17Z","pushed_at":"2015-10-12T15:22:46Z","git_url":"git://github.com/amplab/tachyon.git","ssh_url":"git@github.com:amplab/tachyon.git","clone_url":"https://github.com/amplab/tachyon.git","svn_url":"https://github.com/amplab/tachyon","homepage":"http://tachyon-project.org","size":54255,"stargazers_count":1627,"watchers_count":1627,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":648,"mirror_url":null,"open_issues_count":39,"forks":648,"open_issues":39,"watchers":1627,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/amplab/tachyon/pulls/1763"},"html":{"href":"https://github.com/amplab/tachyon/pull/1763"},"issue":{"href":"https://api.github.com/repos/amplab/tachyon/issues/1763"},"comments":{"href":"https://api.github.com/repos/amplab/tachyon/issues/1763/comments"},"review_comments":{"href":"https://api.github.com/repos/amplab/tachyon/pulls/1763/comments"},"review_comment":{"href":"https://api.github.com/repos/amplab/tachyon/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/amplab/tachyon/pulls/1763/commits"},"statuses":{"href":"https://api.github.com/repos/amplab/tachyon/statuses/9accfda3fa17d9cb566a858d11969215773a116b"}}}}