/** * Gets workspace status by its identifier. * * @param workspaceId workspace identifier */ public WorkspaceStatus getStatus(String workspaceId) { try (Unlocker ignored = lockService.readLock(workspaceId)) { final WorkspaceStatus status = statuses.get(workspaceId); return status != null ? status : STOPPED; } }
/** * Returns an optional wrapping the runtime context of the workspace with the given identifier, an * empty optional is returned in case the workspace doesn't have the runtime. */ public Optional<RuntimeContext> getRuntimeContext(String workspaceId) { try (Unlocker ignored = lockService.readLock(workspaceId)) { InternalRuntime<?> runtime = runtimes.get(workspaceId); if (runtime == null) { return Optional.empty(); } return Optional.of(runtime.getContext()); } }