{"action":"created","comment":{"url":"https://api.github.com/repos/mesosphere/chaos/pulls/comments/35407022","id":35407022,"diff_hunk":"@@ -29,23 +31,34 @@ trait App extends scala.App {\n   def run(classes: Class[_ <: Service]*) {\n     initConf()\n \n+    val services = classes.map { injector.getInstance(_) }\n+    val serviceManager = new ServiceManager(services.asJava)\n+    this.serviceManager = Some(serviceManager)\n+\n     sys.addShutdownHook(shutdownAndWait())\n \n-    classes.foreach(c => {\n-      val service = injector.getInstance(c)\n-      services += service\n-      service.startAsync()\n-    })\n+    serviceManager.startAsync()\n+\n+    Try { serviceManager.awaitHealthy() } match {","path":"src/main/scala/mesosphere/chaos/App.scala","position":43,"original_position":43,"commit_id":"eb2112577934dabedb9ca27f16a0db8ca5fe0277","original_commit_id":"eb2112577934dabedb9ca27f16a0db8ca5fe0277","user":{"login":"kolloch","id":339354,"avatar_url":"https://avatars.githubusercontent.com/u/339354?v=3","gravatar_id":"","url":"https://api.github.com/users/kolloch","html_url":"https://github.com/kolloch","followers_url":"https://api.github.com/users/kolloch/followers","following_url":"https://api.github.com/users/kolloch/following{/other_user}","gists_url":"https://api.github.com/users/kolloch/gists{/gist_id}","starred_url":"https://api.github.com/users/kolloch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kolloch/subscriptions","organizations_url":"https://api.github.com/users/kolloch/orgs","repos_url":"https://api.github.com/users/kolloch/repos","events_url":"https://api.github.com/users/kolloch/events{/privacy}","received_events_url":"https://api.github.com/users/kolloch/received_events","type":"User","site_admin":false},"body":"I guess a normal `try` with `catch` is more idiomatic.","created_at":"2015-07-24T09:11:40Z","updated_at":"2015-07-24T09:11:40Z","html_url":"https://github.com/mesosphere/chaos/pull/37#discussion_r35407022","pull_request_url":"https://api.github.com/repos/mesosphere/chaos/pulls/37","_links":{"self":{"href":"https://api.github.com/repos/mesosphere/chaos/pulls/comments/35407022"},"html":{"href":"https://github.com/mesosphere/chaos/pull/37#discussion_r35407022"},"pull_request":{"href":"https://api.github.com/repos/mesosphere/chaos/pulls/37"}}},"pull_request":{"url":"https://api.github.com/repos/mesosphere/chaos/pulls/37","id":40684543,"html_url":"https://github.com/mesosphere/chaos/pull/37","diff_url":"https://github.com/mesosphere/chaos/pull/37.diff","patch_url":"https://github.com/mesosphere/chaos/pull/37.patch","issue_url":"https://api.github.com/repos/mesosphere/chaos/issues/37","number":37,"state":"open","locked":false,"title":"Make Chaos Apps exit on service startup failure.","user":{"login":"gkleiman","id":146374,"avatar_url":"https://avatars.githubusercontent.com/u/146374?v=3","gravatar_id":"","url":"https://api.github.com/users/gkleiman","html_url":"https://github.com/gkleiman","followers_url":"https://api.github.com/users/gkleiman/followers","following_url":"https://api.github.com/users/gkleiman/following{/other_user}","gists_url":"https://api.github.com/users/gkleiman/gists{/gist_id}","starred_url":"https://api.github.com/users/gkleiman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gkleiman/subscriptions","organizations_url":"https://api.github.com/users/gkleiman/orgs","repos_url":"https://api.github.com/users/gkleiman/repos","events_url":"https://api.github.com/users/gkleiman/events{/privacy}","received_events_url":"https://api.github.com/users/gkleiman/received_events","type":"User","site_admin":false},"body":"If one or more services fail to start, e.g., because another process is\r\nalready bound to the HTTP port, then the app will log the error and\r\nexit.","created_at":"2015-07-23T15:27:04Z","updated_at":"2015-07-24T09:11:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"21b8578992fb45b1c425a524ae22335dbc5e4d22","assignee":{"login":"kolloch","id":339354,"avatar_url":"https://avatars.githubusercontent.com/u/339354?v=3","gravatar_id":"","url":"https://api.github.com/users/kolloch","html_url":"https://github.com/kolloch","followers_url":"https://api.github.com/users/kolloch/followers","following_url":"https://api.github.com/users/kolloch/following{/other_user}","gists_url":"https://api.github.com/users/kolloch/gists{/gist_id}","starred_url":"https://api.github.com/users/kolloch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kolloch/subscriptions","organizations_url":"https://api.github.com/users/kolloch/orgs","repos_url":"https://api.github.com/users/kolloch/repos","events_url":"https://api.github.com/users/kolloch/events{/privacy}","received_events_url":"https://api.github.com/users/kolloch/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/mesosphere/chaos/pulls/37/commits","review_comments_url":"https://api.github.com/repos/mesosphere/chaos/pulls/37/comments","review_comment_url":"https://api.github.com/repos/mesosphere/chaos/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mesosphere/chaos/issues/37/comments","statuses_url":"https://api.github.com/repos/mesosphere/chaos/statuses/eb2112577934dabedb9ca27f16a0db8ca5fe0277","head":{"label":"mesosphere:gk/exit_app_on_failure","ref":"gk/exit_app_on_failure","sha":"eb2112577934dabedb9ca27f16a0db8ca5fe0277","user":{"login":"mesosphere","id":3458585,"avatar_url":"https://avatars.githubusercontent.com/u/3458585?v=3","gravatar_id":"","url":"https://api.github.com/users/mesosphere","html_url":"https://github.com/mesosphere","followers_url":"https://api.github.com/users/mesosphere/followers","following_url":"https://api.github.com/users/mesosphere/following{/other_user}","gists_url":"https://api.github.com/users/mesosphere/gists{/gist_id}","starred_url":"https://api.github.com/users/mesosphere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mesosphere/subscriptions","organizations_url":"https://api.github.com/users/mesosphere/orgs","repos_url":"https://api.github.com/users/mesosphere/repos","events_url":"https://api.github.com/users/mesosphere/events{/privacy}","received_events_url":"https://api.github.com/users/mesosphere/received_events","type":"Organization","site_admin":false},"repo":{"id":10941345,"name":"chaos","full_name":"mesosphere/chaos","owner":{"login":"mesosphere","id":3458585,"avatar_url":"https://avatars.githubusercontent.com/u/3458585?v=3","gravatar_id":"","url":"https://api.github.com/users/mesosphere","html_url":"https://github.com/mesosphere","followers_url":"https://api.github.com/users/mesosphere/followers","following_url":"https://api.github.com/users/mesosphere/following{/other_user}","gists_url":"https://api.github.com/users/mesosphere/gists{/gist_id}","starred_url":"https://api.github.com/users/mesosphere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mesosphere/subscriptions","organizations_url":"https://api.github.com/users/mesosphere/orgs","repos_url":"https://api.github.com/users/mesosphere/repos","events_url":"https://api.github.com/users/mesosphere/events{/privacy}","received_events_url":"https://api.github.com/users/mesosphere/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mesosphere/chaos","description":"A lightweight framework for writing REST services in Scala.","fork":false,"url":"https://api.github.com/repos/mesosphere/chaos","forks_url":"https://api.github.com/repos/mesosphere/chaos/forks","keys_url":"https://api.github.com/repos/mesosphere/chaos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mesosphere/chaos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mesosphere/chaos/teams","hooks_url":"https://api.github.com/repos/mesosphere/chaos/hooks","issue_events_url":"https://api.github.com/repos/mesosphere/chaos/issues/events{/number}","events_url":"https://api.github.com/repos/mesosphere/chaos/events","assignees_url":"https://api.github.com/repos/mesosphere/chaos/assignees{/user}","branches_url":"https://api.github.com/repos/mesosphere/chaos/branches{/branch}","tags_url":"https://api.github.com/repos/mesosphere/chaos/tags","blobs_url":"https://api.github.com/repos/mesosphere/chaos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mesosphere/chaos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mesosphere/chaos/git/refs{/sha}","trees_url":"https://api.github.com/repos/mesosphere/chaos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mesosphere/chaos/statuses/{sha}","languages_url":"https://api.github.com/repos/mesosphere/chaos/languages","stargazers_url":"https://api.github.com/repos/mesosphere/chaos/stargazers","contributors_url":"https://api.github.com/repos/mesosphere/chaos/contributors","subscribers_url":"https://api.github.com/repos/mesosphere/chaos/subscribers","subscription_url":"https://api.github.com/repos/mesosphere/chaos/subscription","commits_url":"https://api.github.com/repos/mesosphere/chaos/commits{/sha}","git_commits_url":"https://api.github.com/repos/mesosphere/chaos/git/commits{/sha}","comments_url":"https://api.github.com/repos/mesosphere/chaos/comments{/number}","issue_comment_url":"https://api.github.com/repos/mesosphere/chaos/issues/comments{/number}","contents_url":"https://api.github.com/repos/mesosphere/chaos/contents/{+path}","compare_url":"https://api.github.com/repos/mesosphere/chaos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mesosphere/chaos/merges","archive_url":"https://api.github.com/repos/mesosphere/chaos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mesosphere/chaos/downloads","issues_url":"https://api.github.com/repos/mesosphere/chaos/issues{/number}","pulls_url":"https://api.github.com/repos/mesosphere/chaos/pulls{/number}","milestones_url":"https://api.github.com/repos/mesosphere/chaos/milestones{/number}","notifications_url":"https://api.github.com/repos/mesosphere/chaos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mesosphere/chaos/labels{/name}","releases_url":"https://api.github.com/repos/mesosphere/chaos/releases{/id}","created_at":"2013-06-25T14:53:40Z","updated_at":"2015-07-23T21:32:02Z","pushed_at":"2015-07-23T15:27:04Z","git_url":"git://github.com/mesosphere/chaos.git","ssh_url":"git@github.com:mesosphere/chaos.git","clone_url":"https://github.com/mesosphere/chaos.git","svn_url":"https://github.com/mesosphere/chaos","homepage":"","size":1027,"stargazers_count":140,"watchers_count":140,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":19,"mirror_url":null,"open_issues_count":7,"forks":19,"open_issues":7,"watchers":140,"default_branch":"master"}},"base":{"label":"mesosphere:master","ref":"master","sha":"2e6c2a4aa3422599a742c904e18a8ae5ba0405ae","user":{"login":"mesosphere","id":3458585,"avatar_url":"https://avatars.githubusercontent.com/u/3458585?v=3","gravatar_id":"","url":"https://api.github.com/users/mesosphere","html_url":"https://github.com/mesosphere","followers_url":"https://api.github.com/users/mesosphere/followers","following_url":"https://api.github.com/users/mesosphere/following{/other_user}","gists_url":"https://api.github.com/users/mesosphere/gists{/gist_id}","starred_url":"https://api.github.com/users/mesosphere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mesosphere/subscriptions","organizations_url":"https://api.github.com/users/mesosphere/orgs","repos_url":"https://api.github.com/users/mesosphere/repos","events_url":"https://api.github.com/users/mesosphere/events{/privacy}","received_events_url":"https://api.github.com/users/mesosphere/received_events","type":"Organization","site_admin":false},"repo":{"id":10941345,"name":"chaos","full_name":"mesosphere/chaos","owner":{"login":"mesosphere","id":3458585,"avatar_url":"https://avatars.githubusercontent.com/u/3458585?v=3","gravatar_id":"","url":"https://api.github.com/users/mesosphere","html_url":"https://github.com/mesosphere","followers_url":"https://api.github.com/users/mesosphere/followers","following_url":"https://api.github.com/users/mesosphere/following{/other_user}","gists_url":"https://api.github.com/users/mesosphere/gists{/gist_id}","starred_url":"https://api.github.com/users/mesosphere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mesosphere/subscriptions","organizations_url":"https://api.github.com/users/mesosphere/orgs","repos_url":"https://api.github.com/users/mesosphere/repos","events_url":"https://api.github.com/users/mesosphere/events{/privacy}","received_events_url":"https://api.github.com/users/mesosphere/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mesosphere/chaos","description":"A lightweight framework for writing REST services in Scala.","fork":false,"url":"https://api.github.com/repos/mesosphere/chaos","forks_url":"https://api.github.com/repos/mesosphere/chaos/forks","keys_url":"https://api.github.com/repos/mesosphere/chaos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mesosphere/chaos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mesosphere/chaos/teams","hooks_url":"https://api.github.com/repos/mesosphere/chaos/hooks","issue_events_url":"https://api.github.com/repos/mesosphere/chaos/issues/events{/number}","events_url":"https://api.github.com/repos/mesosphere/chaos/events","assignees_url":"https://api.github.com/repos/mesosphere/chaos/assignees{/user}","branches_url":"https://api.github.com/repos/mesosphere/chaos/branches{/branch}","tags_url":"https://api.github.com/repos/mesosphere/chaos/tags","blobs_url":"https://api.github.com/repos/mesosphere/chaos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mesosphere/chaos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mesosphere/chaos/git/refs{/sha}","trees_url":"https://api.github.com/repos/mesosphere/chaos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mesosphere/chaos/statuses/{sha}","languages_url":"https://api.github.com/repos/mesosphere/chaos/languages","stargazers_url":"https://api.github.com/repos/mesosphere/chaos/stargazers","contributors_url":"https://api.github.com/repos/mesosphere/chaos/contributors","subscribers_url":"https://api.github.com/repos/mesosphere/chaos/subscribers","subscription_url":"https://api.github.com/repos/mesosphere/chaos/subscription","commits_url":"https://api.github.com/repos/mesosphere/chaos/commits{/sha}","git_commits_url":"https://api.github.com/repos/mesosphere/chaos/git/commits{/sha}","comments_url":"https://api.github.com/repos/mesosphere/chaos/comments{/number}","issue_comment_url":"https://api.github.com/repos/mesosphere/chaos/issues/comments{/number}","contents_url":"https://api.github.com/repos/mesosphere/chaos/contents/{+path}","compare_url":"https://api.github.com/repos/mesosphere/chaos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mesosphere/chaos/merges","archive_url":"https://api.github.com/repos/mesosphere/chaos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mesosphere/chaos/downloads","issues_url":"https://api.github.com/repos/mesosphere/chaos/issues{/number}","pulls_url":"https://api.github.com/repos/mesosphere/chaos/pulls{/number}","milestones_url":"https://api.github.com/repos/mesosphere/chaos/milestones{/number}","notifications_url":"https://api.github.com/repos/mesosphere/chaos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mesosphere/chaos/labels{/name}","releases_url":"https://api.github.com/repos/mesosphere/chaos/releases{/id}","created_at":"2013-06-25T14:53:40Z","updated_at":"2015-07-23T21:32:02Z","pushed_at":"2015-07-23T15:27:04Z","git_url":"git://github.com/mesosphere/chaos.git","ssh_url":"git@github.com:mesosphere/chaos.git","clone_url":"https://github.com/mesosphere/chaos.git","svn_url":"https://github.com/mesosphere/chaos","homepage":"","size":1027,"stargazers_count":140,"watchers_count":140,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":19,"mirror_url":null,"open_issues_count":7,"forks":19,"open_issues":7,"watchers":140,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mesosphere/chaos/pulls/37"},"html":{"href":"https://github.com/mesosphere/chaos/pull/37"},"issue":{"href":"https://api.github.com/repos/mesosphere/chaos/issues/37"},"comments":{"href":"https://api.github.com/repos/mesosphere/chaos/issues/37/comments"},"review_comments":{"href":"https://api.github.com/repos/mesosphere/chaos/pulls/37/comments"},"review_comment":{"href":"https://api.github.com/repos/mesosphere/chaos/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mesosphere/chaos/pulls/37/commits"},"statuses":{"href":"https://api.github.com/repos/mesosphere/chaos/statuses/eb2112577934dabedb9ca27f16a0db8ca5fe0277"}}}}