{"action":"created","comment":{"url":"https://api.github.com/repos/azkaban/azkaban/pulls/comments/189732393","pull_request_review_id":121968955,"id":189732393,"diff_hunk":"@@ -0,0 +1,85 @@\n+/*\n+ * Copyright 2018 LinkedIn Corp.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n+ * use this file except in compliance with the License. You may obtain a copy of\n+ * 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, WITHOUT\n+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n+ * License for the specific language governing permissions and limitations under\n+ * the License.\n+ */\n+\n+package azkaban.utils;\n+\n+import static org.assertj.core.api.Assertions.assertThat;\n+import static org.assertj.core.api.Assertions.catchThrowable;\n+\n+import java.time.Duration;\n+import java.util.concurrent.ExecutorService;\n+import java.util.concurrent.Executors;\n+import java.util.concurrent.RejectedExecutionException;\n+import org.junit.Test;\n+\n+public class ExecutorServiceUtilsTest {\n+\n+  private final ExecutorServiceUtils executorServiceUtils = new ExecutorServiceUtils();\n+\n+  @Test\n+  public void gracefulShutdown() throws InterruptedException {\n+    // given\n+    final ExecutorService service = Executors.newSingleThreadExecutor();\n+\n+    // when\n+    this.executorServiceUtils.gracefulShutdown(service, Duration.ofMillis(1));\n+\n+    // then\n+    assertThat(service.isShutdown()).isTrue();\n+  }\n+\n+  @Test\n+  public void force_shutdown_after_timeout() throws InterruptedException {\n+    // given\n+    final ExecutorService service = Executors.newSingleThreadExecutor();\n+\n+    // when\n+    service.submit(this::sleep);","path":"az-core/src/test/java/azkaban/utils/ExecutorServiceUtilsTest.java","position":50,"original_position":50,"commit_id":"7d1998af70fda8355619014d5f1f89810022c57e","original_commit_id":"7d1998af70fda8355619014d5f1f89810022c57e","user":{"login":"HappyRay","id":6646529,"avatar_url":"https://avatars1.githubusercontent.com/u/6646529?v=4","gravatar_id":"","url":"https://api.github.com/users/HappyRay","html_url":"https://github.com/HappyRay","followers_url":"https://api.github.com/users/HappyRay/followers","following_url":"https://api.github.com/users/HappyRay/following{/other_user}","gists_url":"https://api.github.com/users/HappyRay/gists{/gist_id}","starred_url":"https://api.github.com/users/HappyRay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HappyRay/subscriptions","organizations_url":"https://api.github.com/users/HappyRay/orgs","repos_url":"https://api.github.com/users/HappyRay/repos","events_url":"https://api.github.com/users/HappyRay/events{/privacy}","received_events_url":"https://api.github.com/users/HappyRay/received_events","type":"User","site_admin":false},"body":"Yes, it is a non blocking call.","created_at":"2018-05-21T22:33:51Z","updated_at":"2018-05-21T22:33:52Z","html_url":"https://github.com/azkaban/azkaban/pull/1765#discussion_r189732393","pull_request_url":"https://api.github.com/repos/azkaban/azkaban/pulls/1765","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/azkaban/azkaban/pulls/comments/189732393"},"html":{"href":"https://github.com/azkaban/azkaban/pull/1765#discussion_r189732393"},"pull_request":{"href":"https://api.github.com/repos/azkaban/azkaban/pulls/1765"}},"in_reply_to_id":189728498},"pull_request":{"url":"https://api.github.com/repos/azkaban/azkaban/pulls/1765","id":189486618,"html_url":"https://github.com/azkaban/azkaban/pull/1765","diff_url":"https://github.com/azkaban/azkaban/pull/1765.diff","patch_url":"https://github.com/azkaban/azkaban/pull/1765.patch","issue_url":"https://api.github.com/repos/azkaban/azkaban/issues/1765","number":1765,"state":"open","locked":false,"title":"Refactor DagService shutdown method and add tests","user":{"login":"HappyRay","id":6646529,"avatar_url":"https://avatars1.githubusercontent.com/u/6646529?v=4","gravatar_id":"","url":"https://api.github.com/users/HappyRay","html_url":"https://github.com/HappyRay","followers_url":"https://api.github.com/users/HappyRay/followers","following_url":"https://api.github.com/users/HappyRay/following{/other_user}","gists_url":"https://api.github.com/users/HappyRay/gists{/gist_id}","starred_url":"https://api.github.com/users/HappyRay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HappyRay/subscriptions","organizations_url":"https://api.github.com/users/HappyRay/orgs","repos_url":"https://api.github.com/users/HappyRay/repos","events_url":"https://api.github.com/users/HappyRay/events{/privacy}","received_events_url":"https://api.github.com/users/HappyRay/received_events","type":"User","site_admin":false},"body":"Part of #1486\n\nCreate a new utility class to encapsulate the generic shutdown logic to\nmake it easier to test and allow better code reuse.\n\nAlso reduced the shutdown timeout from 60 seconds to 10 seconds.\n\nWith this change and #1763, the dag package will have 100% line\ncoverage.","created_at":"2018-05-21T20:59:01Z","updated_at":"2018-05-21T22:33:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8cfc05b86d82919e2b1e593cc0a21f38f5444159","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/azkaban/azkaban/pulls/1765/commits","review_comments_url":"https://api.github.com/repos/azkaban/azkaban/pulls/1765/comments","review_comment_url":"https://api.github.com/repos/azkaban/azkaban/pulls/comments{/number}","comments_url":"https://api.github.com/repos/azkaban/azkaban/issues/1765/comments","statuses_url":"https://api.github.com/repos/azkaban/azkaban/statuses/7d1998af70fda8355619014d5f1f89810022c57e","head":{"label":"HappyRay:test-shutdown-dag-service","ref":"test-shutdown-dag-service","sha":"7d1998af70fda8355619014d5f1f89810022c57e","user":{"login":"HappyRay","id":6646529,"avatar_url":"https://avatars1.githubusercontent.com/u/6646529?v=4","gravatar_id":"","url":"https://api.github.com/users/HappyRay","html_url":"https://github.com/HappyRay","followers_url":"https://api.github.com/users/HappyRay/followers","following_url":"https://api.github.com/users/HappyRay/following{/other_user}","gists_url":"https://api.github.com/users/HappyRay/gists{/gist_id}","starred_url":"https://api.github.com/users/HappyRay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HappyRay/subscriptions","organizations_url":"https://api.github.com/users/HappyRay/orgs","repos_url":"https://api.github.com/users/HappyRay/repos","events_url":"https://api.github.com/users/HappyRay/events{/privacy}","received_events_url":"https://api.github.com/users/HappyRay/received_events","type":"User","site_admin":false},"repo":{"id":56013253,"name":"azkaban","full_name":"HappyRay/azkaban","owner":{"login":"HappyRay","id":6646529,"avatar_url":"https://avatars1.githubusercontent.com/u/6646529?v=4","gravatar_id":"","url":"https://api.github.com/users/HappyRay","html_url":"https://github.com/HappyRay","followers_url":"https://api.github.com/users/HappyRay/followers","following_url":"https://api.github.com/users/HappyRay/following{/other_user}","gists_url":"https://api.github.com/users/HappyRay/gists{/gist_id}","starred_url":"https://api.github.com/users/HappyRay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HappyRay/subscriptions","organizations_url":"https://api.github.com/users/HappyRay/orgs","repos_url":"https://api.github.com/users/HappyRay/repos","events_url":"https://api.github.com/users/HappyRay/events{/privacy}","received_events_url":"https://api.github.com/users/HappyRay/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/HappyRay/azkaban","description":"Azkaban workflow manager.","fork":true,"url":"https://api.github.com/repos/HappyRay/azkaban","forks_url":"https://api.github.com/repos/HappyRay/azkaban/forks","keys_url":"https://api.github.com/repos/HappyRay/azkaban/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HappyRay/azkaban/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HappyRay/azkaban/teams","hooks_url":"https://api.github.com/repos/HappyRay/azkaban/hooks","issue_events_url":"https://api.github.com/repos/HappyRay/azkaban/issues/events{/number}","events_url":"https://api.github.com/repos/HappyRay/azkaban/events","assignees_url":"https://api.github.com/repos/HappyRay/azkaban/assignees{/user}","branches_url":"https://api.github.com/repos/HappyRay/azkaban/branches{/branch}","tags_url":"https://api.github.com/repos/HappyRay/azkaban/tags","blobs_url":"https://api.github.com/repos/HappyRay/azkaban/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HappyRay/azkaban/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HappyRay/azkaban/git/refs{/sha}","trees_url":"https://api.github.com/repos/HappyRay/azkaban/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HappyRay/azkaban/statuses/{sha}","languages_url":"https://api.github.com/repos/HappyRay/azkaban/languages","stargazers_url":"https://api.github.com/repos/HappyRay/azkaban/stargazers","contributors_url":"https://api.github.com/repos/HappyRay/azkaban/contributors","subscribers_url":"https://api.github.com/repos/HappyRay/azkaban/subscribers","subscription_url":"https://api.github.com/repos/HappyRay/azkaban/subscription","commits_url":"https://api.github.com/repos/HappyRay/azkaban/commits{/sha}","git_commits_url":"https://api.github.com/repos/HappyRay/azkaban/git/commits{/sha}","comments_url":"https://api.github.com/repos/HappyRay/azkaban/comments{/number}","issue_comment_url":"https://api.github.com/repos/HappyRay/azkaban/issues/comments{/number}","contents_url":"https://api.github.com/repos/HappyRay/azkaban/contents/{+path}","compare_url":"https://api.github.com/repos/HappyRay/azkaban/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HappyRay/azkaban/merges","archive_url":"https://api.github.com/repos/HappyRay/azkaban/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HappyRay/azkaban/downloads","issues_url":"https://api.github.com/repos/HappyRay/azkaban/issues{/number}","pulls_url":"https://api.github.com/repos/HappyRay/azkaban/pulls{/number}","milestones_url":"https://api.github.com/repos/HappyRay/azkaban/milestones{/number}","notifications_url":"https://api.github.com/repos/HappyRay/azkaban/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HappyRay/azkaban/labels{/name}","releases_url":"https://api.github.com/repos/HappyRay/azkaban/releases{/id}","deployments_url":"https://api.github.com/repos/HappyRay/azkaban/deployments","created_at":"2016-04-11T22:44:30Z","updated_at":"2018-05-17T23:14:59Z","pushed_at":"2018-05-21T21:02:59Z","git_url":"git://github.com/HappyRay/azkaban.git","ssh_url":"git@github.com:HappyRay/azkaban.git","clone_url":"https://github.com/HappyRay/azkaban.git","svn_url":"https://github.com/HappyRay/azkaban","homepage":"https://azkaban.github.io","size":47847,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"azkaban:master","ref":"master","sha":"c25fb03a5ed37b75016a97701e83a705128a6274","user":{"login":"azkaban","id":213618,"avatar_url":"https://avatars0.githubusercontent.com/u/213618?v=4","gravatar_id":"","url":"https://api.github.com/users/azkaban","html_url":"https://github.com/azkaban","followers_url":"https://api.github.com/users/azkaban/followers","following_url":"https://api.github.com/users/azkaban/following{/other_user}","gists_url":"https://api.github.com/users/azkaban/gists{/gist_id}","starred_url":"https://api.github.com/users/azkaban/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azkaban/subscriptions","organizations_url":"https://api.github.com/users/azkaban/orgs","repos_url":"https://api.github.com/users/azkaban/repos","events_url":"https://api.github.com/users/azkaban/events{/privacy}","received_events_url":"https://api.github.com/users/azkaban/received_events","type":"Organization","site_admin":false},"repo":{"id":6271421,"name":"azkaban","full_name":"azkaban/azkaban","owner":{"login":"azkaban","id":213618,"avatar_url":"https://avatars0.githubusercontent.com/u/213618?v=4","gravatar_id":"","url":"https://api.github.com/users/azkaban","html_url":"https://github.com/azkaban","followers_url":"https://api.github.com/users/azkaban/followers","following_url":"https://api.github.com/users/azkaban/following{/other_user}","gists_url":"https://api.github.com/users/azkaban/gists{/gist_id}","starred_url":"https://api.github.com/users/azkaban/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azkaban/subscriptions","organizations_url":"https://api.github.com/users/azkaban/orgs","repos_url":"https://api.github.com/users/azkaban/repos","events_url":"https://api.github.com/users/azkaban/events{/privacy}","received_events_url":"https://api.github.com/users/azkaban/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/azkaban/azkaban","description":"Azkaban workflow manager.","fork":false,"url":"https://api.github.com/repos/azkaban/azkaban","forks_url":"https://api.github.com/repos/azkaban/azkaban/forks","keys_url":"https://api.github.com/repos/azkaban/azkaban/keys{/key_id}","collaborators_url":"https://api.github.com/repos/azkaban/azkaban/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/azkaban/azkaban/teams","hooks_url":"https://api.github.com/repos/azkaban/azkaban/hooks","issue_events_url":"https://api.github.com/repos/azkaban/azkaban/issues/events{/number}","events_url":"https://api.github.com/repos/azkaban/azkaban/events","assignees_url":"https://api.github.com/repos/azkaban/azkaban/assignees{/user}","branches_url":"https://api.github.com/repos/azkaban/azkaban/branches{/branch}","tags_url":"https://api.github.com/repos/azkaban/azkaban/tags","blobs_url":"https://api.github.com/repos/azkaban/azkaban/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/azkaban/azkaban/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/azkaban/azkaban/git/refs{/sha}","trees_url":"https://api.github.com/repos/azkaban/azkaban/git/trees{/sha}","statuses_url":"https://api.github.com/repos/azkaban/azkaban/statuses/{sha}","languages_url":"https://api.github.com/repos/azkaban/azkaban/languages","stargazers_url":"https://api.github.com/repos/azkaban/azkaban/stargazers","contributors_url":"https://api.github.com/repos/azkaban/azkaban/contributors","subscribers_url":"https://api.github.com/repos/azkaban/azkaban/subscribers","subscription_url":"https://api.github.com/repos/azkaban/azkaban/subscription","commits_url":"https://api.github.com/repos/azkaban/azkaban/commits{/sha}","git_commits_url":"https://api.github.com/repos/azkaban/azkaban/git/commits{/sha}","comments_url":"https://api.github.com/repos/azkaban/azkaban/comments{/number}","issue_comment_url":"https://api.github.com/repos/azkaban/azkaban/issues/comments{/number}","contents_url":"https://api.github.com/repos/azkaban/azkaban/contents/{+path}","compare_url":"https://api.github.com/repos/azkaban/azkaban/compare/{base}...{head}","merges_url":"https://api.github.com/repos/azkaban/azkaban/merges","archive_url":"https://api.github.com/repos/azkaban/azkaban/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/azkaban/azkaban/downloads","issues_url":"https://api.github.com/repos/azkaban/azkaban/issues{/number}","pulls_url":"https://api.github.com/repos/azkaban/azkaban/pulls{/number}","milestones_url":"https://api.github.com/repos/azkaban/azkaban/milestones{/number}","notifications_url":"https://api.github.com/repos/azkaban/azkaban/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/azkaban/azkaban/labels{/name}","releases_url":"https://api.github.com/repos/azkaban/azkaban/releases{/id}","deployments_url":"https://api.github.com/repos/azkaban/azkaban/deployments","created_at":"2012-10-18T01:34:53Z","updated_at":"2018-05-21T13:33:06Z","pushed_at":"2018-05-21T21:03:00Z","git_url":"git://github.com/azkaban/azkaban.git","ssh_url":"git@github.com:azkaban/azkaban.git","clone_url":"https://github.com/azkaban/azkaban.git","svn_url":"https://github.com/azkaban/azkaban","homepage":"https://azkaban.github.io","size":47814,"stargazers_count":1771,"watchers_count":1771,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":830,"mirror_url":null,"archived":false,"open_issues_count":425,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":830,"open_issues":425,"watchers":1771,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/azkaban/azkaban/pulls/1765"},"html":{"href":"https://github.com/azkaban/azkaban/pull/1765"},"issue":{"href":"https://api.github.com/repos/azkaban/azkaban/issues/1765"},"comments":{"href":"https://api.github.com/repos/azkaban/azkaban/issues/1765/comments"},"review_comments":{"href":"https://api.github.com/repos/azkaban/azkaban/pulls/1765/comments"},"review_comment":{"href":"https://api.github.com/repos/azkaban/azkaban/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/azkaban/azkaban/pulls/1765/commits"},"statuses":{"href":"https://api.github.com/repos/azkaban/azkaban/statuses/7d1998af70fda8355619014d5f1f89810022c57e"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"HappyRay"}}