package com.whyc.factory;
|
|
import com.whyc.dto.result.RealDateDTO;
|
import com.whyc.pojo.BattRealdata;
|
|
import java.util.Comparator;
|
import java.util.Date;
|
import java.util.LinkedList;
|
import java.util.List;
|
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.LinkedBlockingDeque;
|
import java.util.concurrent.ThreadPoolExecutor;
|
import java.util.concurrent.TimeUnit;
|
import java.util.stream.Collectors;
|
|
import static java.lang.Thread.currentThread;
|
import static java.lang.Thread.sleep;
|
|
public class ThreadPoolExecutorFactory {
|
|
private static ThreadPoolExecutor poolExecutor = init();
|
|
private static ThreadPoolExecutor init() {
|
//线程池初始化
|
UserThreadFactory userThreadFactory = new UserThreadFactory("fg");
|
ThreadPoolExecutor pool = new ThreadPoolExecutor(8, 48, 10, TimeUnit.MINUTES, new LinkedBlockingDeque<>(5), userThreadFactory);
|
poolExecutor = pool;
|
return pool;
|
}
|
|
public static ThreadPoolExecutor getPoolExecutor() {
|
return poolExecutor;
|
}
|
|
}
|