// 代码
public static class MyIgnorePolicy implements RejectedExecutionHandler {
public void rejectedExecution(Runnable r, ThreadPoolExecutor e) {
doLog(r, e);
}
private void doLog(Runnable r, ThreadPoolExecutor e) {
// 可做日志记录等
System.err.println( r.toString() + " rejected");
}
}
Java篇.自定义拒绝策略【ThreadPoolExecutor】
最新推荐文章于 2024-07-18 22:02:31 发布