title: Java: How do I catch InterruptedException on a thread, when interrupted by another thread?
body: <p>I'm developing a multithreaded application to make connections to external servers - each on separate threads - and will be blocked until there is input. Each of these extends the Thread class. For the sake of explanation, let's call these "connection threads".</p>
  
  <p>All these connection threads are stored in a concurrent hashmap.</p>
  
  <p>Then, I allow RESTful web services method call to cancel any of the threads. (I'm using Grizzly/Jersey, so each call is a thread on its own.) </p>
  
  <p>I retrieve the specific connection thread (from the hashmap) and call the interrupt() method on it.</p>
  
  <p>So, here is the question, within the connection thread, how do I catch the InterruptedException? (I'd like to do something when the connection thread is stopped by an external RESTful command.)</p>