Skip to content

Commit

Permalink
fix the bug about thread pool (#1623)[backend]
Browse files Browse the repository at this point in the history
  • Loading branch information
zhou-yinyuan authored Oct 11, 2024
1 parent 6604952 commit cac5aad
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions backend/src/main/java/heartbeat/config/ThreadPoolConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

import java.util.concurrent.ThreadPoolExecutor;

@Configuration
public class ThreadPoolConfig {

@Bean("customTaskExecutor")
public ThreadPoolTaskExecutor taskExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(20);
executor.setMaxPoolSize(100);
executor.setQueueCapacity(500);
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
executor.setCorePoolSize(40);
executor.setMaxPoolSize(200);
executor.setQueueCapacity(1000);
executor.setKeepAliveSeconds(60);
executor.setThreadNamePrefix("Heartbeat-");
executor.initialize();
Expand Down

0 comments on commit cac5aad

Please sign in to comment.