I have a thread pool of 10 threads to serve some task and they are keep running in my web application in tomcat server. I am using the ExecutorService to create Thread Pool as given below.
ExecutorService executor = Executors.newFixedThreadPool(10);
Will these thread be killed or keep running after stopping the tomcat server without executing executor.shutdown()?
Thanks.
As others have mentioned if you execute tomcat shutdown, it's going to terminate your thread.
However, as per your comment you are trying to gracefully kill your threads. So I think you need to implement your shutdown logic in the ServletContextListener and use the contextDestroyed method.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments