重写 afterExecute
return new ThreadPoolExecutor(corePoolSize, maximumPoolSize,0L, TimeUnit.MILLISECONDS,new LinkedBlockingQueue<Runnable>()){
protected void afterExecute(Runnable r, Throwable t) {
super.afterExecute(r, t);
if (t == null && r instanceof Future<?>) {
try {
Object result = ((Future<?>) r).get();
} catch (CancellationException ce) {
t = ce;
} catch (ExecutionException ee) {
t = ee.getCause();
} catch (InterruptedException ie) {
Thread.currentThread().interrupt(); // ignore/reset
}
}
if (t != null) {
t.printStackTrace();
}
}
};