aspose file tools*
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
JavaRanch » Java Forums » Java » Servlets
Bookmark "destroy() and killing servlet threads" Watch "destroy() and killing servlet threads" New topic
Author

destroy() and killing servlet threads

Steve Ohi
Greenhorn

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
to
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 (
HttpServletRequestrequest,
HttpServletResponseresponse
) throws ServletException, IOException
{
PrintWriterout;
Stringtitle = "Simple Servlet Output";
response.setContentType("text/html");
out.println("<HTML><HEAD><TITLE>");
out.println(title);
out.println("</TITLE></HEAD><BODY>");
out.println("<H1>" + title + "</H1>");
out.println("<P>This is output from SimpleServlet99.");
out.println("</BODY></HTML>");
out.close();
destroy();
}
}

[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
paul
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12835
    
    5
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.
Bill
Prasad Charasala
Ranch Hand

Joined: Nov 02, 2000
Posts: 67
Hi,
Your code is missing
<code>
out = response.getWriter();
</code>
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.

------------------
Prasad


<B>Prasad</B>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: destroy() and killing servlet threads