java 多线程日志_多线程中子线程不打日志的解决方案 – 去当CTO

  • Post author:
  • Post category:java


我的解决方案非常简单,就是自己写一个类继承java.util.concurrent.ThreadPoolExecutor,然后重写里面的几个方法如下

public class ThreadPoolExecute extends ThreadPoolExecutor {

public ThreadPoolExecute(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue workQueue) {

super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue);

}

public ThreadPoolExecute(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue workQueue, RejectedExecutionHandler handler) {

super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue,handler);

}

public ThreadPoolExecute(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue workQueue, ThreadFactory threadFactory, RejectedExecutionHandler handler) {

super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadF



版权声明:本文为weixin_33374400原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。