org.octopusden.octopus.vcsfacade.config.JobExecutorConfig.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vcs-facade Show documentation
Show all versions of vcs-facade Show documentation
Octopus module: vcs-facade
package org.octopusden.octopus.vcsfacade.config
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.core.task.AsyncTaskExecutor
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
@Configuration
class JobExecutorConfig(private val jobProperties: JobProperties) {
@Bean(name = ["jobExecutor"])
fun taskExecutor(): AsyncTaskExecutor {
val jobExecutorProperties = jobProperties.executor
val executor = ThreadPoolTaskExecutor()
executor.corePoolSize = jobExecutorProperties.corePoolSize
executor.maxPoolSize = jobExecutorProperties.maxPoolSize
executor.setQueueCapacity(jobExecutorProperties.queueCapacity)
return executor
}
}