wood burning stoves
The moose likes Servlets and the fly likes destroy() and killing servlet threads Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "destroy() and killing servlet threads" Watch "destroy() and killing servlet threads" New topic

destroy() and killing servlet threads

Steve Ohi

Joined: Aug 02, 2000
Posts: 6
I am having a problem viewing changes which I am making to my servlets. I am trying to change the output of this servlet from:
This is output from SimpleServlet
This is output from SimpleServlet99
I tried using destroy() at the end of this code but it didn't seem to work. Anyone suggestions ?
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Test2Servlet extends HttpServlet
public void doGet (
) throws ServletException, IOException
Stringtitle = "Simple Servlet Output";
out.println("<H1>" + title + "</H1>");
out.println("<P>This is output from SimpleServlet99.");

[This message has been edited by Steve Ohi (edited November 06, 2000).]
Paul Wetzel
Ranch Hand

Joined: Nov 02, 1999
Posts: 107
I dont see why your code wouldn't work. Have you stopped and restarted your server. Some servers require that you stop and then restart your server to reload servlets.
hope this helps
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12868
The destroy method should never be called by your code. It is called by the servlet engine just before shutdown or removing your servlet instance for some other reason.
Whether your servlet engine will automatically notice a change and reload the servlet class depends on the particular engine. JRun does a nice job. With Tomcat 3.1 I always stop and restart just to be sure.
Prasad Charasala
Ranch Hand

Joined: Nov 02, 2000
Posts: 67
Your code is missing
out = response.getWriter();
Probably your new code has not compiled. If it is compiled, servlet container did not loqded your new class file. Stop and then start your server.


It is sorta covered in the JavaRanch Style Guide.
subject: destroy() and killing servlet threads