- threadPool.setRejectedExecutionHandler(new RejectedExecutionHandler() {
- @Override
- public void rejectedExecution(final Runnable r, final ThreadPoolExecutor executor) {
- try {
- workQueue.put(r);
- } catch (final InterruptedException e) {
- throw new RejectedExecutionException("Interrupted while waiting on queue", e);
- }
+ threadPool.setRejectedExecutionHandler((rejected, executor) -> {
+ try {
+ workQueue.put(rejected);
+ } catch (final InterruptedException e) {
+ throw new RejectedExecutionException("Interrupted while waiting on queue", e);