当前位置:网站首页>Using transmittablethreadlocal to realize parameter cross thread transmission
Using transmittablethreadlocal to realize parameter cross thread transmission
2022-04-23 18:11:00 【dawnsun001】
- establish ThreadLocalContext
public class ThreadLocalContext {
public static TransmittableThreadLocal<SystemParams> systemParamsThreadLocal = new TransmittableThreadLocal<>();
}
- assignment
ThreadLocalContext.systemParamsThreadLocal.set(systemParamsDTO);
- Thread pool configuration
@Configuration
public class ThreadPoolConfig {
@Bean
public ExecutorService threadPoolExecutor(){
return TtlExecutors.getTtlExecutorService(new ThreadPoolExecutor(
10, 1000,30000L, TimeUnit.SECONDS,
new LinkedBlockingQueue<Runnable>(2000),
new CustomizableThreadFactory("thread-pool-"),
RejectPolicy.ABORT.getValue()));
}
}
版权声明
本文为[dawnsun001]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230544288977.html
边栏推荐
- Qt读写XML文件(含源码+注释)
- Rewrite four functions such as StrCmp in C language
- NVIDIA Jetson: GStreamer and openmax (GST OMX) plug-ins
- Nodejs安装
- According to the result set queried by SQL statement, it is encapsulated as JSON
- Installation du docker redis
- cv_ Solution of mismatch between bridge and opencv
- Flash operates on multiple databases
- Secure credit
- Pyppeter crawler
猜你喜欢

7-21 wrong questions involve knowledge points.

Classification of cifar100 data set based on convolutional neural network

2022 Jiangxi energy storage technology exhibition, China Battery exhibition, power battery exhibition and fuel cell Exhibition

An example of linear regression based on tensorflow

【ACM】376. Swing sequence

Clion installation tutorial

Nodejs installation

String function in MySQL

Nodejs安装

【ACM】509. 斐波那契数(dp五部曲)
随机推荐
MATLAB从入门到精通(二)
Using files to save data (C language)
Pointers in rust: box, RC, cell, refcell
登录和发布文章功能测试
Nat Commun|在生物科学领域应用深度学习的当前进展和开放挑战
7-21 wrong questions involve knowledge points.
Multi thread crawling Marco Polo network supplier data
Re regular expression
Pyppeter crawler
Basic usage of crawler requests
Serialization scheme of serde - trust
Svn simple operation command
Rust: how to implement a thread pool?
[UDS unified diagnostic service] v. diagnostic application example: Flash bootloader
Resolve the error Max virtual memory areas VM max_ map_ count [65530] is too low, increase to at least [262144]
[UDS unified diagnostic service] (Supplement) v. detailed explanation of ECU bootloader development points (2)
C [file operation] read TXT text by line
An example of linear regression based on tensorflow
Excel opens large CSV format data
Auto.js 自定义对话框