// incheon.sgp.thm.config.ThmAsyncConfig
package incheon.sgp.thm.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.Executor;

@Configuration
@EnableAsync
public class SgpThmAsyncConfig {
  @Bean(name = "trfExecutor")
  public Executor trfExecutor() {
    var ex = new ThreadPoolTaskExecutor();
    ex.setThreadNamePrefix("trf-");
    ex.setCorePoolSize(2);
    ex.setMaxPoolSize(8);
    ex.setQueueCapacity(200);
    ex.initialize();
    return ex;
  }

  @Bean(name = "trfCctvExecutor")
  public Executor trfCctvExecutor() {
    var ex = new ThreadPoolTaskExecutor();
    ex.setThreadNamePrefix("trf-cctv-");
    ex.setCorePoolSize(2);
    ex.setMaxPoolSize(8);
    ex.setQueueCapacity(200);
    ex.initialize();
    return ex;
  }
}
