todo
利用枚举构建不同优先级线程池
public enum ThreadPoolInstances implements Consumer {
HIGH_LEVEL(10, new ThreadPoolExecutor.CallerRunsPolicy()),
DEFAULT(5, new ThreadPoolExecutor.AbortPolicy());
private final ThreadPoolExecutor executor;
ThreadPoolInstances(int coreSize, RejectedExecutionHandler handler) {
this.executor = new ThreadPoolExecutor(Math.max(coreSize, 1), 50, 300L, TimeUnit.SECONDS,
new LinkedBlockingQueue<>(300), handler);
}
@Override
public void consumer(Runnable runnable) {
this.executor.submit(runnable);
}
}