private WorkspaceStoppedEventsPropagator() { this.totalRunning = runtimes.getActive().size(); this.currentlyStopped = new AtomicInteger(0); }
private void stopRunningAndStartingWorkspacesAsync() { for (String workspaceId : runtimes.getActive()) { WorkspaceStatus status = runtimes.getStatus(workspaceId); if (status == WorkspaceStatus.RUNNING || status == WorkspaceStatus.STARTING) { try { manager.stopWorkspace(workspaceId, Collections.emptyMap()); } catch (ServerException | ConflictException | NotFoundException x) { if (runtimes.hasRuntime(workspaceId)) { LOG.error( "Couldn't get the workspace '{}' while it's running, the occurred error: '{}'", workspaceId, x.getMessage()); } } } } }