8dc487b1
함상기
Init Version - 20...
|
1
2
3
4
|
package com.batch.config;
import java.util.concurrent.Executor;
|
78928007
함상기
20240305
|
5
|
import org.springframework.beans.factory.annotation.Value;
|
8dc487b1
함상기
Init Version - 20...
|
6
7
8
9
10
11
12
13
|
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
@Configuration
@EnableAsync
public class AsyncConfig {
|
78928007
함상기
20240305
|
14
15
16
17
18
19
20
21
|
@Value("${thread.comm.count}")
Integer iCommAsyncThreadCount;
@Value("${thread.ext.count}")
Integer iExtAsyncThreadCount;
@Value("${thread.ai.count}")
Integer iAiAsyncThreadCount;
|
8dc487b1
함상기
Init Version - 20...
|
22
23
24
25
|
@Bean(name = "commAsync")
public Executor commAsyncExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
78928007
함상기
20240305
|
26
27
28
29
|
executor.setCorePoolSize(iCommAsyncThreadCount);
executor.setMaxPoolSize(iCommAsyncThreadCount);
executor.setQueueCapacity(1000);
executor.setKeepAliveSeconds(15);
|
8dc487b1
함상기
Init Version - 20...
|
30
31
32
33
34
35
36
37
|
executor.setAllowCoreThreadTimeOut(true);
executor.setWaitForTasksToCompleteOnShutdown(true);
executor.setThreadNamePrefix("commAsync-processor-");
executor.initialize();
return executor;
}
|
78928007
함상기
20240305
|
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
@Bean(name = "extAsync")
public Executor extAsyncExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(iExtAsyncThreadCount);
executor.setMaxPoolSize(iExtAsyncThreadCount);
executor.setQueueCapacity(1000);
executor.setKeepAliveSeconds(15);
executor.setAllowCoreThreadTimeOut(true);
executor.setWaitForTasksToCompleteOnShutdown(true);
executor.setThreadNamePrefix("extAsync-processor-");
executor.initialize();
return executor;
}
|
8dc487b1
함상기
Init Version - 20...
|
53
54
55
|
@Bean(name = "aiAsync")
public Executor aiAsyncExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
78928007
함상기
20240305
|
56
57
|
executor.setCorePoolSize(iAiAsyncThreadCount);
executor.setMaxPoolSize(iAiAsyncThreadCount);
|
8dc487b1
함상기
Init Version - 20...
|
58
|
executor.setQueueCapacity(1000);
|
78928007
함상기
20240305
|
59
|
executor.setKeepAliveSeconds(15);
|
8dc487b1
함상기
Init Version - 20...
|
60
61
62
63
64
65
66
67
|
executor.setAllowCoreThreadTimeOut(true);
executor.setWaitForTasksToCompleteOnShutdown(true);
executor.setThreadNamePrefix("aiAsync-processor-");
executor.initialize();
return executor;
}
}
|