Exemple #1
0
  public void init() throws ServletException {
    try {
      // Load configuration (from classpath or WEB-INF root path)
      String webInfPath = getServletContext().getRealPath("/") + "/WEB-INF";
      Config.load(webInfPath);
      Log.init();
      // Start
      Log.info(
          "init() Pushlet Webapp - version="
              + Version.SOFTWARE_VERSION
              + " built="
              + Version.BUILD_DATE);
      // Start session manager
      SessionManager.getInstance().start();
      // Start event Dispatcher
      Dispatcher.getInstance().start();

      if (Config.getBoolProperty(Config.SOURCES_ACTIVATE)) {
        EventSourceManager.start(webInfPath);
      } else {
        Log.info("Not starting local event sources");
      }
    } catch (Throwable t) {
      throw new ServletException("Failed to initialize Pushlet framework " + t, t);
    }
  }
Exemple #2
0
 public void destroy() {
   Log.info("destroy(): Exit Pushlet webapp");
   if (Config.getBoolProperty(Config.SOURCES_ACTIVATE)) {
     // Stop local event sources
     EventSourceManager.stop();
   } else {
     Log.info("No local event sources to stop");
   }
   // Should abort all subscribers
   Dispatcher.getInstance().stop();
   // Should stop all sessions
   SessionManager.getInstance().stop();
 }