How to kill a thread immediately from another thread in java?
- by Sara
Hi, is there anyway to kill a thread or interrupt it immediately.
Like in one of my thread, i call a method which takes time to execute (2-4 seconds). This method is in a while(boolean flag) block, so i can interrupt it from the main thread.
But the problem is, if i interrupt it; it will wait till the executing loop is finished and then on next conditional check, it will stop execution.
I want it to stop right then. Is there anyway to do this?