publicclassExceptionHandlerExecutorextendsThreadPoolExecutor{privatestaticfinalLoggerLOGGER&#61;LoggerFactory.getLogger(ExceptionHandlerExecutor.class);publicExceptionHandlerExecutor(intcorePoolSize,intmaximumPoolSize,longkeepAliveTime,TimeUnitunit,BlockingQueue<Runnable>workQueue){super(corePoolSize,maximumPoolSize,keepAliveTime,unit,workQueue);}&#64;OverrideprotectedvoidafterExecute(Runnabler,Throwablet){if(rinstanceofFutureTask){FutureTask<Exception>futureTask&#61;(FutureTask<Exception>)r;if(futureTask.isDone()){try{futureTask.get();}catch(InterruptedException|ExecutionExceptione){LOGGER.error("Uncaught error",e);}}}}
}