title: Why use Thread.currentThread().isInterrupted() instead of isInterrupted()?
body: <p>I have a question regarding the implementation of a cancellation policy for a Thread subclass. It seems to be common practice to do it like this:</p>
  
  <pre><code>class A extends Thread {
  
    [...]
  
    public final void run() {
       try {
          while(!Thread.currentThread().isInterrupted()) {
             [...]
          }
       } catch (InterruptedException consumed) {
       }
    }
  
    public final void cancel() {
       interrupt();
    }    
  }
  </code></pre>
  
  <p>The question I have is regarding Thread.currentThread()... Why is it common practice to use currentThread() for checking the interruption flag but not for setting it in the cancel() method? Wouldn't it suffice to just call the isInterrupted() method of A like this:</p>
  
  <pre><code>while (!isInterrupted()) {
     [...]
  }
  </code></pre>
  
  <p>I couldn't find an answer neither in the Thread JavaDoc, Brian Goetz' excellent book on concurrent Java or stackoverflow.</p>
  
  <p>Thanks in advance for your insights!</p>
  
  <p>Cheers,
  Georg</p>