multithreading - Thread Interrupt in java -


i have following questions, if interrupt thread in java, process running 15 minutes, stop process, stop methods or finish process,and not allow others continue in line?

i have "thread" call method comparison based "access" , "postgres" after insert in postgres, if want stop thread called action, succeed stop process, or wait finish?

it not stop thread unless methods executing in willing terminate when receive "interrupt" signal. methods throw interruptedexception fall category. of course, methods in call chain need cooperate in 1 way or another.

if code not call "interruptable" methods or has sections don't call them long periods, make them check flag thread.isinterrupted() periodically, , terminate clean , gracefully if ever becomes true. same thing if ever receive (and catch, should) interruptedexceptions.

your question can improved, though, if intent more specific. explain how "thread interrupt" protocol works, perhaps not looking for.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -