Code example for RejectedExecutionException

0
 
    public static class AdoptPolicy extends ThreadPoolExecutor.AbortPolicy {
 
        @Override 
        public void rejectedExecution(Runnable r, ThreadPoolExecutor e) {
            new RejectedExecutionException("Task " + r.toString() + " rejected from " + e.toString()).printStackTrace();
        } 
    } 
} 
Experience pair programming with AI  Get Codota for Java