Source:
private void startQueue(String workspaceId, String envName, boolean recover) throws ServerException, NotFoundException, ConflictException { publishEvent(EventType.STARTING, workspaceId, null); MachineConfigImpl config = queuePeekOrFail(workspaceId); while (config != null) { MachineImpl machine = null; try { machine = startMachine(config, workspaceId, envName, recover); } catch (RuntimeException | ServerException | ConflictException | NotFoundException x) { if (config.isDev()) { publishEvent(EventType.ERROR, workspaceId, x.getLocalizedMessage()); cleanupStartResources(workspaceId); throw x; } LOG.error(format("Error while creating non-dev machine '%s' in workspace '%s', environment '%s'", config.getName(), workspaceId, envName), x); } boolean queuePolled = false; acquireWriteLock(workspaceId); try { ensurePreDestroyIsNotExecuted(); final Queue<MachineConfigImpl> queue = startQueues.get(workspaceId); if (queue != null) { queue.poll(); queuePolled = true; if (machine != null) { final RuntimeDescriptor descriptor = descriptors.get(workspaceId); if (config.isDev()) { descriptor.getRuntime().setDevMachine(machine); descriptor.setRuntimeStatus(WorkspaceStatus.RUNNING); } descriptor.getRuntime().getMachines().add(machine); } } } finally { releaseWriteLock(workspaceId); } if (machine != null && config.isDev()) { publishEvent(EventType.RUNNING, workspaceId, null); } if (!queuePolled) { if (machine != null) { machineManager.destroy(machine.getId(), false); } throw new ConflictException(format("Workspace '%s' start interrupted. " + "Workspace stopped before all its machines started", workspaceId)); } config = queuePeekOrFail(workspaceId); } acquireWriteLock(workspaceId); try { final Queue<MachineConfigImpl> queue = startQueues.get(workspaceId); if (queue != null && queue.isEmpty()) { startQueues.remove(workspaceId); } } finally { releaseWriteLock(workspaceId); } }

Target:
private void startQueue(String workspaceId, String envName, boolean recover) throws ServerException, NotFoundException, ConflictException { publishEvent(EventType.STARTING, workspaceId, null); MachineConfigImpl config = queuePeekOrFail(workspaceId); while (config != null) { MachineImpl machine = null; try { machine = startMachine(config, workspaceId, envName, recover); } catch (RuntimeException | ServerException | ConflictException | NotFoundException x) { if (config.isDev()) { publishEvent(EventType.ERROR, workspaceId, x.getLocalizedMessage()); cleanupStartResources(workspaceId); throw x; } LOG.error(format("Error while creating non-dev machine '%s' in workspace '%s', environment '%s'", config.getName(), workspaceId, envName), x); } boolean queuePolled = false; acquireWriteLock(workspaceId); try { ensurePreDestroyIsNotExecuted(); final Queue<MachineConfigImpl> queue = startQueues.get(workspaceId); if (queue != null) { queue.poll(); queuePolled = true; if (machine != null) { final RuntimeDescriptor descriptor = descriptors.get(workspaceId); if (config.isDev()) { descriptor.getRuntime().setDevMachine(machine); descriptor.setRuntimeStatus(WorkspaceStatus.RUNNING); } descriptor.getRuntime().getMachines().add(machine); } } } finally { releaseWriteLock(workspaceId); } if (machine != null && config.isDev()) { publishEvent(EventType.RUNNING, workspaceId, null); } if (!queuePolled) { if (machine != null) { machineManager.destroy(machine.getId(), false); } throw new ConflictException(format("Workspace '%s' start interrupted. Workspace stopped before all its machines started", workspaceId)); } config = queuePeekOrFail(workspaceId); } acquireWriteLock(workspaceId); try { final Queue<MachineConfigImpl> queue = startQueues.get(workspaceId); if (queue != null && queue.isEmpty()) { startQueues.remove(workspaceId); } } finally { releaseWriteLock(workspaceId); } }