Exemplo n.º 1
0
  @Override
  public void init() throws ServletException {
    super.init();

    HibernateUtil.init();

    try {
      for (Controller instance : controller) {
        communicationService.registerForPacketReceivedEvents(instance);
        communicationService.registerForPlayerConnectedEvents(instance);
        communicationService.registerForPlayerDisconnectedEvents(instance);

        instance.init();
      }
    } catch (RuntimeException e) {
      logger.error("Exception on initialization", e);
      throw e;
    }

    communicationService.init();
    logger.info("Servlet initialized");
    logger.info("Build Date: {}", Version.getBuildDate());
    logger.info("Build Number: {}", Version.getBuildNumber());
    logger.info("Build from Revision: {}", Version.getBuildRevision());
  }
Exemplo n.º 2
0
  @Override
  public void destroy() {
    for (Controller instance : controller) {
      communicationService.unregisterForPacketReceivedEvents(instance);
      communicationService.unregisterForPlayerConnectedEvents(instance);
      communicationService.unregisterForPlayerDisconnectedEvents(instance);

      instance.shutdown();
    }

    communicationService.shutdown();
    HibernateUtil.shutdown();

    logger.info("Servlet destroyed");
    super.destroy();
  }