GestoriStartupThread.java

  1. /*
  2.  * GovWay - A customizable API Gateway
  3.  * https://govway.org
  4.  *
  5.  * Copyright (c) 2005-2025 Link.it srl (https://link.it).
  6.  *
  7.  * This program is free software: you can redistribute it and/or modify
  8.  * it under the terms of the GNU General Public License version 3, as published by
  9.  * the Free Software Foundation.
  10.  *
  11.  * This program is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  * GNU General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU General Public License
  17.  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18.  *
  19.  */

  20. package org.openspcoop2.web.ctrlstat.gestori;

  21. import org.slf4j.Logger;
  22. import org.openspcoop2.web.ctrlstat.core.ControlStationCore;
  23. import org.openspcoop2.web.ctrlstat.core.ControlStationLogger;

  24. /**
  25. *
  26. * GestoriStartupThread
  27. *
  28. * @author Andrea Poli (apoli@link.it)
  29. * @author $Author$
  30. * @version $Rev$, $Date$
  31. *
  32. */
  33. public class GestoriStartupThread implements Runnable {
  34.    
  35.      private Logger log = null;

  36.      // Gestori
  37.      private GestorePdDInitThread pddInit;
  38.      private GestoreRegistroThread registro;
  39.      private SmistatoreThread smistatore;
  40.      //private GestoreEventi gestoreEventi;

  41.      public GestoriStartupThread() {
  42.          this.log = ControlStationLogger.getPddConsoleCoreLogger();
  43.      }

  44.      @Override
  45.     public void run() {
  46.          
  47.          try{
  48.          
  49.              // Controllo inizializzazione risorse
  50.              // L'inizializzazione del core attende anche che venga inizializzato il datasource
  51.              new ControlStationCore();
  52.              
  53.              // Adesso posso avviare i Gestori
  54.              this.log.info("Inizializzazione Gestori....");
  55.              
  56.              // Gestore PDD
  57.              this.pddInit = new GestorePdDInitThread();
  58.              this.log.info("Avvio " + this.pddInit.getClass().getName());
  59.              new Thread(this.pddInit).start();
  60.    
  61.              // Registro
  62.              this.registro = new GestoreRegistroThread();
  63.              this.log.info("Avvio " + this.registro.getClass().getName());
  64.              new Thread(this.registro).start();
  65.    
  66.              // Smistatore
  67.              this.smistatore = new SmistatoreThread();
  68.              this.log.info("Avvio " + this.smistatore.getClass().getName());
  69.              new Thread(this.smistatore).start();
  70.    
  71.              // Gestore Eventi
  72.              /*
  73.              this.gestoreEventi = new GestoreEventi();
  74.              this.log.info("Avvio " + this.gestoreEventi.getClass().getName());
  75.              new Thread(this.gestoreEventi).start();
  76.              */
  77.    
  78.              this.log.info("Inizializzazione Gestori effettuata con successo.");
  79.              
  80.          }catch(Exception e){
  81.              this.log.error(e.getMessage(),e);
  82.              throw new RuntimeException(e.getMessage(),e);
  83.          }
  84.          
  85.      }
  86.      
  87.      public void stopGestori() {
  88.          this.log.info("Terminazione Gestori in corso...");

  89.          this.pddInit.stopGestore();
  90.          this.registro.stopGestore();
  91.          this.smistatore.stopGestore();
  92.          //this.gestoreEventi.stopGestore();

  93.          this.log.info("Terminazione gestori effettuata con successo.");
  94.      }
  95. }