Commit 50337b57 authored by suhuiguang's avatar suhuiguang

1异步数据入库修线程数量修改为按照核心来

parent 1c0dced0
......@@ -30,6 +30,8 @@ public class CheckRecordInsertListener implements ApplicationContextAware, Appli
@Autowired
Executor asyncServiceExecutor;
private int curSystemThreads = Runtime.getRuntime().availableProcessors();
@Override
public void onApplicationEvent(CheckRecordInsertEvent event) {
......@@ -39,7 +41,7 @@ public class CheckRecordInsertListener implements ApplicationContextAware, Appli
@PostConstruct
public void init() {
CheckRecordDataConsumer consumer = new CheckRecordDataConsumer(blockingQueue, applicationContext);
for (int i = 0; i < 10; i++) {
for (int i = 0; i < curSystemThreads; i++) {
asyncServiceExecutor.execute(consumer);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment