Link to home
Start Free TrialLog in
Avatar of Squadless
Squadless

asked on

how does shutdown method work in ExecutorService

Hi, my questions is about how the shutdown method works in ExecutorService.
I can see from the api that:
shutdown()
          Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted.

In the implementation i see it calls the shutdown method which disables new tasks from being submitted, then it calls shutdownNow()which cancels currently executing tasks.

My question is, what exactly happens to threads that are in execution when that happens? what if i have a thread responsible for placing a order to buy or sell or a thread responsible for delivering something to a router, what will happen to it if the shutdown method is called in this case?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Valeri
Valeri
Flag of Bulgaria image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial