Java question: As far as I know, there are two ways to check inside a thread whether the thread received an interrupt signal, Thread.interrupted()
and Thread.isInterrupted()
, and the only difference between them is that the former resets the internal interrupted flag.
So far, I've always used Thread.isInterrupted()
and never had any problems with it. Then again, most tutorials I've seen recommend using Thread.interrupted()
. Is there any specific reason for that?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…