예제 #1
0
  // Logger logger;
  public ServerServiceContainer startServer() throws ServletException {

    final Runnable shutdownCommand = backendContext.getShutdownCommand();
    try {
      if (shutdownCommand != null) {
        backendContext.setShutdownService(new ShutdownServiceImpl());
      }
      server = create();
      logger.info("Rapla server started");

      processors = server.getServletRequestPreprocessors();
      return server;
    } catch (Exception e) {
      logger.error(e.getMessage(), e);
      String message = "Error during initialization see logs for details: " + e.getMessage();
      if (server != null) {
        server.dispose();
      }
      if (shutdownCommand != null) {
        shutdownCommand.run();
      }

      throw new ServletException(message, e);
    }
  }
예제 #2
0
 public void stopServer() {
   if (server != null) {
     server.dispose();
   }
   final Runnable shutdownCommand = backendContext.getShutdownCommand();
   if (shutdownCommand != null) {
     shutdownCommand.run();
   }
 }