Exemplo n.º 1
0
  private void executeStartupTasks() {
    ComponentContainer startupContainer = servicesContainer.createChild();
    startupContainer.addSingleton(GwtPublisher.class);
    startupContainer.addSingleton(RegisterMetrics.class);
    startupContainer.addSingleton(RegisterRules.class);
    startupContainer.addSingleton(RegisterProvidedProfiles.class);
    startupContainer.addSingleton(EnableProfiles.class);
    startupContainer.addSingleton(ActivateDefaultProfiles.class);
    startupContainer.addSingleton(JdbcDriverDeployer.class);
    startupContainer.addSingleton(ServerMetadataPersister.class);
    startupContainer.addSingleton(RegisterQualityModels.class);
    startupContainer.addSingleton(DeleteDeprecatedMeasures.class);
    startupContainer.addSingleton(GeneratePluginIndex.class);
    startupContainer.addSingleton(RegisterNewDashboards.class);
    startupContainer.startComponents();

    startupContainer.getComponentByType(ServerLifecycleNotifier.class).notifyStart();

    // Do not put the following statements in a finally block.
    // It would hide the possible exception raised during startup
    // See SONAR-3107
    startupContainer.stopComponents();
    servicesContainer.removeChild();
    servicesContainer.getComponentByType(DatabaseSessionFactory.class).clear();
  }
Exemplo n.º 2
0
 public void stop() {
   if (rootContainer != null) {
     try {
       TimeProfiler profiler = new TimeProfiler().start("Stop sonar");
       rootContainer.stopComponents();
       rootContainer = null;
       connected = false;
       started = false;
       profiler.stop();
     } catch (Exception e) {
       LoggerFactory.getLogger(getClass()).debug("Fail to stop Sonar - ignored", e);
     }
   }
 }