Tagged articles
13 articles
Page 1 of 1
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 propagationInheritableThreadLocalXXL-JOB
0 likes · 10 min read
Why Do Inherited ThreadLocals Cause Task Failures in XXL‑Job?
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.

InheritableThreadLocalThreadLocalconcurrency
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.

InheritableThreadLocalThreadLocaljava
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.

InheritableThreadLocalMemoryLeakThreadLocal
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.

InheritableThreadLocalThreadLocalbackend-development
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.

InheritableThreadLocalThreadLocalTransmittableThreadLocal
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.

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