Skip to content

Commit

Permalink
[fix][#28]cherry pick
Browse files Browse the repository at this point in the history
  • Loading branch information
sejoon00 committed Aug 13, 2024
1 parent e18887d commit 2abf81f
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.server.bbo_gak.global.config.scheduler;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;

@Configuration
public class SchedulerConfiguration implements SchedulingConfigurer {

@Value("${scheduler.thread.pool.size}")
private int poolSize;

@Override
public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
taskRegistrar.setScheduler(taskScheduler());
}

@Bean(destroyMethod = "shutdown")
public ScheduledExecutorService taskScheduler() {
return Executors.newScheduledThreadPool(poolSize);
}
}

0 comments on commit 2abf81f

Please sign in to comment.