I have used ScheduledExecutorService
for my jar file and i'm executing it as a service in linux machine. I'm stating service by nohup
command and killing it with kill
command. But i heard ScheduledExecutorService
should be shut down when finishing use it. If not, it will keep the JVM running, even when all other threads have been shut down.
ScheduledExecutorService
thread when i kill the service? ScheduledExecutorService
thread is not shutdown when killing service, how i shut it down ? If you kill the entire process externally then it will kill the ScheduledExecutorService
at the same time since it runs inside the process.
This is not recommended though as it will kill your program in the middle of whatever processing it's doing. You might have partially written files for example.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.