Tagged articles
19 articles
Page 1 of 1
Su San Talks Tech
Su San Talks Tech
Apr 22, 2025 · Backend Development

Avoid Date Bugs: Thread‑Safe Formatting and Time‑Zone Mastery in Java

This article explores common pitfalls in Java date handling—such as non‑thread‑safe formatting and daylight‑saving‑time errors—and presents robust solutions using ThreadLocal, the Java 8 Date/Time API, zone‑aware calculations, caching, and global interceptor patterns to ensure correct, high‑performance time processing in backend systems.

BackendDate FormattingJava 8
0 likes · 7 min read
Avoid Date Bugs: Thread‑Safe Formatting and Time‑Zone Mastery in Java
FunTester
FunTester
Dec 26, 2024 · Fundamentals

Chapter 2 – Common Java Multithreading Utilities and the synchronized Keyword

This chapter introduces advanced Java multithreading concepts, explaining thread safety, the synchronized keyword, various synchronization techniques, and practical code examples such as object‑level, class‑level, method‑level synchronization and double‑checked locking to help solve concurrency problems in performance testing.

JavaSynchronizationconcurrency
0 likes · 15 min read
Chapter 2 – Common Java Multithreading Utilities and the synchronized Keyword
Cognitive Technology Team
Cognitive Technology Team
Jun 8, 2024 · Fundamentals

Why ConcurrentHashMap Disallows Null Keys and Values in Java

ConcurrentHashMap forbids null keys and values because allowing nulls creates ambiguous results in concurrent environments, making it impossible to distinguish between a missing entry and an entry explicitly mapped to null, which could compromise thread safety, as explained by Doug Lea’s design rationale.

ConcurrentHashMapJavaNULL
0 likes · 4 min read
Why ConcurrentHashMap Disallows Null Keys and Values in Java
FunTester
FunTester
Aug 7, 2023 · Backend Development

Atomic Operation Pitfalls in Java Performance Testing and How to Fix Them

This article describes a Java performance‑testing script that uses concurrent user initialization, explains how overlooking atomicity in thread‑safe classes caused some users to miss initialization, and presents three practical solutions such as improving stop logic, tracking completed users, and using concurrent collections.

atomicitymultithreadingperformance-testing
0 likes · 7 min read
Atomic Operation Pitfalls in Java Performance Testing and How to Fix Them
Sanyou's Java Diary
Sanyou's Java Diary
Apr 15, 2022 · Backend Development

Why Use Read‑Write Locks When Java Already Offers Thread‑Safe Collections?

This article examines the internal workings of Java's CopyOnWriteArrayList, explains why its weak consistency still necessitates read‑write locks in read‑heavy scenarios, and compares exclusive locks with read‑write locks to achieve strong data consistency without sacrificing performance.

CopyOnWriteArrayListJavaReadWriteLock
0 likes · 11 min read
Why Use Read‑Write Locks When Java Already Offers Thread‑Safe Collections?
FunTester
FunTester
Mar 30, 2021 · Operations

Performance Testing Error Analysis: Locking Resources, Local Machine Limits, Parsing Errors, Exception Handling, and Asynchronous Completion

This article examines common sources of performance‑testing errors—including hidden locking‑resource issues, inadequate local machine configuration, inefficient regex‑based data extraction, costly exception handling, and unsynchronized thread termination—while offering practical Java‑centric mitigation strategies.

error-analysisload-testingperformance-testing
0 likes · 7 min read
Performance Testing Error Analysis: Locking Resources, Local Machine Limits, Parsing Errors, Exception Handling, and Asynchronous Completion
Selected Java Interview Questions
Selected Java Interview Questions
Oct 14, 2020 · Fundamentals

Understanding Java synchronized: Code Block Lock, Method Lock, and Thread Safety

This article explains Java's synchronized keyword, demonstrating both synchronized code block locks and method locks with complete code examples, analyzing execution results, and discussing memory-level locking, thread safety, performance drawbacks, and best practices for using synchronized in concurrent programming.

Code ExampleJavaSynchronization
0 likes · 8 min read
Understanding Java synchronized: Code Block Lock, Method Lock, and Thread Safety
Top Architect
Top Architect
Sep 4, 2020 · Fundamentals

Understanding the volatile Keyword and Thread Synchronization in Java

This article explains how the volatile keyword ensures visibility of shared variables across threads, illustrates its behavior with examples and code, discusses its limitations regarding atomicity, and presents solutions using synchronized blocks or atomic classes for proper thread synchronization in Java.

JavaSynchronizationatomic
0 likes · 8 min read
Understanding the volatile Keyword and Thread Synchronization in Java
macrozheng
macrozheng
Aug 13, 2020 · Backend Development

Why JDK 8’s computeIfAbsent Can Deadlock: A Deep Dive into the Bug

This article explores a JDK 8 bug in ConcurrentHashMap’s computeIfAbsent method that can cause an infinite loop, explains how the issue was discovered, reproduces it with test code, analyzes the root cause, and shows the fix introduced in JDK 9.

ConcurrentHashMapJDKbug
0 likes · 16 min read
Why JDK 8’s computeIfAbsent Can Deadlock: A Deep Dive into the Bug
Programmer DD
Programmer DD
Aug 25, 2019 · Backend Development

Why SimpleDateFormat Fails in Multithreaded Java and How to Fix It

This article explains why Java's SimpleDateFormat is not thread‑safe, demonstrates the problem with multithreaded examples, and presents two robust solutions—using ThreadLocal or the Java 8 immutable date‑time API—to ensure correct date formatting in concurrent environments.

SimpleDateFormatdate-time-apijava-8
0 likes · 6 min read
Why SimpleDateFormat Fails in Multithreaded Java and How to Fix It
FunTester
FunTester
Jul 22, 2019 · Fundamentals

Why a Simple Increment Isn’t Thread‑Safe: A Java Concurrency Demo

This article explains atomicity, thread safety, and race conditions in Java by showing how a volatile counter increment can produce nondeterministic results when accessed concurrently, complete with sample code and console output analysis.

atomicityconcurrencyexample
0 likes · 4 min read
Why a Simple Increment Isn’t Thread‑Safe: A Java Concurrency Demo
Java Captain
Java Captain
Mar 14, 2019 · Backend Development

Why Combining synchronized with @Transactional Causes Thread‑Safety Issues in Spring and How to Resolve Them

The article explains why using the synchronized keyword together with Spring's @Transactional annotation can lead to lost updates when many threads increment a database field, analyzes the underlying transaction‑proxy interaction, and presents a refactored solution that moves the lock to a separate service to ensure correct results.

Javaconcurrencyspring
0 likes · 7 min read
Why Combining synchronized with @Transactional Causes Thread‑Safety Issues in Spring and How to Resolve Them
Java Captain
Java Captain
Nov 21, 2017 · Fundamentals

Understanding the final Keyword in Java: Variables, Methods, and Classes

This article explains Java's final keyword, covering its use with classes, methods, and variables, demonstrates how to declare final members, shows code examples of final variables, methods, and classes, and discusses the performance, thread‑safety, and immutability benefits of using final in Java applications.

finalkeywordthread-safety
0 likes · 7 min read
Understanding the final Keyword in Java: Variables, Methods, and Classes
Qunar Tech Salon
Qunar Tech Salon
Apr 5, 2015 · Backend Development

Implementing Java Event Notification with the Observer Pattern: Common Pitfalls and Thread‑Safe Solutions

This article explains how to build a Java event‑notification system using the observer pattern, highlights typical mistakes such as concurrent modification and deadlocks, and presents several thread‑safe implementations ranging from synchronized blocks to CopyOnWriteArraySet and atomic primitives.

Observer PatternSynchronizationconcurrency
0 likes · 10 min read
Implementing Java Event Notification with the Observer Pattern: Common Pitfalls and Thread‑Safe Solutions
Qunar Tech Salon
Qunar Tech Salon
Dec 10, 2014 · Fundamentals

Why Immutable Objects Matter in Java and Object‑Oriented Design

The article explains the concept of immutable objects in object‑oriented programming, uses Java’s String and Date classes as examples, lists benefits such as thread safety, reduced coupling and side‑effects, and discusses counter‑arguments and practical considerations for adopting immutability.

DesignJavaObject-Oriented
0 likes · 8 min read
Why Immutable Objects Matter in Java and Object‑Oriented Design