|
| 1 | +package com.netease.lib.tasks.config; |
| 2 | + |
| 3 | +import com.netease.lowcode.core.EnvironmentType; |
| 4 | +import com.netease.lowcode.core.annotation.Environment; |
| 5 | +import com.netease.lowcode.core.annotation.NaslConfiguration; |
| 6 | +import org.springframework.beans.factory.annotation.Value; |
| 7 | +import org.springframework.stereotype.Component; |
| 8 | + |
| 9 | +@Component("libraryThreadPoolConfig") |
| 10 | +public class ThreadPoolConfig { |
| 11 | + |
| 12 | + /** |
| 13 | + * 核心线程数 |
| 14 | + */ |
| 15 | + @Value("${corePoolSize:8}") |
| 16 | + @NaslConfiguration(defaultValue = { |
| 17 | + @Environment(type = EnvironmentType.DEV, value = "8"), |
| 18 | + @Environment(type = EnvironmentType.ONLINE, value = "8") |
| 19 | + }) |
| 20 | + public String corePoolSize; |
| 21 | + |
| 22 | + /** |
| 23 | + * 最大线程数 |
| 24 | + */ |
| 25 | + @Value("${maxPoolSize:24}") |
| 26 | + @NaslConfiguration(defaultValue = { |
| 27 | + @Environment(type = EnvironmentType.DEV, value = "24"), |
| 28 | + @Environment(type = EnvironmentType.ONLINE, value = "24") |
| 29 | + }) |
| 30 | + public String maxPoolSize; |
| 31 | + |
| 32 | + /** |
| 33 | + * 队列大小 |
| 34 | + */ |
| 35 | + @Value("${queueCapacity:1024}") |
| 36 | + @NaslConfiguration(defaultValue = { |
| 37 | + @Environment(type = EnvironmentType.DEV, value = "1024"), |
| 38 | + @Environment(type = EnvironmentType.ONLINE, value = "1024") |
| 39 | + }) |
| 40 | + public String queueCapacity; |
| 41 | + |
| 42 | + /** |
| 43 | + * 核心线程等待销毁时间 |
| 44 | + */ |
| 45 | + @Value("${keepAliveSeconds:60}") |
| 46 | + @NaslConfiguration(defaultValue = { |
| 47 | + @Environment(type = EnvironmentType.DEV, value = "60"), |
| 48 | + @Environment(type = EnvironmentType.ONLINE, value = "60") |
| 49 | + }) |
| 50 | + public String keepAliveSeconds; |
| 51 | + |
| 52 | + public String getCorePoolSize() { |
| 53 | + return corePoolSize; |
| 54 | + } |
| 55 | + |
| 56 | + public void setCorePoolSize(String corePoolSize) { |
| 57 | + this.corePoolSize = corePoolSize; |
| 58 | + } |
| 59 | + |
| 60 | + public String getMaxPoolSize() { |
| 61 | + return maxPoolSize; |
| 62 | + } |
| 63 | + |
| 64 | + public void setMaxPoolSize(String maxPoolSize) { |
| 65 | + this.maxPoolSize = maxPoolSize; |
| 66 | + } |
| 67 | + |
| 68 | + public String getQueueCapacity() { |
| 69 | + return queueCapacity; |
| 70 | + } |
| 71 | + |
| 72 | + public void setQueueCapacity(String queueCapacity) { |
| 73 | + this.queueCapacity = queueCapacity; |
| 74 | + } |
| 75 | + |
| 76 | + public String getKeepAliveSeconds() { |
| 77 | + return keepAliveSeconds; |
| 78 | + } |
| 79 | + |
| 80 | + public void setKeepAliveSeconds(String keepAliveSeconds) { |
| 81 | + this.keepAliveSeconds = keepAliveSeconds; |
| 82 | + } |
| 83 | +} |
0 commit comments