From 10ae76963fa78451b8d2604f191b7f16fef1f3c2 Mon Sep 17 00:00:00 2001 From: ludj Date: Fri, 19 Jul 2024 14:32:53 +0800 Subject: [PATCH] =?UTF-8?q?rev:=20TLOG=E4=B8=8Edynamictp=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wms_pro/hd/.idea/encodings.xml | 2 ++ wms_pro/hd/nladmin-system/pom.xml | 7 ++++++ .../src/main/java/org/nl/AppRun.java | 19 ++++++++-------- .../service/quartz/utils/QuartzRunnable.java | 11 ++++++---- .../nladmin-system/src/main/resources/T.txt | 10 --------- .../resources/config/application-dev3.yml | 6 +---- .../src/main/resources/config/application.yml | 22 +++++++++++++++++++ .../src/main/resources/logback-spring.xml | 2 +- .../nladmin-system/src/main/resources/test2 | 1 - 9 files changed, 49 insertions(+), 31 deletions(-) delete mode 100644 wms_pro/hd/nladmin-system/src/main/resources/T.txt delete mode 100644 wms_pro/hd/nladmin-system/src/main/resources/test2 diff --git a/wms_pro/hd/.idea/encodings.xml b/wms_pro/hd/.idea/encodings.xml index fb53fb62..4fbbfd3f 100644 --- a/wms_pro/hd/.idea/encodings.xml +++ b/wms_pro/hd/.idea/encodings.xml @@ -3,5 +3,7 @@ + + \ No newline at end of file diff --git a/wms_pro/hd/nladmin-system/pom.xml b/wms_pro/hd/nladmin-system/pom.xml index 7647f453..a1161ade 100644 --- a/wms_pro/hd/nladmin-system/pom.xml +++ b/wms_pro/hd/nladmin-system/pom.xml @@ -28,6 +28,13 @@ + + org.dromara.dynamictp + dynamic-tp-spring-boot-starter-adapter-webserver + 1.1.7 + + + org.codehaus.groovy groovy-all diff --git a/wms_pro/hd/nladmin-system/src/main/java/org/nl/AppRun.java b/wms_pro/hd/nladmin-system/src/main/java/org/nl/AppRun.java index b24571cb..a564271c 100644 --- a/wms_pro/hd/nladmin-system/src/main/java/org/nl/AppRun.java +++ b/wms_pro/hd/nladmin-system/src/main/java/org/nl/AppRun.java @@ -1,12 +1,8 @@ package org.nl; import cn.dev33.satoken.annotation.SaIgnore; - +import org.dromara.dynamictp.core.spring.EnableDynamicTp; import org.mybatis.spring.annotation.MapperScan; -import org.nl.common.utils.SpringContextHolder; -import org.nl.common.websocket.heartSocket.clientSocket.HeartClientServer; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.support.AbstractBeanFactory; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -14,14 +10,11 @@ import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactor import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.boot.web.servlet.server.ServletWebServerFactory; import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Import; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; -import java.net.InetSocketAddress; - /** * 开启审计功能 -> @EnableJpaAuditing * https://www.cnblogs.com/niceyoo/p/10908647.html @@ -37,6 +30,7 @@ import java.net.InetSocketAddress; @ServletComponentScan @EnableTransactionManagement @MapperScan("org.nl.**.mapper") +@EnableDynamicTp public class AppRun implements CommandLineRunner { public static void main(String[] args) { SpringApplication.run(AppRun.class, args); @@ -54,12 +48,12 @@ public class AppRun implements CommandLineRunner { // return new SpringContextHolder(); // } - @Bean + /*@Bean public ServletWebServerFactory webServerFactory() { TomcatServletWebServerFactory fa = new TomcatServletWebServerFactory(); fa.addConnectorCustomizers(connector -> connector.setProperty("relaxedQueryChars", "[]{}")); return fa; - } + }*/ /** * 访问首页提示 @@ -69,6 +63,11 @@ public class AppRun implements CommandLineRunner { @GetMapping("/") @SaIgnore public String index() { + try { + Thread.sleep(10000); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } return "Backend service started successfully"; } } diff --git a/wms_pro/hd/nladmin-system/src/main/java/org/nl/wms/system_manage/service/quartz/utils/QuartzRunnable.java b/wms_pro/hd/nladmin-system/src/main/java/org/nl/wms/system_manage/service/quartz/utils/QuartzRunnable.java index 61da5292..9d2c1cc6 100644 --- a/wms_pro/hd/nladmin-system/src/main/java/org/nl/wms/system_manage/service/quartz/utils/QuartzRunnable.java +++ b/wms_pro/hd/nladmin-system/src/main/java/org/nl/wms/system_manage/service/quartz/utils/QuartzRunnable.java @@ -1,19 +1,21 @@ package org.nl.wms.system_manage.service.quartz.utils; import cn.hutool.core.util.StrUtil; +import com.yomahub.tlog.core.thread.TLogInheritableTask; +import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.nl.common.utils.SpringContextHolder; import org.springframework.util.ReflectionUtils; import java.lang.reflect.Method; -import java.util.concurrent.Callable; /** * 执行定时任务 + * * @author / */ @Slf4j -public class QuartzRunnable implements Callable { +public class QuartzRunnable extends TLogInheritableTask { private final Object target; private final Method method; @@ -31,14 +33,15 @@ public class QuartzRunnable implements Callable { } } + + @SneakyThrows @Override - public Object call() throws Exception { + public void runTask() { ReflectionUtils.makeAccessible(method); if (StrUtil.isNotEmpty(params)) { method.invoke(target, params); } else { method.invoke(target); } - return null; } } diff --git a/wms_pro/hd/nladmin-system/src/main/resources/T.txt b/wms_pro/hd/nladmin-system/src/main/resources/T.txt deleted file mode 100644 index c9f60baf..00000000 --- a/wms_pro/hd/nladmin-system/src/main/resources/T.txt +++ /dev/null @@ -1,10 +0,0 @@ - -测试创建文件 -测试修改 - - - - - -123123221322313 - diff --git a/wms_pro/hd/nladmin-system/src/main/resources/config/application-dev3.yml b/wms_pro/hd/nladmin-system/src/main/resources/config/application-dev3.yml index 8e7dffbe..712f4c35 100644 --- a/wms_pro/hd/nladmin-system/src/main/resources/config/application-dev3.yml +++ b/wms_pro/hd/nladmin-system/src/main/resources/config/application-dev3.yml @@ -1,11 +1,6 @@ server: port: 8012 max-http-header-size: 65536 - tomcat: - accept-count: 300 - threads: - max: 300 - min-spare: 30 #配置数据源 spring: datasource: @@ -158,6 +153,7 @@ sa-token: # 配置 Cookie 作用域:根据二级域名实现sso登入如lms.sso.com;acs.sso.com domain: is-read-cookie: false + is-print: false schedulerFile: /Users/mima0000/Desktop/scheduler.xml lucene: index: diff --git a/wms_pro/hd/nladmin-system/src/main/resources/config/application.yml b/wms_pro/hd/nladmin-system/src/main/resources/config/application.yml index 05d5abdb..c370b8e1 100644 --- a/wms_pro/hd/nladmin-system/src/main/resources/config/application.yml +++ b/wms_pro/hd/nladmin-system/src/main/resources/config/application.yml @@ -1,3 +1,7 @@ +server: + tomcat: + relaxed-query-chars: [ '|','{','}','[',']' ] #字符问题:https://blog.csdn.net/CanYue_Yi/article/details/109182577 + relaxed-path-chars: [ '|','{','}','[',']' ] #字符问题: https://blog.csdn.net/weixin_41996632/article/details/90715118 spring: freemarker: check-template-location: false @@ -9,6 +13,21 @@ spring: redis: repositories: enabled: false + dynamic: + tp: + enabled: true # 是否启用 dynamictp,默认true + enabledBanner: false # 是否启用 控制台banner,默认true + enabledCollect: true # 是否开启监控指标采集,默认true + collectorTypes: logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer + logPath: d:\log\lms # 监控日志数据路径,默认 ${user.home}/logs,采集类型非logging不用配置 + monitorInterval: 8 + tomcatTp: # tomcat webserver 线程池配置 + threadPoolAliasName: tomcat 线程池 # 线程池别名,可选 + corePoolSize: 15 + tryInterrupt: false + maximumPoolSize: 100 + keepAliveTime: 60 + runTimeout: 5000 task: pool: # 核心线程池大小 @@ -91,3 +110,6 @@ pageheiper: supportMethodsArguments: true pageSizeZero: false #pageSize=0 返回所有 params: count=countSgl +tlog: + enable-invoke-time-print: true + pattern: "[$traceId]" \ No newline at end of file diff --git a/wms_pro/hd/nladmin-system/src/main/resources/logback-spring.xml b/wms_pro/hd/nladmin-system/src/main/resources/logback-spring.xml index 2d4dbffe..76dd4c73 100644 --- a/wms_pro/hd/nladmin-system/src/main/resources/logback-spring.xml +++ b/wms_pro/hd/nladmin-system/src/main/resources/logback-spring.xml @@ -79,8 +79,8 @@ - + diff --git a/wms_pro/hd/nladmin-system/src/main/resources/test2 b/wms_pro/hd/nladmin-system/src/main/resources/test2 deleted file mode 100644 index 112b8544..00000000 --- a/wms_pro/hd/nladmin-system/src/main/resources/test2 +++ /dev/null @@ -1 +0,0 @@ -123213213