Tagged articles

ThreadLocal

211 articles · Page 3 of 3
Java Backend Technology
Java Backend Technology
Mar 19, 2019 · Backend Development

Why SimpleDateFormat Is Not Thread‑Safe and How to Fix It in Java

This article explains why Java's SimpleDateFormat is not thread‑safe, demonstrates the problems caused by using a static instance in multithreaded code, and presents four practical solutions—including synchronized blocks, ThreadLocal, and the modern DateTimeFormatter—to ensure correct date handling.

DateTimeFormatterJavaSimpleDateFormat
0 likes · 5 min read
Why SimpleDateFormat Is Not Thread‑Safe and How to Fix It in Java
Programmer DD
Programmer DD
Nov 13, 2018 · Backend Development

How to Detect and Prevent Java Memory Leaks: Real‑World Examples and Fixes

This tutorial explains what Java memory leaks are, why they occur, and how to identify them at runtime, covering common leak sources such as static fields, unclosed resources, faulty equals/hashCode implementations, inner classes, finalize methods, string interning, and ThreadLocal misuse, plus practical prevention techniques and profiling tools.

Garbage CollectionJavaProfiling
0 likes · 15 min read
How to Detect and Prevent Java Memory Leaks: Real‑World Examples and Fixes
转转QA
转转QA
Sep 20, 2018 · Backend Development

Implementing Dynamic RPC Service Invocation in a Commercial Testing Platform

The article describes how a commercial testing platform faced three limitations with its RPC client, analyzes Java class‑loading, dynamic proxy, and ThreadLocal concepts, and presents two implementation approaches—one using dynamic proxies and another leveraging ThreadLocal—to enable dynamic loading of multiple rpc.config files without restarting the service.

Dynamic ProxyRPCThreadLocal
0 likes · 6 min read
Implementing Dynamic RPC Service Invocation in a Commercial Testing Platform
Java Backend Technology
Java Backend Technology
Oct 24, 2017 · Fundamentals

ThreadLocal OOM? Exploring Singleton Pitfalls in Java Multithreading

This article examines common Java singleton implementations—including eager, thread‑safe lazy, double‑checked locking, and static inner‑class approaches—explaining their requirements, potential memory‑leak pitfalls such as ThreadLocal‑induced OOM, and how improper usage in multithreaded environments can lead to unexpected instance creation and performance issues.

JavaOOMSingleton
0 likes · 6 min read
ThreadLocal OOM? Exploring Singleton Pitfalls in Java Multithreading
Java Backend Technology
Java Backend Technology
Sep 27, 2017 · Fundamentals

Unlocking ThreadLocal: How Java Gives Each Thread Its Own Variable

This article explains the purpose of Java's ThreadLocal class, shows a practical example with code and output images, compares it to synchronized locking, and demonstrates how ThreadLocal provides each thread with an independent variable copy for safe concurrent access.

JavaProgramming FundamentalsSynchronization
0 likes · 3 min read
Unlocking ThreadLocal: How Java Gives Each Thread Its Own Variable
Java Captain
Java Captain
Jul 24, 2017 · Fundamentals

Lesser‑Known Java Thread Techniques and Usage

This article explores five advanced Java thread topics—including naming, priority, ThreadLocal storage, daemon vs. user threads, and processor affinity—providing code examples, practical tips, and guidance for both beginners and seasoned developers.

DaemonThreadProcessorAffinityThreadLocal
0 likes · 12 min read
Lesser‑Known Java Thread Techniques and Usage
Qunar Tech Salon
Qunar Tech Salon
Apr 6, 2015 · Fundamentals

How to Write Java Code That Causes a Memory Leak

Various techniques for deliberately creating memory leaks in Java are presented, including using long‑running threads with custom class loaders, static references, ThreadLocal misuse, improper handling of resources like connections and streams, and flawed implementations of hashCode/equals, each illustrated with code examples.

JavaStatic ReferenceThreadLocal
0 likes · 6 min read
How to Write Java Code That Causes a Memory Leak