do not ignore InterruptedException, re-interrupt method instead

This commit is contained in:
Sebastian Sdorra
2019-06-26 14:50:23 +02:00
parent 572caedd73
commit 8108d9f76e

View File

@@ -30,8 +30,11 @@ class CronThreadFactory implements ThreadFactory, AutoCloseable {
ThreadContext.remove();
return new Thread(r, createName());
}).get();
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException("failed to schedule runnable");
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
throw new IllegalStateException("failed to schedule runnable");
} catch (ExecutionException ex) {
throw new IllegalStateException("failed to schedule runnable");
}
}