congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
WorkspaceRuntimes
Code IndexAdd Tabnine to your IDE (free)

How to use
WorkspaceRuntimes
in
org.eclipse.che.api.workspace.server

Best Java code snippets using org.eclipse.che.api.workspace.server.WorkspaceRuntimes (Showing top 14 results out of 315)

origin: org.eclipse.che.core/che-core-api-workspace

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());
    }
   }
  }
 }
}
origin: org.eclipse.che.core/che-core-api-workspace

private WorkspaceSuspendedEventsPropagator() {
 this.totalRunning = runtimes.getInProgress().size();
 this.currentlyStopped = new AtomicInteger(0);
}
origin: org.eclipse.che.core/che-core-api-workspace

/** Returns a set of supported recipe types */
public Set<String> getSupportedRecipes() {
 return runtimes.getSupportedRecipes();
}
origin: org.eclipse.che.core/che-core-api-workspace

private WorkspaceImpl normalizeState(WorkspaceImpl workspace, boolean includeRuntimes)
  throws ServerException {
 if (includeRuntimes) {
  runtimes.injectRuntime(workspace);
 } else {
  workspace.setStatus(runtimes.getStatus(workspace.getId()));
 }
 return workspace;
}
origin: org.eclipse.che.core/che-core-api-workspace

 environment = copyEnv(workspace, envName);
 requireNonNull(environment, "Environment should not be null " + workspaceId);
 requireNonNull(environment.getRecipe(), "Recipe should not be null " + workspaceId);
try {
 InternalEnvironment internalEnv =
   createInternalEnvironment(
     environment, workspaceConfig.getAttributes(), workspaceConfig.getCommands());
 RuntimeContext runtimeContext = infrastructure.prepare(runtimeId, internalEnv);
       workspaceId, existingStatus));
  setRuntimesId(workspaceId);
  runtimes.put(workspaceId, runtime);
   workspaceConfig.getName(),
   workspace.getId(),
   sessionUserNameOr("undefined"));
 publishWorkspaceStatusEvent(workspaceId, STARTING, STOPPED, null);
 return CompletableFuture.runAsync(
   ThreadLocalPropagateContext.wrap(new StartRuntimeTask(workspace, options, runtime)),
origin: org.eclipse.che.core/che-core-api-workspace

 private void addRuntimeLinks(
   Map<String, String> links, String workspaceId, ServiceContext serviceContext)
   throws ServerException {
  URI uri = serviceContext.getServiceUriBuilder().build();
  links.put(
    LINK_REL_ENVIRONMENT_STATUS_CHANNEL,
    UriBuilder.fromUri(cheWebsocketEndpoint)
      .scheme(uri.getScheme().equals("https") ? "wss" : "ws")
      .host(uri.getHost())
      .port(uri.getPort())
      .build()
      .toString());

  Optional<RuntimeContext> ctxOpt = workspaceRuntimes.getRuntimeContext(workspaceId);
  if (ctxOpt.isPresent()) {
   try {
    links.put(LINK_REL_ENVIRONMENT_OUTPUT_CHANNEL, ctxOpt.get().getOutputChannel().toString());
   } catch (UnsupportedOperationException e) {
    // Do not include output channel to links since it is not supported by context
   } catch (InfrastructureException x) {
    throw new ServerException(x.getMessage(), x);
   }
  }
 }
}
origin: org.eclipse.che.core/che-core-api-workspace

/**
 * Injects runtime information such as status and {@link
 * org.eclipse.che.api.core.model.workspace.Runtime} into the workspace object, if the workspace
 * doesn't have runtime sets the status to {@link WorkspaceStatus#STOPPED}.
 *
 * @param workspace the workspace to inject runtime into
 */
public void injectRuntime(WorkspaceImpl workspace) throws ServerException {
 try (Unlocker ignored = lockService.writeLock(workspace.getId())) {
  WorkspaceStatus workspaceStatus = statuses.get(workspace.getId());
  if (workspaceStatus == null) {
   workspace.setStatus(STOPPED);
   return;
  }
  InternalRuntime<?> internalRuntime;
  try {
   internalRuntime = getInternalRuntime(workspace.getId());
  } catch (ServerException | InfrastructureException e) {
   workspace.setStatus(STOPPED);
   return;
  }
  workspace.setRuntime(asRuntime(internalRuntime));
  workspace.setStatus(workspaceStatus);
 }
}
origin: org.eclipse.che.core/che-core-api-workspace

public void validate(Environment environment)
  throws NotFoundException, InfrastructureException, ValidationException {
 String type = environment.getRecipe().getType();
 if (!infrastructure.getRecipeTypes().contains(type)) {
  throw new NotFoundException("Infrastructure not found for type: " + type);
 }
 // try to create internal environment to check if the specified environment is valid
 createInternalEnvironment(environment, emptyMap(), emptyList());
}
origin: org.eclipse.che.core/che-core-api-workspace

private WorkspaceStoppedEventsPropagator() {
 this.totalRunning = runtimes.getActive().size();
 this.currentlyStopped = new AtomicInteger(0);
}
origin: org.eclipse.che.core/che-core-api-workspace

/**
 * Removes workspace with specified identifier.
 *
 * <p>
 *
 * <p>Does not remove the workspace if it has the runtime, throws {@link ConflictException} in
 * this case. Won't throw any exception if workspace doesn't exist.
 *
 * @param workspaceId workspace id to remove workspace
 * @throws ConflictException when workspace has runtime
 * @throws ServerException when any server error occurs
 * @throws NullPointerException when {@code workspaceId} is null
 */
@Traced
public void removeWorkspace(String workspaceId) throws ConflictException, ServerException {
 requireNonNull(workspaceId, "Required non-null workspace id");
 if (runtimes.hasRuntime(workspaceId)) {
  throw new ConflictException(
    format("The workspace '%s' is currently running and cannot be removed.", workspaceId));
 }
 workspaceDao.remove(workspaceId);
 LOG.info("Workspace '{}' removed by user '{}'", workspaceId, sessionUserNameOrUndefined());
}
origin: org.eclipse.che.core/che-core-api-workspace

 @VisibleForTesting
 void removeTemporaryWs() throws ServerException {
  for (WorkspaceImpl workspace :
    Pages.iterate(
      (maxItems, skipCount) -> workspaceDao.getWorkspaces(true, maxItems, skipCount))) {
   WorkspaceStatus status = runtimes.getStatus(workspace.getId());
   if (status == WorkspaceStatus.STOPPED) {
    try {
     workspaceDao.remove(workspace.getId());
    } catch (ServerException e) {
     LOG.error(
       "Unable to cleanup temporary workspace {}. Reason is {}",
       workspace.getId(),
       e.getMessage());
    }
   }
  }
 }
}
origin: org.eclipse.che.core/che-core-api-workspace

InternalRuntime<?> runtime = null;
try {
 runtime = getInternalRuntime(workspaceId);
origin: org.eclipse.che.infrastructure/infrastructure-openshift

@SuppressWarnings("rawtypes")
Optional<RuntimeContext> context =
  workspaceRuntimeProvider.get().getRuntimeContext(workspaceId);
workspaceOwnerId = context.map(c -> c.getIdentity().getOwnerId()).orElse(null);
origin: org.eclipse.che.core/che-core-api-workspace

try {
 InternalEnvironment internalEnv =
   createInternalEnvironment(
     environment, workspaceConfig.getAttributes(), workspaceConfig.getCommands());
 runtime = infra.prepare(identity, internalEnv).getRuntime();
org.eclipse.che.api.workspace.serverWorkspaceRuntimes

Javadoc

Defines an internal API for managing RuntimeImpl instances.

Most used methods

  • getRuntimeContext
    Returns an optional wrapping the runtime context of the workspace with the given identifier, an empt
  • asRuntime
  • copyEnv
  • createInternalEnvironment
  • getActive
    Gets the workspaces identifiers managed by this component. If an identifier is present in set then t
  • getInProgress
    Gets the list of workspace id's which are currently starting or stopping on given node. (it's status
  • getInternalRuntime
    Returns InternalRuntime implementation for workspace with the specified id.If memory-storage does no
  • getStatus
    Gets workspace status by its identifier.
  • getSupportedRecipes
  • hasRuntime
    Returns true if workspace was started and its status is WorkspaceStatus#RUNNING, WorkspaceStatus#STA
  • injectRuntime
    Injects runtime information such as status and org.eclipse.che.api.core.model.workspace.Runtime into
  • isAnyActive
    Returns true if there is at least one workspace active(it's status is different from WorkspaceStatus
  • injectRuntime,
  • isAnyActive,
  • isAnyInProgress,
  • publishWorkspaceStatusEvent,
  • recover,
  • recoverOne,
  • refuseStart,
  • sessionUserNameOr,
  • setRuntimesId,
  • startAsync

Popular in Java

  • Running tasks concurrently on multiple threads
  • notifyDataSetChanged (ArrayAdapter)
  • onRequestPermissionsResult (Fragment)
  • scheduleAtFixedRate (Timer)
  • Menu (java.awt)
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Reference (javax.naming)
  • JLabel (javax.swing)
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now