Source:
<code>private void runBuild(BuildSettings buildSettings) { URLService urlService = new URLService(); StreamConsumer buildConsole; <START> if (new SystemEnvironment().isConsoleLogsThroughWebsocketEnabled()) { <END> buildConsole = new ConsoleOutputWebsocketTransmitter(webSocketSessionHandler, buildSettings.getBuildId()); } else { buildConsole = new ConsoleOutputTransmitter( new RemoteConsoleAppender( urlService.prefixPartialUrl(buildSettings.getConsoleUrl()), httpService) ); } ArtifactsRepository artifactsRepository = new UrlBasedArtifactsRepository( httpService, urlService.prefixPartialUrl(buildSettings.getArtifactUploadBaseUrl()), urlService.prefixPartialUrl(buildSettings.getPropertyBaseUrl()), new ZipUtil()); DefaultBuildStateReporter buildStateReporter = new DefaultBuildStateReporter(webSocketSessionHandler, getAgentRuntimeInfo()); TimeProvider clock = new TimeProvider(); BuildVariables buildVariables = new BuildVariables(getAgentRuntimeInfo(), clock); BuildSession build = new BuildSession( buildSettings.getBuildId(), buildStateReporter, buildConsole, buildVariables, artifactsRepository, httpService, clock, new File(".")); this.buildSession.set(build); build.setEnv("GO_SERVER_URL", getSystemEnvironment().getServiceUrl()); getAgentRuntimeInfo().idle(); try { getAgentRuntimeInfo().busy(new AgentBuildingInfo(buildSettings.getBuildLocatorForDisplay(), buildSettings.getBuildLocator())); build.build(buildSettings.getBuildCommand()); } finally { try { buildConsole.stop(); } finally { getAgentRuntimeInfo().idle(); } } this.buildSession.set(null); }</code><technical_language>getSystemEnvironment().isConsoleLogsThroughWebsocketEnabled() instead</technical_language>

Target:
private void runBuild(BuildSettings buildSettings) { URLService urlService = new URLService(); StreamConsumer buildConsole; if (getSystemEnvironment().isConsoleLogsThroughWebsocketEnabled()) { buildConsole = new ConsoleOutputWebsocketTransmitter(webSocketSessionHandler, buildSettings.getBuildId()); } else { buildConsole = new ConsoleOutputTransmitter( new RemoteConsoleAppender( urlService.prefixPartialUrl(buildSettings.getConsoleUrl()), httpService) ); } ArtifactsRepository artifactsRepository = new UrlBasedArtifactsRepository( httpService, urlService.prefixPartialUrl(buildSettings.getArtifactUploadBaseUrl()), urlService.prefixPartialUrl(buildSettings.getPropertyBaseUrl()), new ZipUtil()); DefaultBuildStateReporter buildStateReporter = new DefaultBuildStateReporter(webSocketSessionHandler, getAgentRuntimeInfo()); TimeProvider clock = new TimeProvider(); BuildVariables buildVariables = new BuildVariables(getAgentRuntimeInfo(), clock); BuildSession build = new BuildSession( buildSettings.getBuildId(), buildStateReporter, buildConsole, buildVariables, artifactsRepository, httpService, clock, new File(".")); this.buildSession.set(build); build.setEnv("GO_SERVER_URL", getSystemEnvironment().getServiceUrl()); getAgentRuntimeInfo().idle(); try { getAgentRuntimeInfo().busy(new AgentBuildingInfo(buildSettings.getBuildLocatorForDisplay(), buildSettings.getBuildLocator())); build.build(buildSettings.getBuildCommand()); } finally { try { buildConsole.stop(); } finally { getAgentRuntimeInfo().idle(); } } this.buildSession.set(null); }