Tagged articles
5 articles
Page 1 of 1
Programmer DD
Programmer DD
Oct 24, 2021 · Fundamentals

Why Adding or Removing Elements Inside a Java foreach Loop Fails

This article explains why modifying a collection during a Java foreach loop triggers a ConcurrentModificationException, explores the underlying fail‑fast mechanism in ArrayList, and demonstrates safe alternatives such as using an Iterator's remove method or a CopyOnWriteArrayList.

ArrayListConcurrentModificationExceptionIterator
0 likes · 9 min read
Why Adding or Removing Elements Inside a Java foreach Loop Fails
Selected Java Interview Questions
Selected Java Interview Questions
Sep 30, 2021 · Fundamentals

Understanding the Role of modCount in Java HashMap's Fail‑Fast Mechanism

The article clarifies that the modCount field in java.util.HashMap is used to implement the fail‑fast iterator behavior, explains why the field was volatile in early JDK versions but not in later ones, and shows that ConcurrentModificationException can be thrown even in single‑threaded scenarios when the iterator detects structural changes.

ConcurrentModificationExceptionHashMapJDK
0 likes · 5 min read
Understanding the Role of modCount in Java HashMap's Fail‑Fast Mechanism
ITFLY8 Architecture Home
ITFLY8 Architecture Home
May 5, 2018 · Backend Development

How Dazhong Dianping Scaled Its Payment Gateway: Backend Architecture and Fail‑Fast Lessons

Facing rapid business growth, Dazhong Dianping’s payment gateway evolved through usable, flexible, and highly available stages, employing service splitting, master‑slave databases, fail‑fast mechanisms, and comprehensive monitoring to achieve 99.99% availability and handle peak traffic during major sales events.

BackendPayment GatewayScalability
0 likes · 14 min read
How Dazhong Dianping Scaled Its Payment Gateway: Backend Architecture and Fail‑Fast Lessons