修改可能出现的异常,根据备注提示,内容可能有误.

This commit is contained in:
gogogjl 2023-07-12 22:51:05 +08:00
parent c08b3c7ef4
commit 9b095af686

View File

@ -56,7 +56,7 @@ public class PortfolioLuceneServiceImpl implements PortfolioLuceneService {
int totalCount = list.size(); int totalCount = list.size();
int perThreadCount = 3000; int perThreadCount = 3000;
// 加1避免线程池的参数为0 // 加1避免线程池的参数为0
int threadCount = totalCount / perThreadCount + (totalCount % perThreadCount == 0 ? 0 : 1); int threadCount = totalCount / perThreadCount + (totalCount % perThreadCount == 0 ? 1 : 0);
ExecutorService pool = Executors.newFixedThreadPool(threadCount); ExecutorService pool = Executors.newFixedThreadPool(threadCount);
CountDownLatch countDownLatch1 = new CountDownLatch(1); CountDownLatch countDownLatch1 = new CountDownLatch(1);
CountDownLatch countDownLatch2 = new CountDownLatch(threadCount); CountDownLatch countDownLatch2 = new CountDownLatch(threadCount);