src/index-tool/src/main/java/com/opengauss/config/SchedulerConfig.java
package com.opengauss.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

@Configuration
public class SchedulerConfig {
    @Bean(name = "taskScheduler", destroyMethod = "shutdown")
    public ThreadPoolTaskScheduler taskScheduler() {
        ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
        scheduler.setPoolSize(3);
        scheduler.setThreadNamePrefix("scheduler_task_");
        scheduler.setAwaitTerminationMillis(5);
        scheduler.setWaitForTasksToCompleteOnShutdown(true);
        return scheduler;
    }
}
