规范命名.
This commit is contained in:
@@ -11,8 +11,8 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
* @since 2023/7/10 15:49
|
||||
*/
|
||||
@Data
|
||||
@ConfigurationProperties(prefix = "orion.thread.pool")
|
||||
public class ThreadPoolConfig {
|
||||
@ConfigurationProperties(prefix = "orion.async.executor")
|
||||
public class AsyncExecutorConfig {
|
||||
|
||||
/**
|
||||
* 核心线程数量
|
||||
@@ -34,7 +34,7 @@ public class ThreadPoolConfig {
|
||||
*/
|
||||
private int keepAliveSeconds;
|
||||
|
||||
public ThreadPoolConfig() {
|
||||
public AsyncExecutorConfig() {
|
||||
this.corePoolSize = 8;
|
||||
this.maxPoolSize = 16;
|
||||
this.queueCapacity = 200;
|
||||
@@ -23,7 +23,7 @@ import java.util.concurrent.ThreadPoolExecutor;
|
||||
@EnableAsync
|
||||
@AutoConfiguration
|
||||
@AutoConfigureOrder(AutoConfigureOrderConst.FRAMEWORK_COMMON)
|
||||
@EnableConfigurationProperties(ThreadPoolConfig.class)
|
||||
@EnableConfigurationProperties(AsyncExecutorConfig.class)
|
||||
public class OrionCommonAutoConfiguration {
|
||||
|
||||
/**
|
||||
@@ -43,7 +43,7 @@ public class OrionCommonAutoConfiguration {
|
||||
*/
|
||||
@Primary
|
||||
@Bean(name = "asyncExecutor")
|
||||
public TaskExecutor asyncExecutor(ThreadPoolConfig config) {
|
||||
public TaskExecutor asyncExecutor(AsyncExecutorConfig config) {
|
||||
ThreadPoolMdcTaskExecutor executor = new ThreadPoolMdcTaskExecutor();
|
||||
executor.setCorePoolSize(config.getCorePoolSize());
|
||||
executor.setMaxPoolSize(config.getMaxPoolSize());
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
package com.orion.ops.framework.common.utils;
|
||||
|
||||
import com.orion.lang.utils.Strings;
|
||||
import com.orion.ops.framework.common.constant.Const;
|
||||
|
||||
/**
|
||||
* 工具类
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/7/14 16:34
|
||||
*/
|
||||
public class Kits {
|
||||
|
||||
private Kits() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取登陆凭证
|
||||
*
|
||||
* @param authorization authorization
|
||||
* @return token
|
||||
*/
|
||||
public static String getAuthorization(String authorization) {
|
||||
if (Strings.isEmpty(authorization)) {
|
||||
return null;
|
||||
}
|
||||
if (!authorization.contains(Const.BEARER) || authorization.length() <= Const.BEARER_PREFIX_LEN) {
|
||||
return null;
|
||||
}
|
||||
return authorization.substring(Const.BEARER_PREFIX_LEN).trim();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,32 +1,32 @@
|
||||
{
|
||||
"groups": [
|
||||
{
|
||||
"name": "orion.thread.pool",
|
||||
"type": "com.orion.ops.framework.common.config.ThreadPoolConfig",
|
||||
"sourceType": "com.orion.ops.framework.common.config.ThreadPoolConfig"
|
||||
"name": "orion.async.executor",
|
||||
"type": "com.orion.ops.framework.common.config.AsyncExecutorConfig",
|
||||
"sourceType": "com.orion.ops.framework.common.config.AsyncExecutorConfig"
|
||||
}
|
||||
],
|
||||
"properties": [
|
||||
{
|
||||
"name": "orion.thread.pool.core-pool-size",
|
||||
"name": "orion.async.executor.core-pool-size",
|
||||
"type": "java.lang.Integer",
|
||||
"description": "核心线程数量",
|
||||
"defaultValue": "8"
|
||||
},
|
||||
{
|
||||
"name": "orion.thread.pool.max-pool-size",
|
||||
"name": "orion.async.executor.max-pool-size",
|
||||
"type": "java.lang.Integer",
|
||||
"description": "最大线程数量.",
|
||||
"defaultValue": "16"
|
||||
},
|
||||
{
|
||||
"name": "orion.thread.pool.queue-capacity",
|
||||
"name": "orion.async.executor.queue-capacity",
|
||||
"type": "java.lang.Integer",
|
||||
"description": "队列容量.",
|
||||
"defaultValue": "200"
|
||||
},
|
||||
{
|
||||
"name": "orion.thread.pool.keep-alive-seconds",
|
||||
"name": "orion.async.executor.keep-alive-seconds",
|
||||
"type": "java.lang.Integer",
|
||||
"description": "活跃时间.",
|
||||
"defaultValue": "300"
|
||||
|
||||
Reference in New Issue
Block a user