- new RejectedExecutionHandler() {
- // if the max threads are met, then it will raise a rejectedExecution. We then push to the queue.
- @Override
- public void rejectedExecution(final Runnable r, final ThreadPoolExecutor executor) {
- try {
- executor.getQueue().put(r);
- } catch (InterruptedException e) {
- throw new RejectedExecutionException("Interrupted while waiting on the queue", e);
- }
- }
- });
+ // if the max threads are met, then it will raise a rejectedExecution. We then push to the queue.
+ (r, executor1) -> {
+ try {
+ executor1.getQueue().put(r);
+ } catch (final InterruptedException e) {
+ throw new RejectedExecutionException("Interrupted while waiting on the queue", e);
+ }
+ });