1 /* Copyright (c) 2011 Peter Troshin
\r
3 * JAva Bioinformatics Analysis Web Services (JABAWS) @version: 2.0
\r
5 * This library is free software; you can redistribute it and/or modify it under the terms of the
\r
6 * Apache License version 2 as published by the Apache Software Foundation
\r
8 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
\r
9 * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache
\r
10 * License for more details.
\r
12 * A copy of the license is in apache_license.txt. It is also available here:
\r
13 * @see: http://www.apache.org/licenses/LICENSE-2.0.txt
\r
15 * Any republication or derived work distributed in source code form
\r
16 * must include this copyright and license notice.
\r
18 package compbio.ws.server;
\r
20 import javax.servlet.ServletContextEvent;
\r
21 import javax.servlet.ServletContextListener;
\r
23 import org.apache.log4j.Logger;
\r
25 import compbio.engine.local.ExecutableWrapper;
\r
26 import compbio.engine.local.LocalExecutorService;
\r
29 * Switch off engines if JABAWS web application is undeployed, or web server is
\r
32 * @author Peter Troshin
\r
35 public class ShutdownEngines implements ServletContextListener {
\r
37 private final Logger log = Logger.getLogger(ShutdownEngines.class);
\r
40 public void contextDestroyed(ServletContextEvent ignored) {
\r
41 // Shutdown local engine
\r
42 log.info("JABAWS context is destroyed. Shutting down engines...");
\r
43 LocalExecutorService.shutDown();
\r
44 log.info("Local engine is shutdown OK");
\r
45 ExecutableWrapper.shutdownService();
\r
46 log.info("Individual executables stream engine is shutdown OK");
\r
50 public void contextInitialized(ServletContextEvent arg0) {
\r