您现在的位置是:首页 > 文章详情

dynamic-tp v1.1.9 发布,轻量级动态线程池

日期:2024-09-27点击:131

dynamic-tp v1.1.9 发布,轻量级动态线程池。

此版本更新内容包括:

Feature

  • 新增 AgentAware,解决在有其他 agent 增强 Runnable 情况下尝试去拿 DtpRunnable,进行 tps、tpxx、运行超时等统计功能,1.1.7 及之前版本为了防止内存泄露会关闭这些功能。
 https://gitee.com/dromara/dynamic-tp/issues/IAPNE8 
 
 <dependency> <groupId>org.dromara.dynamictp</groupId> <artifactId>dynamic-tp-extension-agent</artifactId> <version>1.1.9</version> </dependency> 
 
  • 新增全局配置功能,减少配置量,项目中可能会定义多个线程池,除了一些核心参数外,其他配置可能都是相同的,新增 globalExecutorProps 配置项,如果线程池某一配置项没配置,则从全局配置中取。
 https://github.com/dromara/dynamic-tp/issues/443 
 
 spring: dynamic: tp: globalExecutorProps: queueType: VariableLinkedBlockingQueue rejectedHandlerType: CallerRunsPolicy allowCoreThreadTimeOut: false awaitTerminationSeconds: 5 taskWrapperNames: ["ttl", "mdc"] executors: - threadPoolName: dtpExecutor1 executorType: eager corePoolSize: 10 maximumPoolSize: 20 queueCapacity: 2000 threadNamePrefix: test - threadPoolName: dtpExecutor2 corePoolSize: 20 maximumPoolSize: 40 queueCapacity: 1000 threadNamePrefix: test2 
 
  • 线程池配置新增 autoCreate 字段,标识是否自动生成 DtpExecutor 实例,默认为 true;若想使用 juc 原生线程池或 spring 线程池可置为 false,需在代码中手动创建线程池。1.1.9 之前版本中,配置在 executors 下的所有线程池在服务启动时会自动生成 DtpExecutor 注册到 spring 容器中,如果项目中大量使用了 Spring ThreadPoolTaskExecutor 接线程池对象,若配置的线程池名称相同,此时会报类型转换异常。
 https://github.com/dromara/dynamic-tp/issues/472 
 
 spring: dynamic: tp: globalExecutorProps: taskWrapperNames: ["ttl", "mdc"] executors: - threadPoolName: springTaskExecutor autoCreate: false corePoolSize: 10 maximumPoolSize: 20 queueCapacity: 2000 threadNamePrefix: test - threadPoolName: dtpExecutor2 corePoolSize: 20 maximumPoolSize: 40 queueCapacity: 1000 threadNamePrefix: test2 
 
  • 新增规则引擎框架 Liteflow 线程池适配模块
 https://github.com/dromara/dynamic-tp/issues/474 
 

引入以下依赖即可

 <dependency> <groupId>org.dromara.dynamictp</groupId> <artifactId>dynamic-tp-spring-boot-starter-adapter-liteflow</artifactId> <version>1.1.9</version> </dependency> 
 
 spring: dynamic: tp: liteflowTp: - threadPoolName: liteflowTp#LiteFlowDefaultWhenExecutorBuilder corePoolSize: 10 maximumPoolSize: 20 keepAliveTime: 60 
 
  • ScheduledDtpExecutor 支持 TaskWrapper 任务包装。
 https://github.com/dromara/dynamic-tp/issues/431 
 
 spring: dynamic: tp: executors: - threadPoolName: dtpExecutor1 executorType: scheduled corePoolSize: 10 threadNamePrefix: test taskWrapperNames: ["ttl", "mdc"] 
 

Bugfix

  • 修复 Spring ThreadPoolTaskExecutor 被框架管理后,ThreadPoolTaskExecutor 中定义的线程池装饰器失效问题。
 https://gitee.com/dromara/dynamic-tp/issues/I9D31H 
 
  • 修复 RocketMQ 线程池适配模块,在低版本时 getAsyncSenderExecutor 报 NoSuchMethodError 错误问题。
 https://github.com/dromara/dynamic-tp/issues/417 
 
  • 修复 TaskEnhanceAware 在多 Wrapper 包装后 taskName 丢失问题。
 https://github.com/dromara/dynamic-tp/issues/420 
 
  • 修复 JMX 报错 InstanceAlreadyExistsException 问题。
 https://github.com/dromara/dynamic-tp/issues/437 
 
  • 修复飞书报警填写了 username(非 openid 的情况), 发出的消息接受人为空问题。
 https://github.com/dromara/dynamic-tp/issues/428 
 
  • 修复钉钉告警 @所有人 不生效问题。
 https://github.com/dromara/dynamic-tp/issues/439 
 
  • 修复动态更新 taskWrappers 后导致 spring 线程池任务装饰器丢失问题。
 https://github.com/dromara/dynamic-tp/issues/481 
 
  • 修复 dubbo adapter missing afterInitialize step。

Optimize

  • 三方中间件线程池支持运行过程异常打印

  • Undertow 线程池支持任务包装器

  • juc 线程池、spring 线程池支持更多参数动态调整

  • 部分代码设计优化重构

详情查看:https://gitee.com/dromara/dynamic-tp/releases/v1.1.9

原文链接:https://www.oschina.net/news/313792/dynamic-tp-1-1-9
关注公众号

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。

持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。

转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。

文章评论

共有0条评论来说两句吧...

文章二维码

扫描即可查看该文章

点击排行

推荐阅读

最新文章