From: <jef...@us...> - 2002-08-12 09:01:28
|
Update of /cvsroot/aft/Anteater/src/org/apache/anteater/test In directory usw-pr-cvs1:/tmp/cvs-serv32580 Modified Files: ServletContainer.java Log Message: Add a 'stop' method for stopping tomcat. Index: ServletContainer.java =================================================================== RCS file: /cvsroot/aft/Anteater/src/org/apache/anteater/test/ServletContainer.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- ServletContainer.java 8 Aug 2002 10:02:36 -0000 1.14 +++ ServletContainer.java 12 Aug 2002 09:01:25 -0000 1.15 @@ -71,8 +71,9 @@ */ public static synchronized ServletContainer getServletContainer() { - if (container == null) + if (container == null) { container = new ServletContainer(); + } return container; } @@ -195,10 +196,11 @@ } } - public void execute() + public void start() { - if (started) + if (started) { return; + } // If no ports have been specified, listen on the default one. if (portNumbers.size() == 0) @@ -299,11 +301,26 @@ System.out.println("[servletContainer] "+msg); } + public void stop() { + try { + tomcat.shutdown(); + //tomcat = null; + //container = null; + started = false; + } catch (TomcatException e) { + throw new BuildException("Can't shut down Tomcat: ",e); + } + } + public static void main(String[] args) throws Exception { - ServletContainer container = new ServletContainer(); + ServletContainer container = ServletContainer.getServletContainer(); container.setPort("8100, 8101"); - container.execute(); + container.start(); + container.stop(); + // FIXME: The following doesn't work but should + //container.start(); + //container.stop(); } } |