@DELETE @Path("/{id}/runtime") @ApiOperation( value = "Stop the workspace", notes = "This operation can be performed only by the workspace owner." + "The workspace stops asynchronously") @ApiResponses({ @ApiResponse(code = 204, message = "The workspace is stopping"), @ApiResponse(code = 404, message = "The workspace with specified id doesn't exist"), @ApiResponse(code = 403, message = "The user is not workspace owner"), @ApiResponse(code = 500, message = "Internal server error occurred") }) public void stop(@ApiParam("The workspace id") @PathParam("id") String id) throws ForbiddenException, NotFoundException, ServerException, ConflictException { workspaceManager.stopWorkspace(id, emptyMap()); }
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()); } } } } }