{"action":"created","comment":{"url":"https://api.github.com/repos/eclipse/che/pulls/comments/68915051","id":68915051,"diff_hunk":"@@ -326,37 +343,42 @@ private MachineImpl createMachine(MachineConfigImpl machineConfig,\n                                                     null);\n \n         createMachineLogsDir(machineId);\n-        final LineConsumer machineLogger = getMachineLogger(machineId, getMachineChannels(machine.getConfig().getName(),\n-                                                                                          machine.getWorkspaceId(),\n-                                                                                          machine.getEnvName())\n-                .getOutput());\n+        final LineConsumer machineLogger = getMachineLogger(machineId, outputConsumer);\n \n         try {\n+            machineRegistry.addMachine(machine);\n             try {\n-                machineRegistry.addMachine(machine);\n                 instanceCreator.createInstance(instanceProvider, machine, machineLogger);\n             } catch (MachineException ex) {\n                 if (snapshot == null) {\n                     throw ex;\n                 }\n                 if (ex.getCause() instanceof SourceNotFoundException) {\n-                    final LineConsumer logger = getMachineLogger(machineId,\n-                                                                 getMachineChannels(machine.getConfig().getName(),\n-                                                                                    machine.getWorkspaceId(),\n-                                                                                    machine.getEnvName()).getOutput());\n                     LOG.error(\"Image of snapshot for machine \" + machineConfig.getName() + \" not found. \" +\n                               \"Machine will be created from origin source\");\n                     machine.getConfig().setSource(sourceCopy);\n+                    try {\n+                        machineRegistry.remove(machineId);\n+                    } catch (NotFoundException ignored) {\n+                        // machine is already removed, should never happen\n+                    }\n                     machineRegistry.addMachine(machine);\n-                    instanceCreator.createInstance(instanceProvider, machine, logger);\n+                    instanceCreator.createInstance(instanceProvider, machine, outputConsumer);\n                 }\n             }\n             return machine;\n-        } catch (ConflictException e) {\n+        } catch (ApiException e) {\n             try {\n                 machineLogger.close();\n-            } catch (IOException ignored) {\n+            } catch (IOException e1) {","path":"wsmaster/che-core-api-machine/src/main/java/org/eclipse/che/api/machine/server/MachineManager.java","position":158,"original_position":158,"commit_id":"589b07ed8d1b913201e2d465c76908e4a38a3395","original_commit_id":"589b07ed8d1b913201e2d465c76908e4a38a3395","user":{"login":"evoevodin","id":4053805,"avatar_url":"https://avatars.githubusercontent.com/u/4053805?v=3","gravatar_id":"","url":"https://api.github.com/users/evoevodin","html_url":"https://github.com/evoevodin","followers_url":"https://api.github.com/users/evoevodin/followers","following_url":"https://api.github.com/users/evoevodin/following{/other_user}","gists_url":"https://api.github.com/users/evoevodin/gists{/gist_id}","starred_url":"https://api.github.com/users/evoevodin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evoevodin/subscriptions","organizations_url":"https://api.github.com/users/evoevodin/orgs","repos_url":"https://api.github.com/users/evoevodin/repos","events_url":"https://api.github.com/users/evoevodin/events{/privacy}","received_events_url":"https://api.github.com/users/evoevodin/received_events","type":"User","site_admin":false},"body":"My preference:\r\nwhen you have nested exceptions it is always good to use significant names, as if you need to reuse nested exception it may be confusing to deal with _e_, _e1_, _e2_ etc. So i would rename `e -> apiEx`, `e1 -> ioEx`. ","created_at":"2016-06-29T09:38:01Z","updated_at":"2016-06-29T09:38:01Z","html_url":"https://github.com/eclipse/che/pull/1600#discussion_r68915051","pull_request_url":"https://api.github.com/repos/eclipse/che/pulls/1600","_links":{"self":{"href":"https://api.github.com/repos/eclipse/che/pulls/comments/68915051"},"html":{"href":"https://github.com/eclipse/che/pull/1600#discussion_r68915051"},"pull_request":{"href":"https://api.github.com/repos/eclipse/che/pulls/1600"}}},"pull_request":{"url":"https://api.github.com/repos/eclipse/che/pulls/1600","id":75610599,"html_url":"https://github.com/eclipse/che/pull/1600","diff_url":"https://github.com/eclipse/che/pull/1600.diff","patch_url":"https://github.com/eclipse/che/pull/1600.patch","issue_url":"https://api.github.com/repos/eclipse/che/issues/1600","number":1600,"state":"open","locked":false,"title":"[Not for merge] CHE-1368: rework machine's output/statuses events subscribing","user":{"login":"garagatyi","id":1851863,"avatar_url":"https://avatars.githubusercontent.com/u/1851863?v=3","gravatar_id":"","url":"https://api.github.com/users/garagatyi","html_url":"https://github.com/garagatyi","followers_url":"https://api.github.com/users/garagatyi/followers","following_url":"https://api.github.com/users/garagatyi/following{/other_user}","gists_url":"https://api.github.com/users/garagatyi/gists{/gist_id}","starred_url":"https://api.github.com/users/garagatyi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garagatyi/subscriptions","organizations_url":"https://api.github.com/users/garagatyi/orgs","repos_url":"https://api.github.com/users/garagatyi/repos","events_url":"https://api.github.com/users/garagatyi/events{/privacy}","received_events_url":"https://api.github.com/users/garagatyi/received_events","type":"User","site_admin":false},"body":"This PR is a part of contribution that change the way of streaming logs/statuses of machines of active environment in a workspace. This PR introduces changes on server side and require changes in UD and IDE clients to be merged in master.\r\n\r\nRework output/status events of machine to be per workspace as a\r\npart of implementation of new multi-machine environments.\r\nGet rid of usage of machine manager in workspace service\r\nRefactor code of machine manager.","created_at":"2016-06-29T08:53:56Z","updated_at":"2016-06-29T09:38:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bbeb917545347ddc5fce06fba18db2f7fbf03b60","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/eclipse/che/pulls/1600/commits","review_comments_url":"https://api.github.com/repos/eclipse/che/pulls/1600/comments","review_comment_url":"https://api.github.com/repos/eclipse/che/pulls/comments{/number}","comments_url":"https://api.github.com/repos/eclipse/che/issues/1600/comments","statuses_url":"https://api.github.com/repos/eclipse/che/statuses/589b07ed8d1b913201e2d465c76908e4a38a3395","head":{"label":"eclipse:CHE-1368","ref":"CHE-1368","sha":"589b07ed8d1b913201e2d465c76908e4a38a3395","user":{"login":"eclipse","id":56974,"avatar_url":"https://avatars.githubusercontent.com/u/56974?v=3","gravatar_id":"","url":"https://api.github.com/users/eclipse","html_url":"https://github.com/eclipse","followers_url":"https://api.github.com/users/eclipse/followers","following_url":"https://api.github.com/users/eclipse/following{/other_user}","gists_url":"https://api.github.com/users/eclipse/gists{/gist_id}","starred_url":"https://api.github.com/users/eclipse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eclipse/subscriptions","organizations_url":"https://api.github.com/users/eclipse/orgs","repos_url":"https://api.github.com/users/eclipse/repos","events_url":"https://api.github.com/users/eclipse/events{/privacy}","received_events_url":"https://api.github.com/users/eclipse/received_events","type":"Organization","site_admin":false},"repo":{"id":32935745,"name":"che","full_name":"eclipse/che","owner":{"login":"eclipse","id":56974,"avatar_url":"https://avatars.githubusercontent.com/u/56974?v=3","gravatar_id":"","url":"https://api.github.com/users/eclipse","html_url":"https://github.com/eclipse","followers_url":"https://api.github.com/users/eclipse/followers","following_url":"https://api.github.com/users/eclipse/following{/other_user}","gists_url":"https://api.github.com/users/eclipse/gists{/gist_id}","starred_url":"https://api.github.com/users/eclipse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eclipse/subscriptions","organizations_url":"https://api.github.com/users/eclipse/orgs","repos_url":"https://api.github.com/users/eclipse/repos","events_url":"https://api.github.com/users/eclipse/events{/privacy}","received_events_url":"https://api.github.com/users/eclipse/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/eclipse/che","description":"Eclipse Che: Next-generation Eclipse IDE.  Open source workspace server and cloud IDE.","fork":false,"url":"https://api.github.com/repos/eclipse/che","forks_url":"https://api.github.com/repos/eclipse/che/forks","keys_url":"https://api.github.com/repos/eclipse/che/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eclipse/che/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eclipse/che/teams","hooks_url":"https://api.github.com/repos/eclipse/che/hooks","issue_events_url":"https://api.github.com/repos/eclipse/che/issues/events{/number}","events_url":"https://api.github.com/repos/eclipse/che/events","assignees_url":"https://api.github.com/repos/eclipse/che/assignees{/user}","branches_url":"https://api.github.com/repos/eclipse/che/branches{/branch}","tags_url":"https://api.github.com/repos/eclipse/che/tags","blobs_url":"https://api.github.com/repos/eclipse/che/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eclipse/che/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eclipse/che/git/refs{/sha}","trees_url":"https://api.github.com/repos/eclipse/che/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eclipse/che/statuses/{sha}","languages_url":"https://api.github.com/repos/eclipse/che/languages","stargazers_url":"https://api.github.com/repos/eclipse/che/stargazers","contributors_url":"https://api.github.com/repos/eclipse/che/contributors","subscribers_url":"https://api.github.com/repos/eclipse/che/subscribers","subscription_url":"https://api.github.com/repos/eclipse/che/subscription","commits_url":"https://api.github.com/repos/eclipse/che/commits{/sha}","git_commits_url":"https://api.github.com/repos/eclipse/che/git/commits{/sha}","comments_url":"https://api.github.com/repos/eclipse/che/comments{/number}","issue_comment_url":"https://api.github.com/repos/eclipse/che/issues/comments{/number}","contents_url":"https://api.github.com/repos/eclipse/che/contents/{+path}","compare_url":"https://api.github.com/repos/eclipse/che/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eclipse/che/merges","archive_url":"https://api.github.com/repos/eclipse/che/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eclipse/che/downloads","issues_url":"https://api.github.com/repos/eclipse/che/issues{/number}","pulls_url":"https://api.github.com/repos/eclipse/che/pulls{/number}","milestones_url":"https://api.github.com/repos/eclipse/che/milestones{/number}","notifications_url":"https://api.github.com/repos/eclipse/che/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eclipse/che/labels{/name}","releases_url":"https://api.github.com/repos/eclipse/che/releases{/id}","deployments_url":"https://api.github.com/repos/eclipse/che/deployments","created_at":"2015-03-26T15:31:01Z","updated_at":"2016-06-29T07:30:06Z","pushed_at":"2016-06-29T09:34:23Z","git_url":"git://github.com/eclipse/che.git","ssh_url":"git@github.com:eclipse/che.git","clone_url":"https://github.com/eclipse/che.git","svn_url":"https://github.com/eclipse/che","homepage":"http://eclipse.org/che","size":40099,"stargazers_count":2929,"watchers_count":2929,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":451,"mirror_url":null,"open_issues_count":141,"forks":451,"open_issues":141,"watchers":2929,"default_branch":"master"}},"base":{"label":"eclipse:master","ref":"master","sha":"58654dfcb12ef86470505bd7ac26180581833b17","user":{"login":"eclipse","id":56974,"avatar_url":"https://avatars.githubusercontent.com/u/56974?v=3","gravatar_id":"","url":"https://api.github.com/users/eclipse","html_url":"https://github.com/eclipse","followers_url":"https://api.github.com/users/eclipse/followers","following_url":"https://api.github.com/users/eclipse/following{/other_user}","gists_url":"https://api.github.com/users/eclipse/gists{/gist_id}","starred_url":"https://api.github.com/users/eclipse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eclipse/subscriptions","organizations_url":"https://api.github.com/users/eclipse/orgs","repos_url":"https://api.github.com/users/eclipse/repos","events_url":"https://api.github.com/users/eclipse/events{/privacy}","received_events_url":"https://api.github.com/users/eclipse/received_events","type":"Organization","site_admin":false},"repo":{"id":32935745,"name":"che","full_name":"eclipse/che","owner":{"login":"eclipse","id":56974,"avatar_url":"https://avatars.githubusercontent.com/u/56974?v=3","gravatar_id":"","url":"https://api.github.com/users/eclipse","html_url":"https://github.com/eclipse","followers_url":"https://api.github.com/users/eclipse/followers","following_url":"https://api.github.com/users/eclipse/following{/other_user}","gists_url":"https://api.github.com/users/eclipse/gists{/gist_id}","starred_url":"https://api.github.com/users/eclipse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eclipse/subscriptions","organizations_url":"https://api.github.com/users/eclipse/orgs","repos_url":"https://api.github.com/users/eclipse/repos","events_url":"https://api.github.com/users/eclipse/events{/privacy}","received_events_url":"https://api.github.com/users/eclipse/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/eclipse/che","description":"Eclipse Che: Next-generation Eclipse IDE.  Open source workspace server and cloud IDE.","fork":false,"url":"https://api.github.com/repos/eclipse/che","forks_url":"https://api.github.com/repos/eclipse/che/forks","keys_url":"https://api.github.com/repos/eclipse/che/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eclipse/che/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eclipse/che/teams","hooks_url":"https://api.github.com/repos/eclipse/che/hooks","issue_events_url":"https://api.github.com/repos/eclipse/che/issues/events{/number}","events_url":"https://api.github.com/repos/eclipse/che/events","assignees_url":"https://api.github.com/repos/eclipse/che/assignees{/user}","branches_url":"https://api.github.com/repos/eclipse/che/branches{/branch}","tags_url":"https://api.github.com/repos/eclipse/che/tags","blobs_url":"https://api.github.com/repos/eclipse/che/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eclipse/che/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eclipse/che/git/refs{/sha}","trees_url":"https://api.github.com/repos/eclipse/che/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eclipse/che/statuses/{sha}","languages_url":"https://api.github.com/repos/eclipse/che/languages","stargazers_url":"https://api.github.com/repos/eclipse/che/stargazers","contributors_url":"https://api.github.com/repos/eclipse/che/contributors","subscribers_url":"https://api.github.com/repos/eclipse/che/subscribers","subscription_url":"https://api.github.com/repos/eclipse/che/subscription","commits_url":"https://api.github.com/repos/eclipse/che/commits{/sha}","git_commits_url":"https://api.github.com/repos/eclipse/che/git/commits{/sha}","comments_url":"https://api.github.com/repos/eclipse/che/comments{/number}","issue_comment_url":"https://api.github.com/repos/eclipse/che/issues/comments{/number}","contents_url":"https://api.github.com/repos/eclipse/che/contents/{+path}","compare_url":"https://api.github.com/repos/eclipse/che/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eclipse/che/merges","archive_url":"https://api.github.com/repos/eclipse/che/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eclipse/che/downloads","issues_url":"https://api.github.com/repos/eclipse/che/issues{/number}","pulls_url":"https://api.github.com/repos/eclipse/che/pulls{/number}","milestones_url":"https://api.github.com/repos/eclipse/che/milestones{/number}","notifications_url":"https://api.github.com/repos/eclipse/che/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eclipse/che/labels{/name}","releases_url":"https://api.github.com/repos/eclipse/che/releases{/id}","deployments_url":"https://api.github.com/repos/eclipse/che/deployments","created_at":"2015-03-26T15:31:01Z","updated_at":"2016-06-29T07:30:06Z","pushed_at":"2016-06-29T09:34:23Z","git_url":"git://github.com/eclipse/che.git","ssh_url":"git@github.com:eclipse/che.git","clone_url":"https://github.com/eclipse/che.git","svn_url":"https://github.com/eclipse/che","homepage":"http://eclipse.org/che","size":40099,"stargazers_count":2929,"watchers_count":2929,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":451,"mirror_url":null,"open_issues_count":141,"forks":451,"open_issues":141,"watchers":2929,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/eclipse/che/pulls/1600"},"html":{"href":"https://github.com/eclipse/che/pull/1600"},"issue":{"href":"https://api.github.com/repos/eclipse/che/issues/1600"},"comments":{"href":"https://api.github.com/repos/eclipse/che/issues/1600/comments"},"review_comments":{"href":"https://api.github.com/repos/eclipse/che/pulls/1600/comments"},"review_comment":{"href":"https://api.github.com/repos/eclipse/che/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/eclipse/che/pulls/1600/commits"},"statuses":{"href":"https://api.github.com/repos/eclipse/che/statuses/589b07ed8d1b913201e2d465c76908e4a38a3395"}}}}
{"actor":{"display_login":"evoevodin"}}