当前位置:网站首页>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
边栏推荐
- Nodejs安装
- Solving the problem of displaying too many unique values in ArcGIS partition statistics failed
- [UDS unified diagnostic service] IV. typical diagnostic service (6) - input / output control unit (0x2F)
- 【ACM】70. climb stairs
- Implementation of image recognition code based on VGg convolutional neural network
- The vivado project corresponding to the board is generated by TCL script
- Stanford machine learning course summary
- 解决允许在postman中写入注释请求接口方法
- word frequency count
- Dock installation redis
猜你喜欢
Vulnérabilité d'exécution de la commande de fond du panneau de commande JD - freefuck
Nat Commun|在生物科学领域应用深度学习的当前进展和开放挑战
Qt读写XML文件(含源码+注释)
Solving the problem of displaying too many unique values in ArcGIS partition statistics failed
QT reading and writing XML files (including source code + comments)
cv_ Solution of mismatch between bridge and opencv
[UDS unified diagnostic service] (Supplement) v. detailed explanation of ECU bootloader development points (1)
JD freefuck Jingdong HaoMao control panel background Command Execution Vulnerability
Install the yapiupload plug-in in idea and upload the API interface to the Yapi document
Docker 安装 Redis
随机推荐
C medium? This form of
Rust: how to implement a thread pool?
MATLAB小技巧(6)七种滤波方法比较
C language input and output (printf and scanf functions, putchar and getchar functions)
线上怎么确定期货账户安全的?
What are the relationships and differences between threads and processes
C language loop structure program
Implementation of image recognition code based on VGg convolutional neural network
Refcell in rust
读取excel,int 数字时间转时间
NVIDIA Jetson: GStreamer and openmax (GST OMX) plug-ins
Identification verification code
Crawler for querying nicknames and avatars based on qqwebapi
MySQL auto start settings start with systemctl start mysqld
From source code to executable file
【ACM】376. Swing sequence
Gobang game based on pyGame Library
Generate verification code
powerdesigner各种字体设置;preview字体设置;sql字体设置
Robocode tutorial 8 - advanced robot