title: How to properly catch RuntimeExceptions from Executors?
body: <p>Say that I have the following code:</p>
  
  <pre><code>ExecutorService executor = Executors.newSingleThreadExecutor();
  executor.execute(myRunnable);
  </code></pre>
  
  <p>Now, if <code>myRunnable</code> throws a <code>RuntimeExcpetion</code>, how can I catch it? One way would be to supply my own <code>ThreadFactory</code> implementation to <code>newSingleThreadExecutor()</code> and set custom <code>uncaughtExceptionHandler</code>s for the <code>Thread</code>s that come out of it. Another way would be to wrap <code>myRunnable</code> to a local (anonymous) <code>Runnable</code> that contains a try-catch -block. Maybe there are other similar workarounds too. But... somehow this feels dirty, I feel that it shouldn't be this complicated. Is there a clean solution?</p>