Is throwing InterruptedException essential when stopping threads? Can I use another exception type? <p>I have tournament code for students' codes. Therefore I have no control over the students' codes.</p> <p>I need to implement timeout for students' code calls (they run in separate threads). So I instrumented their code and inserted right after loop and method definitions the following code:</p> <pre><code>if (Thread.interrupted()) throw new InterruptedException(); </code></pre> <p>The problem is <code>InterruptedException</code> is checked, and therefore I have to add <code>throws</code> declarations to all methods, which can break overriding methods' signatures.</p> <p>So I thought I could not throw <code>InterruptedException</code>, but an unchecked one, e.g. <code>RuntimeException</code>. Can I do it? Will there be some difference?</p> <p>In my tournament code I start the students' code as a futrure in an <code>ExecutorService</code> and try to get the result using <code>get()</code> with timeout.</p>