Search in sources :

Example 1 with ManagedProcessHandler

use of org.sonar.application.process.ManagedProcessHandler in project sonarqube by SonarSource.

the class SchedulerImpl method stopProcess.

/**
 * Request for graceful stop then blocks until process is stopped.
 * Returns immediately if the process is disabled in configuration.
 *
 * @throws InterruptedException if {@link ManagedProcessHandler#hardStop()} throws a {@link InterruptedException}
 */
private void stopProcess(ProcessId processId) throws InterruptedException {
    ManagedProcessHandler process = processesById.get(processId);
    if (process != null) {
        LOG.debug("Stopping [{}]...", process.getProcessId().getKey());
        process.stop();
    }
}
Also used : ManagedProcessHandler(org.sonar.application.process.ManagedProcessHandler)

Example 2 with ManagedProcessHandler

use of org.sonar.application.process.ManagedProcessHandler in project sonarqube by SonarSource.

the class SchedulerImpl method schedule.

@Override
public void schedule() throws InterruptedException {
    if (!nodeLifecycle.tryToMoveTo(NodeLifecycle.State.STARTING)) {
        return;
    }
    firstWaitingEsLog.set(true);
    processesById.clear();
    for (ProcessId processId : ClusterSettings.getEnabledProcesses(settings)) {
        ManagedProcessHandler process = ManagedProcessHandler.builder(processId).addProcessLifecycleListener(this).addEventListener(this).setWatcherDelayMs(processWatcherDelayMs).setStopTimeout(stopTimeoutFor(processId, settings)).setHardStopTimeout(HARD_STOP_TIMEOUT).setAppSettings(settings).build();
        processesById.put(process.getProcessId(), process);
    }
    operationalCountDown.set(processesById.size());
    tryToStartAll();
}
Also used : ManagedProcessHandler(org.sonar.application.process.ManagedProcessHandler) ProcessId(org.sonar.process.ProcessId)

Aggregations

ManagedProcessHandler (org.sonar.application.process.ManagedProcessHandler)2 ProcessId (org.sonar.process.ProcessId)1