Browse Source

任务初始化线程池参数修改

master
luoweijian 3 months ago
parent
commit
8c10a0943f
  1. 7
      .gitignore
  2. 4
      src/main/java/com/project/exam/domain/service/impl/AssemblePaperDomainServiceImpl.java
  3. 6
      src/main/java/com/project/task/config/TaskAsyncThreadPoolConfig.java

7
.gitignore

@ -12,6 +12,11 @@ target/
*.iml
*.ipr
.idea/vcs.xml
.idea/setting.xml
.idea/claudeCodeTabState.xml
CLAUDE.md
### Eclipse ###
.apt_generated
.classpath
@ -22,6 +27,8 @@ target/
.sts4-cache
### NetBeans ###
/docs/
/.claude/
/nbproject/private/
/nbbuild/
/dist/

4
src/main/java/com/project/exam/domain/service/impl/AssemblePaperDomainServiceImpl.java

@ -157,7 +157,9 @@ public class AssemblePaperDomainServiceImpl implements AssemblePaperDomainServic
.set(QuestionEntity::getUseStatus, 0)
.in(QuestionEntity::getId, ids));
}
if (attempt == 4) throw new BusinessErrorException("当前题库可用题目不足,请联系管理员补货");
if (attempt == 4) {
throw new BusinessErrorException("当前题库可用题目不足,请联系管理员补货");
}
}
}

6
src/main/java/com/project/task/config/TaskAsyncThreadPoolConfig.java

@ -16,9 +16,9 @@ public class TaskAsyncThreadPoolConfig {
@Bean(name = "taskInternalExecutor")
public Executor taskInternalExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(1);
executor.setMaxPoolSize(5);
executor.setQueueCapacity(20);
executor.setCorePoolSize(4);
executor.setMaxPoolSize(18);
executor.setQueueCapacity(50);
executor.setThreadNamePrefix("task-init-");
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
executor.initialize();

Loading…
Cancel
Save