// runs in the same thread context but injects a timeout thread which will exit the JVM on
 // timeout
 static void runWithTimeout(Callable<?> callable, long timeout) throws Exception {
   TimeoutThread thread = new TimeoutThread(timeout);
   thread.start();
   callable.call();
   thread.interrupt();
 }