package space.nstart.pcp.complan.config

import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import java.util.concurrent.ExecutorService
import java.util.concurrent.Executors

@Configuration
class DynamicPlanExecutorConfig {

    @Bean(destroyMethod = "shutdown")
    fun dynamicPlanExecutor(): ExecutorService =
        Executors.newSingleThreadExecutor { task ->
            Thread(task, "dynamic-plan-calculation").apply {
                isDaemon = false
            }
        }
}
