Hi,
When I shut down tomcat, tomcat shuts down but the console window stays open and the system.out.prinln text from my class using Thread still shows.
Can I sense in my class if tomcat is still running? Or maby I call a method when tomcat stops to kill my thread?
In my web.xml I have the following code:
<servlet>
<servlet-name>Background Processor</servlet-name>
<servlet-class>src.com.business.Engine</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
The Engine class is as follows:
public class Engine extends HttpServlet {
public void init(ServletConfig config) throws ServletException {
super.init(config);
CheckEndedItems checkEndedItems = CheckEndedItems.getInstance();
checkEndedItems.start();
}
}
The CheckEndedItems class implements Thread
Does someone know how I can stop this Thread when tomcat shuts down?
Thanks.