title: Interrupting a thread that waits on a blocking action?
body: <p>I am running a thread whose main action is to call on a proxy using a blocking function , and wait for it to give it something. </p>
  
  <p>I've used the known pattern of a volatile boolean and the Interruption , but I'm not sure it will work: When I tried to add a catch block for <code>InterruptedException</code> , I get the error:</p>
  
  <blockquote>
    <p>Unreachable catch block for InterruptedException. This exception is never thrown from the try statement body</p>
  </blockquote>
  
  <p>So if I'm never going to get an<code>InterruptedException</code>, this means I'll never get out of the blocking action - thus will never stop. </p>
  
  <p>I'm a bit puzzled. Any idea?</p>
  
  <pre><code>  public void run() {    
      Proxy proxy = ProxyFactory.generateProxy();
      Source source;
  
      while (!isStopped) {
        try {
          source = proxy.getPendingSources();
          scheduleSource(source);
        } catch (Exception e) {
          log.error("UnExpected Exception caught while running",e);
        }
      }
    }
  
    public void stop() {
      this.isStopped = true;
      Thread.currentThread().interrupt();
    }
  </code></pre>