In the Linux environment, after Tomcat executes the shutdown.sh, the process still exists, which is a headache, and personally think that the most fundamental reason is that there are some non-deamon thread exist, in which case, after Tomcat is closed, the whole process will not end. How do we judge this situation?
You can follow the following steps to determine:
1. Find the PID currently running by Tomcat (using Ps-ef |grep Tomcat),
2. Find the JDK directory, you can use the which Java command, and switch to the bin directory
3. Execute the Jstack PID in the bin directory, check each thread to find the non-Deamon thread, and then determine why the thread does not stop
Example: One of the scenarios I met before was when I was using Quatz's timed task, and because the scheduled task was not set to Deamon, the Tomcat process did not stop. Later configuration of the Quatz thread for Deamon thread to solve the problem. Here are the relevant configurations,
<property name= "Quartzproperties" >
<props>
<prop key= "Org.quartz.scheduler.makeSchedulerThreadDaemon" >true</prop>
<prop key= "Org.quartz.threadPool.makeThreadsDaemons" >true</prop>
</props>
</property>
The above configuration is placed in the Bean configuration item class= "Org.springframework.scheduling.quartz.SchedulerFactoryBean".
This article is from the "Knowledge Porter" blog, please be sure to keep this source http://xiaoge90s.blog.51cto.com/6920186/1642209
Tomcat after shutdown.sh, the reason why the process still exists