On stackoverflow, I often see the use of Thread.currentThread().isInterrupted(). When implementing Runnable and using it in a while loop, like so:

public void run() {
  while(!Thread.currentThread().isInterrupted()) { ... }
}

is there any difference to using Thread.interrupted() (other than that the interrupted flag being cleared when using interrupted())?

I have also seen Thread.currentThread().interrupted(). Is that the correct way to use it, or is Thread.interrupted() sufficient?

Edit
Report