I want to know the basic difference between shutdown()
and shutdownNow()
for shutting down the Executor Service
?
As far as I understood:
shutdown()
should be used for graceful shutdown which means all tasks that were running and queued for processing but not started should be allowed to complete
shutdownNow()
does an abrupt shut down meaning that some unfinished tasks are cancelled and unstarted tasks are also cancelled. Is there anything else which is implicit/explicit that I am missing?
P.S: I found another question on How to shutdown an executor service related to this but not exactly what I want to know.