I want to gracefully shutdown the threads. I seen many codes on internet and have query here. I think there are two approaches to shutdown.
- use boolean flag. Once flag chnages we can break the code there in run method.
- use of interrupt method.
My question why it is avoided to use boolean flag to gracefully shutdown the threads, When I ran sample program it went well.