Tagged articles
205 articles
Page 1 of 3
Spring Full-Stack Practical Cases
Spring Full-Stack Practical Cases
Apr 22, 2026 · Backend Development

5 Common Spring Boot Filter Pitfalls and How to Avoid Them

This article examines five typical pitfalls when using Spring Boot filters—request body consumption, ThreadLocal leakage, duplicate execution, ordering conflicts, and async handling—provides concrete code examples, explains why each issue occurs, and offers reliable solutions to keep your applications stable and secure.

BackendJavaServlet
0 likes · 11 min read
5 Common Spring Boot Filter Pitfalls and How to Avoid Them
WeiLi Technology Team
WeiLi Technology Team
Mar 31, 2026 · Backend Development

Why ThreadLocal Leaks Cause Full GC in Thread Pools and How to Fix It

An online service experienced frequent Full GC due to a ThreadLocal memory leak in a thread‑pool scenario; the article walks through GC log analysis, heap dump inspection, root‑cause discovery in ThreadFactory logic, and presents a robust fix using Spring’s TaskDecorator to ensure proper cleanup.

JavaTaskDecoratorThreadLocal
0 likes · 14 min read
Why ThreadLocal Leaks Cause Full GC in Thread Pools and How to Fix 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
Java Companion
Java Companion
Feb 5, 2026 · Backend Development

Elegant Dynamic Data Source Switching in SpringBoot Using ThreadLocal and AbstractRoutingDataSource

This article walks through building an elegant dynamic data‑source switch in SpringBoot by combining ThreadLocal with AbstractRoutingDataSource, covering the context holder, custom routing class, YAML configuration, testing, annotation‑driven switching, and runtime addition of new data sources.

Runtime DataSource RegistrationSpringBootThreadLocal
0 likes · 16 min read
Elegant Dynamic Data Source Switching in SpringBoot Using ThreadLocal and AbstractRoutingDataSource
SpringMeng
SpringMeng
Jan 16, 2026 · Backend Development

What Unexpected Pitfalls PageHelper Can Teach You After Years of Use

The article recounts a developer’s painful experience with PageHelper, detailing how duplicate registrations, truncated result sets, and password‑update errors stem from the plugin’s ThreadLocal pagination handling, and explains the underlying code paths and safe usage practices.

BackendJavaMyBatis
0 likes · 13 min read
What Unexpected Pitfalls PageHelper Can Teach You After Years of Use
macrozheng
macrozheng
Jan 6, 2026 · Backend Development

Why PageHelper Can Break Your MyBatis Queries and How to Fix It

The article examines unexpected bugs caused by PageHelper’s hidden LIMIT clause injection in MyBatis projects, explains how ThreadLocal pagination parameters persist across requests, and provides practical guidelines and code examples to avoid and clean up these issues.

JavaMyBatisThreadLocal
0 likes · 13 min read
Why PageHelper Can Break Your MyBatis Queries and How to Fix It
Top Architect
Top Architect
Dec 25, 2025 · Backend Development

Auto‑Inject UserId and OrderId into Logs with Spring AOP and MDC

This guide shows how to eliminate manual logging of user and order identifiers in a Java e‑commerce system by declaring log placeholders, storing values in ThreadLocal, and using a custom @UserLog annotation with Spring AOP to automatically populate MDC variables for Log4j2.

JavaThreadLocalannotation
0 likes · 9 min read
Auto‑Inject UserId and OrderId into Logs with Spring AOP and MDC
macrozheng
macrozheng
Nov 21, 2025 · Backend Development

Master Java Concurrency: Locks, Singleton Patterns, ThreadLocal, Reflection and More

This article provides a comprehensive guide to Java concurrency and related concepts, covering synchronized lock upgrades, object vs class locks, lazy and double‑checked singleton implementations, ThreadLocal mechanics, reflection usage, annotation scopes, JVM class loading, and Redis cluster threading behavior.

JVMJavaReflection
0 likes · 22 min read
Master Java Concurrency: Locks, Singleton Patterns, ThreadLocal, Reflection and More
JavaGuide
JavaGuide
Nov 20, 2025 · Backend Development

iFlytek Salary Offers Revealed + Comprehensive Java Interview Prep

The article shares iFlytek's recent campus salary packages, then dives into a detailed Java interview guide covering Redis data types, key expiration handling, thread safety, ThreadLocal usage, MySQL covering and composite indexes, slow‑query analysis, and SQL‑injection prevention techniques.

Java interviewSQL injectionThreadLocal
0 likes · 17 min read
iFlytek Salary Offers Revealed + Comprehensive Java Interview Prep
Tech Freedom Circle
Tech Freedom Circle
Nov 11, 2025 · Backend Development

ThreadLocal Interview Deep Dive: 20‑Minute Analysis, Manual vs Framework Solutions, and a Winning Methodology

This article explains the inner workings of Java's ThreadLocal, why it fails to propagate context in asynchronous scenarios, compares manual passing and decorator‑based approaches, introduces the TransmittableThreadLocal (TTL) library with its CRER workflow, and provides a structured interview answer that showcases deep architectural insight.

ContextPropagationJavaTTL
0 likes · 26 min read
ThreadLocal Interview Deep Dive: 20‑Minute Analysis, Manual vs Framework Solutions, and a Winning Methodology
Tech Freedom Circle
Tech Freedom Circle
Nov 4, 2025 · Backend Development

Designing a Non‑Intrusive Spring Cloud SaaS Multi‑Tenant Component for Full‑Stack Data Isolation

The article presents a step‑by‑step, code‑driven design of a Spring Cloud SaaS multi‑tenant solution that balances resource sharing and strict data isolation by using a shared‑database, shared‑schema approach with tenant_id filtering, ThreadLocal context, MyBatis‑Plus interceptors, Redis key prefixing, Sa‑Token session segregation, and Spring Boot auto‑configuration.

Sa-TokenSaaSSpring Boot
0 likes · 16 min read
Designing a Non‑Intrusive Spring Cloud SaaS Multi‑Tenant Component for Full‑Stack Data Isolation
IT Services Circle
IT Services Circle
Nov 2, 2025 · Backend Development

Why ScopedValue Is the Future Replacement for ThreadLocal in Java

This article explores the limitations of ThreadLocal—memory leaks, data contamination, inheritance issues, and performance overhead—and introduces Java's ScopedValue as a safer, more efficient alternative, covering its core design, basic and advanced usage, performance benchmarks, migration strategies, and real‑world web application examples.

JavaScopedValueThreadLocal
0 likes · 28 min read
Why ScopedValue Is the Future Replacement for ThreadLocal in Java
Su San Talks Tech
Su San Talks Tech
Nov 1, 2025 · Backend Development

Why ScopedValue Is the Future of Thread-Local Data in Java

This article explores the limitations of ThreadLocal, introduces Java's new ScopedValue feature, provides detailed usage examples, performance benchmarks, migration strategies, and compares both approaches to help developers decide when and how to adopt ScopedValue in modern backend applications.

JavaScopedValueThreadLocal
0 likes · 34 min read
Why ScopedValue Is the Future of Thread-Local Data in Java
IT Services Circle
IT Services Circle
Oct 31, 2025 · Backend Development

Master Java Concurrency, Singleton, ThreadLocal, and Reflection for Interviews

This guide covers essential Java interview topics—including synchronized lock upgrades, object vs class locking, lazy and double‑checked singleton patterns, ThreadLocal mechanics, reflection usage, annotation scopes, Redis cluster behavior, and a linear‑time algorithm challenge—providing clear explanations, code examples, and practical insights for developers preparing for technical interviews.

JavaReflectionSingleton
0 likes · 20 min read
Master Java Concurrency, Singleton, ThreadLocal, and Reflection for Interviews
DeWu Technology
DeWu Technology
Oct 13, 2025 · Backend Development

TTL Agent Pitfalls: Memory Leaks & CPU Spikes in Java – Cases & Fixes

This article explains how the Transmittable ThreadLocal (TTL) Java agent works, why improper usage can cause context contamination, memory leaks, and CPU spikes, and provides real production cases, code examples, and practical recommendations to avoid these pitfalls.

Java AgentTTLThreadLocal
0 likes · 15 min read
TTL Agent Pitfalls: Memory Leaks & CPU Spikes in Java – Cases & Fixes
Architect's Tech Stack
Architect's Tech Stack
Sep 25, 2025 · Backend Development

Auto‑Inject UserId and OrderId into Logs with Spring AOP and MDC

This article explains how to eliminate manual logging of user and order identifiers in Java e‑commerce services by using Log4j2 placeholders, ThreadLocal, MDC, a custom @UserLog annotation, and Spring AOP to automatically enrich log messages with these contextual fields.

ThreadLocalannotationjava logging
0 likes · 9 min read
Auto‑Inject UserId and OrderId into Logs with Spring AOP and MDC
Java Architecture Diary
Java Architecture Diary
Sep 19, 2025 · Backend Development

Why ScopedValues Outperform ThreadLocal for Safe Context Management in Java

ScopedValues provide a more efficient, memory‑safe, and virtual‑thread‑friendly alternative to ThreadLocal for managing per‑thread context in Java, eliminating manual cleanup, reducing memory leaks, and simplifying context propagation across threads, as demonstrated by code examples and performance benchmarks.

ScopedValuesThreadLocalVirtualThreads
0 likes · 6 min read
Why ScopedValues Outperform ThreadLocal for Safe Context Management in Java
macrozheng
macrozheng
Aug 8, 2025 · Backend Development

Master Java Backend: ThreadLocal, Memory Leaks, Spring Bean Lifecycle & AOP

This guide covers evaluating engineer hourly wages, interview self‑introduction tips, local vs distributed cache choices, ThreadLocal usage, memory‑leak detection with MAT, deadlock troubleshooting, Spring Bean lifecycle, AOP implementation, and Redis‑based distributed locks, plus resources for Spring Boot projects.

JavaThreadLocalaop
0 likes · 20 min read
Master Java Backend: ThreadLocal, Memory Leaks, Spring Bean Lifecycle & AOP
FunTester
FunTester
Jul 20, 2025 · Backend Development

Which GUID Generation Method Wins? Performance Test of UUID, Snowflake, ThreadLocal & Atomic

An extensive performance benchmark compares four GUID generation techniques—UUID, Snowflake algorithm, ThreadLocal exclusive counters, and atomic counters—across varying thread counts, revealing that ThreadLocal excels in high‑concurrency single‑machine scenarios while Snowflake remains stable for distributed use, with detailed optimization recommendations.

GUIDJavaThreadLocal
0 likes · 10 min read
Which GUID Generation Method Wins? Performance Test of UUID, Snowflake, ThreadLocal & Atomic
The Dominant Programmer
The Dominant Programmer
Jul 9, 2025 · Fundamentals

Mastering Java Thread Communication: volatile, synchronized, wait/notify, and Piped Streams

This article explains how Java threads interact using volatile for visibility, synchronized blocks for mutual exclusion, wait/notify (and Condition) for coordination, piped streams for one‑way byte communication, as well as Thread.join and ThreadLocal utilities, providing concrete code examples, best‑practice guidelines, and performance considerations.

JavaPipedStreamThreadLocal
0 likes · 23 min read
Mastering Java Thread Communication: volatile, synchronized, wait/notify, and Piped Streams
Java Backend Technology
Java Backend Technology
Jul 8, 2025 · Backend Development

ThreadLocal vs ScopedValue: Why ScopedValue Is the New King in Java Concurrency

ThreadLocal has long served as Java’s go‑to tool for thread‑local data, but its memory‑leak risks and performance penalties become pronounced with virtual threads, while the newer ScopedValue offers automatic cleanup, immutable safety, and superior efficiency, making it a compelling replacement in high‑concurrency scenarios.

ScopedValueThreadLocalVirtual Threads
0 likes · 12 min read
ThreadLocal vs ScopedValue: Why ScopedValue Is the New King in Java Concurrency
Architect's Guide
Architect's Guide
Jul 7, 2025 · Backend Development

Dynamic Data Source Switching in Spring Boot Using ThreadLocal & AbstractRoutingDataSource

This tutorial explains how to implement dynamic data source switching in Spring Boot by combining ThreadLocal with AbstractRoutingDataSource, covering custom context holders, configuration, annotation‑driven switching, dynamic addition of data sources, and complete code examples with test results.

Dynamic Data SourceSpring BootThreadLocal
0 likes · 16 min read
Dynamic Data Source Switching in Spring Boot Using ThreadLocal & AbstractRoutingDataSource
Architect's Must-Have
Architect's Must-Have
Jun 9, 2025 · Backend Development

Why Netty Introduced FastThreadLocal and How It Boosts Performance

FastThreadLocal, Netty’s custom thread‑local implementation, replaces JDK’s ThreadLocal by using an indexed array to avoid hash collisions, offering faster access; this article explains its background, core classes, source‑code mechanics, performance trade‑offs, and cleanup strategies within Netty’s architecture.

FastThreadLocalJavaNetty
0 likes · 13 min read
Why Netty Introduced FastThreadLocal and How It Boosts Performance
Lobster Programming
Lobster Programming
Jun 3, 2025 · Backend Development

How ThreadLocal Can Cause Memory Leaks in Java Multithreading

This article explains how ThreadLocal creates per‑thread variable copies, demonstrates its usage with sample Java code, illustrates the internal storage structure, and reveals why improper handling can lead to memory leaks when thread‑local values persist in thread pools.

JavaThreadLocalmemory leak
0 likes · 3 min read
How ThreadLocal Can Cause Memory Leaks in Java Multithreading
Java Backend Technology
Java Backend Technology
May 15, 2025 · Backend Development

Why Netty Uses FastThreadLocal Over JDK ThreadLocal: Deep Dive & Code Analysis

This article explains why Netty introduces FastThreadLocal instead of relying on JDK ThreadLocal, detailing its background, core principles, source code structure—including InternalThreadLocalMap, FastThreadLocalThread, and FastThreadLocal implementations—performance implications, resource reclamation mechanisms, and practical usage within Netty’s memory allocation.

FastThreadLocalMemory ManagementNetty
0 likes · 11 min read
Why Netty Uses FastThreadLocal Over JDK ThreadLocal: Deep Dive & Code Analysis
Selected Java Interview Questions
Selected Java Interview Questions
May 14, 2025 · Backend Development

Enterprise Java Core Features: Full‑Chain Logging, Unified Exception Handling, Permission Interceptor, and Thread Context Management

This article presents a comprehensive guide to implementing full‑chain log tracing, unified exception handling, permission interception, request latency monitoring, and standardized log formats in enterprise‑level Java projects using Spring AOP, thread‑local context, and Redis caching.

SecurityThreadLocalaop
0 likes · 23 min read
Enterprise Java Core Features: Full‑Chain Logging, Unified Exception Handling, Permission Interceptor, and Thread Context Management
Lin is Dream
Lin is Dream
May 5, 2025 · Backend Development

Mastering MDC with Logback: Traceable Logging for Distributed Systems

This article explains how to use SLF4J's MDC with Logback to assign a unique trace ID to each request, propagate it across threads and services, and configure log patterns so that logs become fully traceable for easier debugging in distributed systems.

Distributed SystemsJavaThreadLocal
0 likes · 7 min read
Mastering MDC with Logback: Traceable Logging for Distributed Systems
Cognitive Technology Team
Cognitive Technology Team
May 3, 2025 · Fundamentals

Understanding Java ThreadLocalMap: Structure, Operations, and Memory Management

This article explains the internal design of Java's ThreadLocalMap, covering its core Entry structure, hash table storage, linear probing for collision resolution, key operations (set, get, remove), memory‑leak scenarios, automatic cleanup mechanisms, and practical usage patterns such as thread‑context propagation and Android Looper.

JavaMemoryManagementThreadLocal
0 likes · 10 min read
Understanding Java ThreadLocalMap: Structure, Operations, and Memory Management
Cognitive Technology Team
Cognitive Technology Team
May 3, 2025 · Backend Development

Understanding ThreadLocal: Core Principles, Use Cases, Pitfalls, and Best Practices

ThreadLocal provides per‑thread variable storage to achieve thread isolation, improving concurrency performance, and is essential for safe data handling in Java, but improper use can cause memory leaks, data contamination, and other issues; this article explains its internal mechanism, common scenarios, pitfalls, and best‑practice guidelines with code examples.

JavaThreadLocalbest practices
0 likes · 19 min read
Understanding ThreadLocal: Core Principles, Use Cases, Pitfalls, and Best Practices
Java Backend Full-Stack
Java Backend Full-Stack
Apr 26, 2025 · Backend Development

Master ThreadLocal: Answer Interview Questions and Prevent OOM Leaks

This article explains ThreadLocal’s internal mechanism, why improper use can cause OutOfMemoryError in thread pools, demonstrates the issue with a Java example, and provides best‑practice guidance—especially calling remove()—to prevent memory leaks while preparing for interview questions.

JavaOutOfMemoryErrorThreadLocal
0 likes · 11 min read
Master ThreadLocal: Answer Interview Questions and Prevent OOM Leaks
Java Architect Essentials
Java Architect Essentials
Apr 10, 2025 · Backend Development

Master Dynamic Data Source Switching in SpringBoot: A Step‑by‑Step Guide

This article walks through the complete process of implementing dynamic data source switching in a SpringBoot application, covering the core concepts of thread‑local context, abstract routing, custom annotations with AOP, configuration, code examples, and important considerations such as transaction management and performance.

JavaSpringBootThreadLocal
0 likes · 6 min read
Master Dynamic Data Source Switching in SpringBoot: A Step‑by‑Step Guide
Selected Java Interview Questions
Selected Java Interview Questions
Apr 10, 2025 · Backend Development

Understanding PageHelper Issues and ThreadLocal Pitfalls in MyBatis

This article analyzes unexpected behaviors caused by PageHelper in a Java backend project, such as duplicate user registration, limited query results, and password‑reset errors, and explains how ThreadLocal pagination parameters, startPage(), and cleanup mechanisms lead to these problems while offering practical debugging tips.

BackendMyBatisSQL
0 likes · 11 min read
Understanding PageHelper Issues and ThreadLocal Pitfalls in MyBatis
Architect's Must-Have
Architect's Must-Have
Mar 18, 2025 · Backend Development

Why Netty Uses FastThreadLocal and How It Outperforms JDK ThreadLocal

This article explains the motivation behind Netty's FastThreadLocal, details its internal design using an indexed array to avoid hash collisions, analyzes the core source code of InternalThreadLocalMap, FastThreadLocalThread, and FastThreadLocal, and discusses performance implications and reclamation strategies.

FastThreadLocalJavaMemory Management
0 likes · 10 min read
Why Netty Uses FastThreadLocal and How It Outperforms JDK ThreadLocal
Selected Java Interview Questions
Selected Java Interview Questions
Mar 13, 2025 · Backend Development

Implementing Dynamic Data Source Switching in Spring Boot with ThreadLocal and AbstractRoutingDataSource

This article demonstrates how to build a dynamic data source switching mechanism in Spring Boot by leveraging ThreadLocal for thread‑scoped context and AbstractRoutingDataSource for routing, covering manual implementation, annotation‑driven switching, and runtime addition of new data sources.

DynamicDataSourceMyBatisPlusSpringBoot
0 likes · 14 min read
Implementing Dynamic Data Source Switching in Spring Boot with ThreadLocal and AbstractRoutingDataSource
Architect
Architect
Mar 12, 2025 · Backend Development

DataSource Switching in Spring Boot with ThreadLocal & AbstractRoutingDataSource

Facing the need to query multiple databases in a Spring Boot application, this guide walks through building a custom dynamic datasource solution using ThreadLocal and AbstractRoutingDataSource, covering core implementations, annotation‑based switching, dynamic datasource addition, configuration, and comprehensive test results.

JavaSpring BootThreadLocal
0 likes · 18 min read
DataSource Switching in Spring Boot with ThreadLocal & AbstractRoutingDataSource
FunTester
FunTester
Jan 20, 2025 · Fundamentals

Mastering ThreadLocal in Java: From Basics to Best Practices

ThreadLocal provides a simple yet powerful way to give each thread its own independent variable, eliminating shared-state conflicts; this guide explains its underlying mechanism, creation methods, basic get/set operations, a complete example with console output, and important usage considerations such as potential memory leaks.

JavaPerformance TestingThreadLocal
0 likes · 6 min read
Mastering ThreadLocal in Java: From Basics to Best Practices
Xuanwu Backend Tech Stack
Xuanwu Backend Tech Stack
Jan 14, 2025 · Backend Development

Mastering Java ThreadLocal: Core Operations, Map Structure, and Practical Examples

This article explains Java's ThreadLocal mechanism, detailing its internal ThreadLocalMap structure, core set/get/remove operations with full code examples, and demonstrates how multiple ThreadLocal variables are stored per thread, providing a clear understanding of thread‑local storage in backend development.

Backend DevelopmentJavaThreadLocal
0 likes · 6 min read
Mastering Java ThreadLocal: Core Operations, Map Structure, and Practical Examples
JD Tech Talk
JD Tech Talk
Dec 27, 2024 · Backend Development

Log Sampling and Cross‑Thread Propagation in High‑Throughput Java Services

The article examines the performance impact of excessive logging in large‑scale Java systems and proposes request‑level sampling with cross‑thread identifier propagation, offering practical component‑based solutions, implementation considerations, and a concrete code example for backend developers.

BackendJavaSampling
0 likes · 7 min read
Log Sampling and Cross‑Thread Propagation in High‑Throughput Java Services
JD Cloud Developers
JD Cloud Developers
Dec 27, 2024 · Backend Development

How to Implement Cross-Thread Log Sampling in High-Throughput Java Services

Log volume can cripple high-throughput Java systems, especially during traffic spikes, so this article explores practical strategies for request-level log sampling, cross-thread trace propagation, and component-based APIs to balance observability with performance, including code examples and implementation considerations.

JavaThreadLocallog sampling
0 likes · 8 min read
How to Implement Cross-Thread Log Sampling in High-Throughput Java Services
Top Architect
Top Architect
Nov 21, 2024 · Backend Development

Best Practices and Common Pitfalls of Using Thread Pools in Java

This article summarizes how to correctly declare, monitor, configure, and name Java thread pools, explains common mistakes such as unbounded queues and ThreadLocal contamination, and introduces dynamic tuning techniques and open‑source solutions for robust backend concurrency management.

JavaSpringBootThreadLocal
0 likes · 18 min read
Best Practices and Common Pitfalls of Using Thread Pools in Java
Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
Oct 28, 2024 · Backend Development

Resolving Missing Request Headers in Spring MVC Multithreaded Environments

This article analyzes why Spring MVC fails to retrieve request header fields in multithreaded scenarios, explains the underlying ThreadLocal storage mechanism, critiques a common but flawed solution, and presents reliable approaches using CountDownLatch, manual RequestContextHolder propagation, and request caching to ensure header availability across threads.

BackendJavaRequestContextHolder
0 likes · 10 min read
Resolving Missing Request Headers in Spring MVC Multithreaded Environments
Mike Chen's Internet Architecture
Mike Chen's Internet Architecture
Aug 4, 2024 · Backend Development

Understanding Java Memory Leaks and How to Prevent Them

This article explains what memory leaks are in Java, outlines common causes such as unreleased resources, static collections, misuse of ThreadLocal, improper variable scope, inner‑class references and off‑heap memory, and provides practical solutions and best‑practice recommendations to avoid them.

JVMJavaThreadLocal
0 likes · 9 min read
Understanding Java Memory Leaks and How to Prevent Them
MaGe Linux Operations
MaGe Linux Operations
Jul 25, 2024 · Fundamentals

Unlock Python Multithreading: A Complete Guide to Threads, Locks, and Queues

This article provides a comprehensive overview of Python multithreading, covering basic concepts, the _thread and threading modules, thread creation methods, synchronization primitives like Lock and RLock, thread-local storage, thread pools, and the differences between multithreading and multiprocessing for both CPU‑bound and I/O‑bound workloads.

LockPythonQueue
0 likes · 24 min read
Unlock Python Multithreading: A Complete Guide to Threads, Locks, and Queues
JD Tech Talk
JD Tech Talk
Jul 8, 2024 · Backend Development

Implementing Data Permission Control with MyBatis Interceptor and ThreadLocal

This article explains how to enforce data permission control in Java backend applications by using MyBatis mapper annotations, ThreadLocal rule propagation, and a MyBatis interceptor that parses and rewrites SQL statements with permission constraints, providing minimal intrusion to existing business logic.

Data PermissionMyBatisSQL interceptor
0 likes · 11 min read
Implementing Data Permission Control with MyBatis Interceptor and ThreadLocal
Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
Jul 1, 2024 · Backend Development

Resolving Data Contamination in Multithreaded Security Testing by Redesigning Class Attributes in Python

This article explains how using a shared class attribute to store open ports in a Python security‑testing framework can cause data contamination across threads, demonstrates the problem with example code, and presents three solutions—reinitializing the attribute, using contextvars, and employing threading.local—to ensure thread‑local isolation and accurate port scanning.

Class AttributesContextVarPython
0 likes · 10 min read
Resolving Data Contamination in Multithreaded Security Testing by Redesigning Class Attributes in Python
FunTester
FunTester
Jun 4, 2024 · Backend Development

Why FastThreadLocal Beats ThreadLocal in High‑Concurrency Java Apps

This article compares Java's standard ThreadLocal with Netty's FastThreadLocal, explains their internal mechanisms, shows practical code examples, runs a JMH microbenchmark, and discusses performance, memory management, and usage scenarios to help developers choose the right thread‑local storage solution.

FastThreadLocalJMHJava
0 likes · 11 min read
Why FastThreadLocal Beats ThreadLocal in High‑Concurrency Java Apps
Code Ape Tech Column
Code Ape Tech Column
May 4, 2024 · Backend Development

Understanding PageHelper Pagination Issues and ThreadLocal Management in MyBatis

This article analyzes common anomalies caused by the PageHelper pagination plugin in a Java backend project—such as duplicate user registration, limited query results, and password‑reset errors—traces them to ThreadLocal misuse, explains the internal workflow of startPage, getLocalPage, and clearPage, and offers practical recommendations to avoid these pitfalls.

BackendJavaMyBatis
0 likes · 11 min read
Understanding PageHelper Pagination Issues and ThreadLocal Management in MyBatis
Su San Talks Tech
Su San Talks Tech
Apr 30, 2024 · Backend Development

Mastering Context Propagation in Thread Pools with TransmittableThreadLocal

This article explains why standard ThreadLocal mechanisms fail with thread pools, introduces the design of a custom solution using YesThreadLocal and YesRunnable, and then details how Alibaba's TransmittableThreadLocal (TTL) implements context capture, replay, and restoration for seamless asynchronous execution.

ContextPropagationJavaThreadLocal
0 likes · 12 min read
Mastering Context Propagation in Thread Pools with TransmittableThreadLocal
Architect
Architect
Apr 23, 2024 · Backend Development

Cross-Thread Log Sampling for High-Throughput Java Services

This article examines the performance impact of excessive logging in high-throughput Java services and presents three practical approaches—ThreadLocal-style wrappers, explicit flag propagation, and a decoupled component with an extensible API—to achieve cross-thread request-level log sampling while preserving traceability.

AsynchronousBackendJava
0 likes · 9 min read
Cross-Thread Log Sampling for High-Throughput Java Services
Java Captain
Java Captain
Mar 25, 2024 · Fundamentals

Understanding Java ThreadLocal: Mechanism, Use Cases, and Best Practices

ThreadLocal in Java provides thread‑local variables by maintaining a per‑thread map, enabling data isolation, simplifying inter‑thread data transfer, and storing context information, while requiring careful handling to avoid memory leaks, thread‑pool contamination, and overuse.

JavaThreadLocalbest practices
0 likes · 5 min read
Understanding Java ThreadLocal: Mechanism, Use Cases, and Best Practices
Architect's Guide
Architect's Guide
Mar 15, 2024 · Backend Development

Implementing Dynamic Data Source Switching in Spring Boot with ThreadLocal and AbstractRoutingDataSource

This tutorial demonstrates how to build a custom dynamic data source solution in Spring Boot by combining ThreadLocal and AbstractRoutingDataSource, covering the implementation of context holders, routing logic, configuration, testing, annotation‑driven switching, and runtime addition of new data sources.

DynamicDataSourceJavaSpringBoot
0 likes · 16 min read
Implementing Dynamic Data Source Switching in Spring Boot with ThreadLocal and AbstractRoutingDataSource
FunTester
FunTester
Feb 18, 2024 · Backend Development

Mastering Java Concurrency: Threads, Synchronization, and Immutable Design

This article provides a step‑by‑step guide to Java concurrency, covering core concepts such as threads, runnables, thread lifecycle, synchronization primitives, wait/notify patterns, volatile variables, ThreadLocal storage, and how to design immutable objects for thread‑safety, all illustrated with concrete code examples and detailed explanations.

ImmutableJavaSynchronization
0 likes · 17 min read
Mastering Java Concurrency: Threads, Synchronization, and Immutable Design
Java Tech Enthusiast
Java Tech Enthusiast
Feb 9, 2024 · Backend Development

Understanding PageHelper Issues and ThreadLocal in MyBatis Pagination

Unexpected duplicate registrations, truncated query results, and password‑reset SQL errors in a Java backend were traced to PageHelper’s ThreadLocal pagination state persisting across requests when startPage() is called without immediate query execution, so developers should ensure immediate execution or manually clear the ThreadLocal to prevent stale LIMIT clauses.

JavaMyBatisThreadLocal
0 likes · 12 min read
Understanding PageHelper Issues and ThreadLocal in MyBatis Pagination
Java Architect Essentials
Java Architect Essentials
Jan 18, 2024 · Backend Development

Implement Dynamic Data Source Switching in Spring Boot with ThreadLocal and AbstractRoutingDataSource

This tutorial explains how to switch between multiple databases in a Spring Boot application by implementing ThreadLocal and AbstractRoutingDataSource, covering code implementation, configuration, testing, annotation-based switching, and dynamic addition of data sources with detailed examples and practical guidance.

DynamicDataSourceJavaSpringBoot
0 likes · 15 min read
Implement Dynamic Data Source Switching in Spring Boot with ThreadLocal and AbstractRoutingDataSource
Architect
Architect
Dec 18, 2023 · Backend Development

Implementing Dynamic Data Source Switching in Spring Boot with ThreadLocal and AbstractRoutingDataSource

This article demonstrates how to build a custom dynamic data‑source solution for Spring Boot by using ThreadLocal to store the current datasource key, extending AbstractRoutingDataSource for routing, configuring multiple datasources in application.yml, and optionally adding annotation‑driven switching and runtime datasource registration.

DynamicDataSourceJavaMyBatisPlus
0 likes · 15 min read
Implementing Dynamic Data Source Switching in Spring Boot with ThreadLocal and AbstractRoutingDataSource
Java High-Performance Architecture
Java High-Performance Architecture
Dec 14, 2023 · Backend Development

Master Dynamic Data Source Switching with ThreadLocal in SpringBoot

This guide explains how to implement dynamic data source switching in SpringBoot by leveraging ThreadLocal and AbstractRoutingDataSource, covering basic concepts, code examples for context holder, routing datasource, configuration, annotation‑driven switching, and runtime addition of new data sources with practical testing steps.

Dynamic Data SourceJavaSpringBoot
0 likes · 18 min read
Master Dynamic Data Source Switching with ThreadLocal in SpringBoot
IT Xianyu
IT Xianyu
Dec 12, 2023 · Backend Development

Implementing Dynamic Data Source Switching in Spring Boot Using ThreadLocal and AbstractRoutingDataSource

This article explains how to build a custom dynamic data‑source solution for Spring Boot by leveraging ThreadLocal and AbstractRoutingDataSource, provides complete Java code for context holders, routing datasource, configuration, annotation‑driven switching, and runtime addition of new data sources.

BackendThreadLocalabstractroutingdatasource
0 likes · 15 min read
Implementing Dynamic Data Source Switching in Spring Boot Using ThreadLocal and AbstractRoutingDataSource
Selected Java Interview Questions
Selected Java Interview Questions
Nov 22, 2023 · Backend Development

Thread Pool Pitfalls and Best Practices in Java Backend Development

This article analyzes a real production incident caused by improper thread‑pool usage, explains common misconceptions about core parameters, demonstrates faulty code examples, and provides concrete recommendations for configuring thread pools, handling timeouts, and avoiding deadlocks in Java backend services.

CompletableFutureJava concurrencySpring Async
0 likes · 14 min read
Thread Pool Pitfalls and Best Practices in Java Backend Development
Code Ape Tech Column
Code Ape Tech Column
Nov 18, 2023 · Backend Development

Understanding ThreadLocal, ScopedValue, and StructuredTaskScope in Java

This article explains the ThreadLocal mechanism, its memory‑leak pitfalls, introduces the new ScopedValue feature in JDK 20 as a safer alternative, and demonstrates practical Spring and virtual‑thread examples using StructuredTaskScope for modern Java backend concurrency.

JavaScopedValueStructuredTaskScope
0 likes · 22 min read
Understanding ThreadLocal, ScopedValue, and StructuredTaskScope in Java
MaGe Linux Operations
MaGe Linux Operations
Nov 12, 2023 · Backend Development

Why RocketMQ Producers Need Load Balancing and How It Works

This article explains why load balancing is crucial for RocketMQ producers, details the internal selection algorithm using ThreadLocal indexes and round‑robin logic, and provides Java code examples illustrating how messages are distributed across queues.

JavaMessage QueueProducer
0 likes · 5 min read
Why RocketMQ Producers Need Load Balancing and How It Works
IT Services Circle
IT Services Circle
Nov 7, 2023 · Backend Development

Understanding ThreadLocal Memory Leaks and How to Prevent Them

This article explains the internal structure of ThreadLocal, identifies scenarios where ThreadLocal can cause memory leaks—especially in thread‑pool environments—analyzes the root causes, and provides practical techniques such as using remove() and expungeStaleEntry() to avoid these leaks.

Garbage CollectionJavaThreadLocal
0 likes · 11 min read
Understanding ThreadLocal Memory Leaks and How to Prevent Them
Sohu Tech Products
Sohu Tech Products
Oct 25, 2023 · Backend Development

Deep Analysis of Netty FastThreadLocal: From Production Issue to Source Code Implementation

The article traces a production bug where unreleased JDK ThreadLocal data corrupted user info, then compares JDK ThreadLocal with Netty’s FastThreadLocal, detailing their source‑code implementations, performance trade‑offs (O(n) vs O(1) access), memory‑leak risks, and recommends explicit remove() calls to avoid leaks.

Backend DevelopmentFastThreadLocalJava
0 likes · 15 min read
Deep Analysis of Netty FastThreadLocal: From Production Issue to Source Code Implementation
vivo Internet Technology
vivo Internet Technology
Oct 18, 2023 · Backend Development

Understanding JDK ThreadLocal and Netty FastThreadLocal: Implementation, Advantages, and Best Practices

The article compares JDK ThreadLocal and Netty FastThreadLocal, detailing their implementations, performance trade‑offs, and memory‑leak risks, illustrates a real‑world HTTPS bug caused by missing remove() calls, and recommends always cleaning up ThreadLocal values while noting FastThreadLocal’s O(1) access may not always outperform the JDK version.

FastThreadLocalJavaMemoryLeak
0 likes · 17 min read
Understanding JDK ThreadLocal and Netty FastThreadLocal: Implementation, Advantages, and Best Practices
Spring Full-Stack Practical Cases
Spring Full-Stack Practical Cases
Oct 15, 2023 · Backend Development

How SpringBoot Injects HttpServletRequest via ThreadLocal: A Deep Dive

This article explores how SpringBoot 2.6.12 injects HttpServletRequest into controllers using JDK dynamic proxies and ThreadLocal, detailing the underlying ObjectFactoryDelegatingInvocationHandler, RequestObjectFactory, RequestContextHolder, and DispatcherServlet processing flow with code examples and explains why injecting HttpServletRequest and HttpServletResponse in a controller is safe.

DispatcherServletHttpServletRequestJava
0 likes · 7 min read
How SpringBoot Injects HttpServletRequest via ThreadLocal: A Deep Dive
Spring Full-Stack Practical Cases
Spring Full-Stack Practical Cases
Oct 8, 2023 · Backend Development

Spring Transaction Deep Dive: Thread‑Bound Connections and Multithreaded Consistency

This article explains Spring's transaction core, showing how TransactionInterceptor and TransactionAspectSupport use AOP to bind a Connection to ThreadLocal, walks through key code snippets for creating, committing, and rolling back transactions, and demonstrates a JUC‑based solution for maintaining transaction consistency across multiple threads.

JavaJdbcTemplateThreadLocal
0 likes · 9 min read
Spring Transaction Deep Dive: Thread‑Bound Connections and Multithreaded Consistency
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
Selected Java Interview Questions
Selected Java Interview Questions
Aug 31, 2023 · Backend Development

How to Solve SimpleDateFormat Thread Safety Issues in High-Concurrency Scenarios

This article presents several common solutions for addressing the thread‑safety problem of Java's SimpleDateFormat in high‑concurrency environments, including using local variables, synchronized blocks, Lock, ThreadLocal, Java 8 DateTimeFormatter, and Joda‑Time, and evaluates their performance and suitability.

DateTimeFormatterJavaSimpleDateFormat
0 likes · 17 min read
How to Solve SimpleDateFormat Thread Safety Issues in High-Concurrency Scenarios
政采云技术
政采云技术
Aug 31, 2023 · Backend Development

Understanding Java ThreadLocal: Principles, Implementation, and Best Practices

ThreadLocal provides each Java thread with its own isolated variable copy, and this article explains its underlying mechanism, core methods (set, get, remove), internal ThreadLocalMap structure, practical code examples, common usage scenarios, and important considerations such as memory leaks and proper cleanup.

BackendJavaMemoryLeak
0 likes · 12 min read
Understanding Java ThreadLocal: Principles, Implementation, and Best Practices
Su San Talks Tech
Su San Talks Tech
Aug 24, 2023 · Backend Development

Simplify JWT Token Handling in Spring Using Custom Annotations & ThreadLocal

This article walks through the evolution of a Spring‑based JWT token validation solution, from passing HttpServletRequest into service methods to using a custom @NeedToken annotation, reflection, a base class, and finally ThreadLocal to ensure each request’s token is safely isolated in high‑concurrency environments.

JWTJavaThreadLocal
0 likes · 13 min read
Simplify JWT Token Handling in Spring Using Custom Annotations & ThreadLocal
FunTester
FunTester
Aug 2, 2023 · Backend Development

Practical Use of Java ThreadLocal for Thread‑Safe Variable Storage and Real‑World Scenarios

This article explains the Java ThreadLocal class, demonstrates how it provides per‑thread variable isolation to avoid concurrency issues, and shares two real‑world scenarios—including a utility class and a Spring Boot case—showing how ThreadLocal can simplify thread‑local state management while warning about potential memory leaks.

JavaThreadLocalconcurrency
0 likes · 9 min read
Practical Use of Java ThreadLocal for Thread‑Safe Variable Storage and Real‑World Scenarios
Cognitive Technology Team
Cognitive Technology Team
Jun 11, 2023 · Backend Development

Unified Handling of ThreadLocal Issues in Java Projects

This article explains why ThreadLocal can cause information loss, corruption, or OOM in Java applications and presents two practical approaches—Java agent bytecode manipulation and proxy‑based thread‑pool wrappers—along with concrete Spring Sleuth implementations and testing results to ensure safe propagation and cleanup.

JavaThreadLocalThreadPool
0 likes · 5 min read
Unified Handling of ThreadLocal Issues in Java Projects
360 Quality & Efficiency
360 Quality & Efficiency
May 19, 2023 · Backend Development

Resolving SimpleDateFormat Thread Safety Issues with ThreadLocal in Java

This article explains why Java's SimpleDateFormat is not thread‑safe, demonstrates the concurrency problem with a multithreaded demo, and presents three solutions—creating new instances, synchronizing access, and using ThreadLocal—highlighting the ThreadLocal approach with code examples and discussion of potential memory‑leak considerations.

SimpleDateFormatThreadLocalconcurrency
0 likes · 4 min read
Resolving SimpleDateFormat Thread Safety Issues with ThreadLocal in Java
Meituan Technology Team
Meituan Technology Team
Apr 20, 2023 · Backend Development

Analyzing TraceId Loss in Spring @Async and Distributed Tracing Solutions

The article investigates a missing TraceId in a Spring @Async call, analyzes the underlying design of MTrace and Google Dapper, examines ThreadLocal propagation mechanisms, identifies SimpleAsyncTaskExecutor as the root cause, and presents a custom thread‑pool solution while comparing alternative distributed tracing systems.

Distributed TracingJavaMTrace
0 likes · 28 min read
Analyzing TraceId Loss in Spring @Async and Distributed Tracing Solutions
dbaplus Community
dbaplus Community
Feb 7, 2023 · Backend Development

How We Cut Log4j2 Disk and CPU Usage by 90% in a High‑Traffic Shopping Cart

Facing massive log volume in JD.com’s shopping cart service, we reduced disk consumption, CPU load, and improved request latency by applying Log4j2 log level filtering, asynchronous logging with AsyncLogger, and TTL‑based thread‑local context propagation, while providing detailed metrics, configuration steps, and best‑practice recommendations.

Performance OptimizationTTLThreadLocal
0 likes · 14 min read
How We Cut Log4j2 Disk and CPU Usage by 90% in a High‑Traffic Shopping Cart
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
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.

AsynchronousBackendJava
0 likes · 13 min read
Elegant Methods for Passing Data Between Parent and Child Threads in Spring Boot
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
Top Architect
Top Architect
Nov 24, 2022 · Backend Development

Using SLF4J MDC to Correlate Logs Across Threads in Java

This article explains how to use SLF4J's MDC feature to attach a request ID to log entries, demonstrates the limitation of MDC in asynchronous threads, and provides a decorator‑based solution (MDCRunnable) that propagates the context to child threads and thread pools.

JavaThreadLocalmdc
0 likes · 10 min read
Using SLF4J MDC to Correlate Logs Across Threads in Java
Code Ape Tech Column
Code Ape Tech Column
Nov 18, 2022 · Backend Development

Using SLF4J MDC to Correlate Logs Across Threads and Asynchronous Tasks in Java

This article explains how to use SLF4J's MDC to attach a request identifier to log entries, demonstrates the limitation of MDC in asynchronous threads, and provides a decorator‑pattern solution (MDCRunnable) that propagates the context, enabling reliable log correlation across threads in Java backend applications.

BackendDecoratorPatternJava
0 likes · 10 min read
Using SLF4J MDC to Correlate Logs Across Threads and Asynchronous Tasks in Java