All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.octopusden.octopus.vcsfacade.config.JobExecutorConfig.kt Maven / Gradle / Ivy

There is a newer version: 3.0.21
Show newest version
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
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy