案件列表联调
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package com.ruoyi.common.utils;
|
||||
|
||||
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
|
||||
import java.util.concurrent.*;
|
||||
|
||||
/**
|
||||
* @Author: ymbgy
|
||||
* @Date: 2022-09-23 10:06
|
||||
*/
|
||||
public class ThreadUtil {
|
||||
public static ExecutorService createThreadPool() {
|
||||
//获取系统处理器个数,作为线程池数量
|
||||
int nThreads = Runtime.getRuntime().availableProcessors();
|
||||
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder()
|
||||
.setNameFormat("demo-pool-%d").build();
|
||||
//Thread Pool
|
||||
ExecutorService executor = new ThreadPoolExecutor(nThreads, 200,
|
||||
0L, TimeUnit.MILLISECONDS,
|
||||
new LinkedBlockingQueue<Runnable>(1024), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy());
|
||||
return executor;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user