title: Why should we not swallow the InterruptedException
body: <p>I am very confused and not able to understand why InterruptedException  should not be swallowed.</p>
  
  <p>The article from IBM says</p>
  
  <p>When a blocking method detects interruption and throws InterruptedException, it clears the interrupted status. If you catch InterruptedException but cannot rethrow it, you should preserve evidence that the interruption occurred <strong>so that code higher up on the call stack can learn of the interruption and respond to it if it wants to</strong></p>
  
  <pre><code>public class TaskRunner implements Runnable {
      private BlockingQueue&lt;Task&gt; queue;
  
      public TaskRunner(BlockingQueue&lt;Task&gt; queue) { 
          this.queue = queue; 
      }
  
      public void run() { 
          try {
               while (true) {
                   Task task = queue.take(10, TimeUnit.SECONDS);
                   task.execute();
               }
           }
           catch (InterruptedException e) { 
             Thread.currentThread().interrupt();//preserve the message
               return;//Stop doing whatever I am doing and terminate
  
           }
      }
  }
  </code></pre>
  
  <p>Also,Java Concurrency in Practice discusses this in more detail in Chapter 7.1.3: Responding to Interruption. Its rule is:</p>
  
  <p><strong>Only code that implements a thread's interruption policy may swallow an interruption request. General-purpose task and library code should never swallow interruption requests.</strong></p>
  
  <p>1.Can anyone explain how can code in higher call stack make use of the status set by Thread.currentThread().interrupt(); in catch block when the thread is terminated?</p>
  
  <p>Also Please explain the above rule?</p>