Tag

TransmittableThreadLocal

1 views collected around this technical thread.

Code Ape Tech Column
Code Ape Tech Column
Nov 25, 2024 · Backend Development

Elegant Methods for Passing Data Between Parent and Child Threads in Spring Boot

This article explains four techniques—manual setting, TaskDecorator, InheritableThreadLocal, and TransmittableThreadLocal—for propagating context such as user information from a parent thread to child threads in Spring Boot asynchronous execution, providing code examples and recommendations.

AsyncJavaSpring Boot
0 likes · 14 min read
Elegant Methods for Passing Data Between Parent and Child Threads in Spring Boot
Spring Full-Stack Practical Cases
Spring Full-Stack Practical Cases
Aug 14, 2024 · Backend Development

How to Safely Pass ThreadLocal Values Across Thread Pools with TTL

This article explains the limitations of Java's ThreadLocal and InheritableThreadLocal in thread‑pool scenarios, introduces Alibaba's open‑source TransmittableThreadLocal (TTL) library, and provides detailed code examples for safely transmitting thread‑local data across threads, thread pools, and even via Java agents.

JavaTTLThreadLocal
0 likes · 10 min read
How to Safely Pass ThreadLocal Values Across Thread Pools with TTL
Code Ape Tech Column
Code Ape Tech Column
Sep 22, 2023 · Backend Development

Elegant Ways to Transfer Data Between Parent and Child Threads in Spring Boot

This article introduces four methods—manual setting, TaskDecorator, InheritableThreadLocal, and TransmittableThreadLocal—to propagate contextual data such as user information from a parent thread to child threads in Spring Boot asynchronous execution, providing code examples and practical recommendations.

JavaSpring BootTaskDecorator
0 likes · 13 min read
Elegant Ways to Transfer Data Between Parent and Child Threads in Spring Boot
Code Ape Tech Column
Code Ape Tech Column
Jan 4, 2023 · Backend Development

Elegant Methods for Passing Data Between Parent and Child Threads in Spring Boot

This article explains four techniques—including manual setting, TaskDecorator, InheritableThreadLocal, and TransmittableThreadLocal—to reliably transfer user context and other thread‑local data from parent to child threads in Spring Boot asynchronous execution, with complete code samples and best‑practice recommendations.

JavaSpring BootTaskDecorator
0 likes · 13 min read
Elegant Methods for Passing Data Between Parent and Child Threads in Spring Boot
Code Ape Tech Column
Code Ape Tech Column
Jun 2, 2022 · Backend Development

Using Alibaba's TransmittableThreadLocal to Propagate ThreadLocal Variables in Thread Pools

This article explains why InheritableThreadLocal fails in pooled threads, introduces Alibaba's TransmittableThreadLocal library, demonstrates how to wrap executors and rewrite code to correctly transmit ThreadLocal data across parent‑child threads in Java thread pools, and provides detailed implementation and usage examples.

JavaThreadLocalThreadPool
0 likes · 13 min read
Using Alibaba's TransmittableThreadLocal to Propagate ThreadLocal Variables in Thread Pools
vivo Internet Technology
vivo Internet Technology
Jan 27, 2021 · Backend Development

TransmittableThreadLocal Practice: Solving Multi-Country Business Context Propagation in E-commerce

The article explains how to reliably propagate country‑specific context across request handling, database access, and asynchronous thread pools in multi‑country e‑commerce by replacing simple ThreadLocal and InheritableThreadLocal with Alibaba’s TransmittableThreadLocal, demonstrating its integration with Spring MVC/Boot, MyBatis, Dubbo, and custom executors for both sharded and non‑sharded databases.

AlibabaInheritableThreadLocalJava concurrency
0 likes · 16 min read
TransmittableThreadLocal Practice: Solving Multi-Country Business Context Propagation in E-commerce