{"action":"created","issue":{"url":"https://api.github.com/repos/treasure-data/digdag/issues/182","repository_url":"https://api.github.com/repos/treasure-data/digdag","labels_url":"https://api.github.com/repos/treasure-data/digdag/issues/182/labels{/name}","comments_url":"https://api.github.com/repos/treasure-data/digdag/issues/182/comments","events_url":"https://api.github.com/repos/treasure-data/digdag/issues/182/events","html_url":"https://github.com/treasure-data/digdag/pull/182","id":167970517,"number":182,"title":"Graceful shutdown of HTTP server and worker threads","user":{"login":"frsyuki","id":40720,"avatar_url":"https://avatars.githubusercontent.com/u/40720?v=3","gravatar_id":"","url":"https://api.github.com/users/frsyuki","html_url":"https://github.com/frsyuki","followers_url":"https://api.github.com/users/frsyuki/followers","following_url":"https://api.github.com/users/frsyuki/following{/other_user}","gists_url":"https://api.github.com/users/frsyuki/gists{/gist_id}","starred_url":"https://api.github.com/users/frsyuki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frsyuki/subscriptions","organizations_url":"https://api.github.com/users/frsyuki/orgs","repos_url":"https://api.github.com/users/frsyuki/repos","events_url":"https://api.github.com/users/frsyuki/events{/privacy}","received_events_url":"https://api.github.com/users/frsyuki/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2016-07-27T22:20:43Z","updated_at":"2016-08-17T02:12:55Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/treasure-data/digdag/pulls/182","html_url":"https://github.com/treasure-data/digdag/pull/182","diff_url":"https://github.com/treasure-data/digdag/pull/182.diff","patch_url":"https://github.com/treasure-data/digdag/pull/182.patch"},"body":"This change implements graceful shutdown to HTTP server and MultiThreadAgent threads.\r\n\r\n* Undertow creates XnioWorker automatically but here doesn't use it. If we use it, `Undertow.stop` calls `xnioWorker.shutdownNow` immediately. However, it shouldn't be called until `GracefulShutdownHandler.shutodwn` is called to make sure that the HTTP handlers are not processing requests. Therefore, here creates XnioWorker and controls shutdown order manually.\r\n* Upgraded Undertow to 1.4.x because `Undertow.Builder.setWorker` is not available in 1.3.\r\n* A new shutdownHandler waits for completion of `ServerControl.destroy()`. It calls `@PreDestroy` methods. Thus shutting down digdag server will wait for completion of `@PreDestroy LocalAgentManager.shutdown` method.\r\n* `LocalAgentManager.shutdown` calls `MultiThreadAgent.shutdown`. It waits for completion of all running tasks.\r\n"},"comment":{"url":"https://api.github.com/repos/treasure-data/digdag/issues/comments/240294906","html_url":"https://github.com/treasure-data/digdag/pull/182#issuecomment-240294906","issue_url":"https://api.github.com/repos/treasure-data/digdag/issues/182","id":240294906,"user":{"login":"danielnorberg","id":393289,"avatar_url":"https://avatars.githubusercontent.com/u/393289?v=3","gravatar_id":"","url":"https://api.github.com/users/danielnorberg","html_url":"https://github.com/danielnorberg","followers_url":"https://api.github.com/users/danielnorberg/followers","following_url":"https://api.github.com/users/danielnorberg/following{/other_user}","gists_url":"https://api.github.com/users/danielnorberg/gists{/gist_id}","starred_url":"https://api.github.com/users/danielnorberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielnorberg/subscriptions","organizations_url":"https://api.github.com/users/danielnorberg/orgs","repos_url":"https://api.github.com/users/danielnorberg/repos","events_url":"https://api.github.com/users/danielnorberg/events{/privacy}","received_events_url":"https://api.github.com/users/danielnorberg/received_events","type":"User","site_admin":false},"created_at":"2016-08-17T02:12:55Z","updated_at":"2016-08-17T02:12:55Z","body":"👍  LGTM"}}
{"actor":{"display_login":"danielnorberg"}}