title: Proper way to handle Thread.interrupted() in a Callable?
body: <p>What is the proper way to handle Thread.interrupted() in a Callable? I'm guessing that the callable should throw an InterruptedException; for example:</p>
  
  <pre><code>public class MyCallable implements Callable&lt;Object&gt; {
      public Object call() {
          Object result = null;
  
          // Simulate long-running operation that calculates result
          while (true) {
              ...
              if (Thread.interrupted()) {
                  throw new InterruptedException();
              }
          }
  
          result = ... // something produced by the long-running operation    
  
          return result;
      }
  }
  </code></pre>
  
  <p>Is this correct, or is there a more appropriate way to handle it? Thanks.</p>