Skip to content

Commit

Permalink
Configure SchedulerConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
mkSpace committed Dec 21, 2023
1 parent e27cf71 commit 95be8bf
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.whatever.raisedragon.config

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

@Configuration
@EnableAsync
class AsyncConfig {
@Bean(name = ["asyncSchedulerExecutor"])
fun asyncSchedulerExecutor(): Executor {
return ThreadPoolTaskExecutor().apply {
corePoolSize = 5
maxPoolSize = 5
queueCapacity = 20
setThreadNamePrefix("AsyncSchedulerThread-")
setWaitForTasksToCompleteOnShutdown(true)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.whatever.raisedragon.config

import com.whatever.raisedragon.scheduler.SchedulerBasePackage
import org.springframework.context.annotation.ComponentScan
import org.springframework.context.annotation.Configuration
import org.springframework.scheduling.annotation.EnableScheduling

@Configuration
@EnableScheduling
@ComponentScan(basePackageClasses = [SchedulerBasePackage::class])
class SchedulerConfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.whatever.raisedragon.scheduler

interface SchedulerBasePackage

0 comments on commit 95be8bf

Please sign in to comment.