title: Interrupting a thread from itself
body: <p>I do not understand why the thread does not throw an <code>InterruptedException</code> when interrupted itself.</p>
  
  <p>I'm trying with following snippet:</p>
  
  <blockquote>
    <p>public class InterruptTest {</p>
  
  <pre><code>public static void main(String[] args) {
      MyThread t = new MyThread();
      t.start();
      try {
          t.join();
      } catch (InterruptedException ex) {
          ex.printStackTrace();
      }
  }
  
  private static class MyThread extends Thread {
  
      @Override
      public void run() {
          Thread.currentThread().interrupt();
      }
  } }
  </code></pre>
  </blockquote>
  
  <p>In the API docs it says on the <code>interrupt()</code> method:</p>
  
  <blockquote>
    <p>If this thread is blocked in an invocation of the wait(), wait(long), or wait(long, int) methods of the Object class, or of the Thread.join(), Thread.join(long), Thread.join(long, int), Thread.sleep(long), or Thread.sleep(long, int), methods of this class, then its interrupt status will be cleared and it will receive an InterruptedException.</p>
  </blockquote>