Tagged articles

InheritableThreadLocal

18 articles · Page 1 of 1
Spring Full-Stack Practical Cases
Spring Full-Stack Practical Cases
May 28, 2026 · Backend Development

5 Advanced Techniques to Preserve Context in Spring Boot Async Calls

In Spring Boot 3.5.0, asynchronous threads lose MDC, security, and request data because ThreadLocal is not shared; the article demonstrates five concrete solutions—including InheritableThreadLocal, thread joining, custom TaskDecorator, Spring Security delegating wrappers, and MDC propagation—each with code samples, pitfalls, and best‑practice warnings.

InheritableThreadLocalMDCSpring Boot
0 likes · 12 min read
5 Advanced Techniques to Preserve Context in Spring Boot Async Calls
Code Ape Tech Column
Code Ape Tech Column
May 25, 2026 · Backend Development

Why Does TraceId Get Mixed Up Under High Concurrency Even Though the Parent Thread Passes It to Child Threads?

The article explains why InheritableThreadLocal fails to propagate TraceId correctly in high‑concurrency thread‑pool scenarios, demonstrates the mixing problem with concrete request examples, and presents both manual propagation and Alibaba's TransmittableThreadLocal as reliable solutions.

Context propagationInheritableThreadLocalJava concurrency
0 likes · 7 min read
Why Does TraceId Get Mixed Up Under High Concurrency Even Though the Parent Thread Passes It to Child Threads?
Programmer XiaoFu
Programmer XiaoFu
May 19, 2026 · Backend Development

Why Does TraceId Get Mixed Up Under High Concurrency Even Though the Parent Thread Passes It to Child Threads?

The article explains why InheritableThreadLocal fails to propagate TraceId correctly in thread‑pool scenarios under high load, illustrates the problem with concrete request examples, and presents manual propagation and Alibaba's TransmittableThreadLocal as solutions.

InheritableThreadLocalJava concurrencyThreadPoolExecutor
0 likes · 7 min read
Why Does TraceId Get Mixed Up Under High Concurrency Even Though the Parent Thread Passes It to Child Threads?
Lobster Programming
Lobster Programming
May 18, 2026 · Fundamentals

Why userId Gets Lost in Async Calls and How ThreadLocal Solves It

The article explains ThreadLocal's lifecycle, why userId disappears when spawning asynchronous threads, compares ThreadLocal, InheritableThreadLocal, and Alibaba's TransmittableThreadLocal, and shows how the latter prevents data contamination in thread‑pool reuse.

InheritableThreadLocalJava concurrencyThreadLocal
0 likes · 5 min read
Why userId Gets Lost in Async Calls and How ThreadLocal Solves It
JavaGuide
JavaGuide
Feb 11, 2026 · Backend Development

Do ThreadLocal Values Fail in Asynchronous Scenarios? An Interviewer's Trick Question Explained

This article explains why ThreadLocal values are not automatically transferred in asynchronous or thread‑pool contexts, compares JDK's InheritableThreadLocal with Alibaba's TransmittableThreadLocal (TTL), and shows how TTL captures, replays, and restores context safely with code examples and diagrams.

Context propagationInheritableThreadLocalJava concurrency
0 likes · 13 min read
Do ThreadLocal Values Fail in Asynchronous Scenarios? An Interviewer's Trick Question Explained
Huolala Tech
Huolala Tech
Aug 13, 2025 · Backend Development

Why Do Inherited ThreadLocals Cause Task Failures in XXL‑Job?

An in‑depth analysis reveals that stale parameters stored in InheritableThreadLocal objects during thread‑pool reuse cause XXL‑Job tasks to process incorrect data, and provides debugging steps and best‑practice recommendations to prevent context pollution.

Context propagationInheritableThreadLocalJava
0 likes · 10 min read
Why Do Inherited ThreadLocals Cause Task Failures in XXL‑Job?
Shepherd Advanced Notes
Shepherd Advanced Notes
Jul 17, 2023 · Fundamentals

How to Pass Values Between Parent and Child Threads with InheritableThreadLocal and TransmittableThreadLocal

The article explains why regular ThreadLocal cannot share data from a parent thread to its child, introduces InheritableThreadLocal as a built‑in solution, shows its limitation with thread‑pool reuse, and demonstrates how Alibaba's TransmittableThreadLocal overcomes this issue with concrete code examples and output.

InheritableThreadLocalJavaThreadLocal
0 likes · 10 min read
How to Pass Values Between Parent and Child Threads with InheritableThreadLocal and TransmittableThreadLocal
IT Services Circle
IT Services Circle
Jan 15, 2023 · Backend Development

Understanding ThreadLocal and InheritableThreadLocal: Causes and Solutions for Missing Client Information in Multithreaded Java Services

This article explains why client information stored in ThreadLocal becomes unavailable after switching a single‑threaded search service to multithreading, analyzes the underlying ThreadLocal and InheritableThreadLocal mechanisms, and provides two practical solutions—passing the context manually or using InheritableThreadLocal—to avoid the upgrade‑prompt bug.

InheritableThreadLocalJavaThreadLocal
0 likes · 13 min read
Understanding ThreadLocal and InheritableThreadLocal: Causes and Solutions for Missing Client Information in Multithreaded Java Services
Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
Nov 28, 2022 · Fundamentals

Understanding ThreadLocal in Java: Creation, Usage, and Implementation Details

This article explains Java's ThreadLocal class, covering its purpose for thread‑local storage, core methods such as get, set, and remove, ways to set initial values via subclassing or withInitial, usage of InheritableThreadLocal for parent‑child thread data propagation, and the underlying implementation details.

InheritableThreadLocalJavaThreadLocal
0 likes · 12 min read
Understanding ThreadLocal in Java: Creation, Usage, and Implementation Details
Su San Talks Tech
Su San Talks Tech
May 14, 2022 · Backend Development

Unlocking ThreadLocal: How Java Manages Thread‑Local Data and Avoids Memory Leaks

This article explains why ThreadLocal is used in Java concurrency, dives into its internal implementation—including ThreadLocalMap, weak‑referenced keys, hash‑based indexing and resizing—covers common pitfalls such as memory leaks, and shows how InheritableThreadLocal and TransmittableThreadLocal can safely share data across child threads and thread pools.

InheritableThreadLocalJavaMemoryLeak
0 likes · 24 min read
Unlocking ThreadLocal: How Java Manages Thread‑Local Data and Avoids Memory Leaks
Selected Java Interview Questions
Selected Java Interview Questions
May 5, 2022 · Backend Development

Understanding ThreadLocal in Java: Principles, Memory Leak Issues, and Proper Usage

This article explains Java's ThreadLocal mechanism, detailing its internal structure, including key methods like set, get, and remove, demonstrates how improper use can cause memory leaks, and provides best practices and examples for safe usage, including InheritableThreadLocal and real-world scenarios.

InheritableThreadLocalThreadLocalbest practices
0 likes · 18 min read
Understanding ThreadLocal in Java: Principles, Memory Leak Issues, and Proper Usage
Selected Java Interview Questions
Selected Java Interview Questions
Apr 4, 2022 · Backend Development

Using InheritableThreadLocal to Access Parent ThreadLocal Values in Child Threads (Java)

This article explains how to make a child thread inherit the values stored in a parent thread's ThreadLocal by using InheritableThreadLocal, demonstrates the behavior with a runnable Java example, and details the underlying ThreadLocalMap mechanism that enables the inheritance.

Backend DevelopmentInheritableThreadLocalThreadLocal
0 likes · 3 min read
Using InheritableThreadLocal to Access Parent ThreadLocal Values in Child Threads (Java)
ITFLY8 Architecture Home
ITFLY8 Architecture Home
Jul 17, 2021 · Backend Development

How to Preserve Trace Context Across Asynchronous Java Threads with TransmittableThreadLocal

This article explains why ThreadLocal‑based trace information is lost in asynchronous Java calls, compares InheritableThreadLocal and the Alibaba‑provided TransmittableThreadLocal library, shows how to wrap runnables with TtlRunnable, and demonstrates a Java Agent solution for transparent thread‑pool propagation.

InheritableThreadLocalJavaThreadLocal
0 likes · 9 min read
How to Preserve Trace Context Across Asynchronous Java Threads with TransmittableThreadLocal
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
Programmer DD
Programmer DD
Sep 5, 2019 · Fundamentals

Understanding ThreadLocal: Solving Thread Safety Issues in Java

This article explains thread safety problems, demonstrates how unsynchronized access to shared variables can produce incorrect results, and shows how Java's ThreadLocal and InheritableThreadLocal classes provide thread‑local storage to avoid concurrency bugs, including implementation details and usage examples.

InheritableThreadLocalJavaThreadLocal
0 likes · 9 min read
Understanding ThreadLocal: Solving Thread Safety Issues in Java