Search in sources :

Example 1 with JavaCommandFactory

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

the class App method start.

public void start(String[] cliArguments) throws IOException {
    AppSettingsLoader settingsLoader = new AppSettingsLoaderImpl(cliArguments);
    AppSettings settings = settingsLoader.load();
    // order is important - logging must be configured before any other components (AppFileSystem, ...)
    AppLogging logging = new AppLogging(settings);
    logging.configure();
    AppFileSystem fileSystem = new AppFileSystem(settings);
    try (AppState appState = new AppStateFactory(settings).create()) {
        appState.registerSonarQubeVersion(getSonarqubeVersion());
        AppReloader appReloader = new AppReloaderImpl(settingsLoader, fileSystem, appState, logging);
        JavaCommandFactory javaCommandFactory = new JavaCommandFactoryImpl(settings);
        fileSystem.reset();
        try (JavaProcessLauncher javaProcessLauncher = new JavaProcessLauncherImpl(fileSystem.getTempDir())) {
            Scheduler scheduler = new SchedulerImpl(settings, appReloader, javaCommandFactory, javaProcessLauncher, appState);
            // intercepts CTRL-C
            Runtime.getRuntime().addShutdownHook(new ShutdownHook(scheduler));
            scheduler.schedule();
            stopRequestWatcher = StopRequestWatcherImpl.create(settings, scheduler, fileSystem);
            stopRequestWatcher.startWatching();
            scheduler.awaitTermination();
            stopRequestWatcher.stopWatching();
        }
        systemExit.exit(0);
    }
}
Also used : JavaCommandFactoryImpl(org.sonar.application.process.JavaCommandFactoryImpl) AppSettings(org.sonar.application.config.AppSettings) AppSettingsLoader(org.sonar.application.config.AppSettingsLoader) JavaProcessLauncherImpl(org.sonar.application.process.JavaProcessLauncherImpl) AppSettingsLoaderImpl(org.sonar.application.config.AppSettingsLoaderImpl) JavaProcessLauncher(org.sonar.application.process.JavaProcessLauncher) JavaCommandFactory(org.sonar.application.process.JavaCommandFactory)

Aggregations

AppSettings (org.sonar.application.config.AppSettings)1 AppSettingsLoader (org.sonar.application.config.AppSettingsLoader)1 AppSettingsLoaderImpl (org.sonar.application.config.AppSettingsLoaderImpl)1 JavaCommandFactory (org.sonar.application.process.JavaCommandFactory)1 JavaCommandFactoryImpl (org.sonar.application.process.JavaCommandFactoryImpl)1 JavaProcessLauncher (org.sonar.application.process.JavaProcessLauncher)1 JavaProcessLauncherImpl (org.sonar.application.process.JavaProcessLauncherImpl)1