private void terminate() { // Stop the run daemon. try { runQ.exit(); } catch (Throwable t) { logger.log(Level.SEVERE, "Error shutting down run daemon", t); } // Shutdown the log server. if (logServer != null) try { logServer.shutdown(); } catch (Throwable t) { logger.log(Level.SEVERE, "Error shutting down log server", t); } }
private void init(ServletContext ctx, HttpServletRequest request) throws IOException { String path = ctx.getRealPath(""); if (path == null) path = ctx.getRealPath("."); path = path + File.separator; if (path != null) System.setProperty("faban.root", path); String fabanHome = ctx.getInitParameter("faban.home"); if (fabanHome != null) System.setProperty("faban.home", fabanHome); StringBuffer reqUrl = request.getRequestURL(); int uriLength = reqUrl.length() - request.getRequestURI().length() + request.getContextPath().length(); reqUrl.setLength(++uriLength); System.setProperty("faban.url", reqUrl.toString()); // Access config NOW, static initializers will config the logging // before we instatiate a logger. path = Config.DEFAULT_LOG_FILE; logger = Logger.getLogger(this.getClass().getName()); logger.fine("Faban logging to " + path); // Instantiate the runq which in turn will start the runDaemon runQ = RunQ.getHandle(); logger.fine("RunQ created"); if (Config.daemonMode == Config.DaemonModes.POLLER || Config.daemonMode == Config.DaemonModes.LOCAL) { logServer = new LogServer(new LogConfig()); // Share the thread pool for other uses, too. Config.THREADPOOL = logServer.config.threadPool; logServer.start(); } }