Tag

AtomicLong

0 views collected around this technical thread.

Java Architect Essentials
Java Architect Essentials
Jun 5, 2025 · Fundamentals

Understanding CAS, LongAdder, and AtomicLong in Java for High‑Concurrency Counters

This article explains the principles, advantages, and drawbacks of CAS, LongAdder, and AtomicLong in Java, illustrating why Alibaba recommends LongAdder for high‑concurrency counter scenarios, how the ABA problem arises, and how AtomicStampedReference can mitigate it.

AtomicLongCASDistributedSystems
0 likes · 9 min read
Understanding CAS, LongAdder, and AtomicLong in Java for High‑Concurrency Counters
Java Captain
Java Captain
May 4, 2025 · Backend Development

Understanding Java Counter Implementations: AtomicLong vs LongAdder

This article explains the principles, advantages, and drawbacks of Java's AtomicLong and LongAdder counters, describes the CAS operation and its ABA problem, and analyzes why Alibaba recommends LongAdder for high‑concurrency, high‑availability scenarios in distributed systems.

AtomicLongCASDistributed Systems
0 likes · 7 min read
Understanding Java Counter Implementations: AtomicLong vs LongAdder
Java Tech Enthusiast
Java Tech Enthusiast
Apr 12, 2025 · Backend Development

Understanding AtomicLong vs LongAdder in Java Concurrency

In high‑concurrency Java applications, LongAdder—introduced in JDK 8 and using partitioned cells to reduce contention—generally outperforms the single‑value AtomicLong, which relies on CAS and can cause CPU waste under heavy load, so Alibaba advises LongAdder for scalable distributed counters, though memory usage and workload specifics must be considered.

AtomicLongBackendCAS
0 likes · 7 min read
Understanding AtomicLong vs LongAdder in Java Concurrency
Selected Java Interview Questions
Selected Java Interview Questions
Dec 11, 2022 · Backend Development

Understanding Spin Locks and Implementing a Reentrant Spin Lock in Java

This article explains the concept of spin locks, compares them with non‑spin locks, discusses their advantages and drawbacks, and provides Java code examples—including an AtomicLong implementation and a custom re‑entrant spin lock—to illustrate how spin locks work in concurrent programming.

AtomicLongJavaReentrant Lock
0 likes · 8 min read
Understanding Spin Locks and Implementing a Reentrant Spin Lock in Java
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Oct 18, 2021 · Fundamentals

Understanding Java LongAdder and Its Underlying Striped64 Implementation

This article explains why LongAdder was introduced to overcome AtomicLong's CAS contention bottleneck, explores the design of Striped64 and its cells, and walks through key source code snippets of LongAdder, DoubleAdder, and the longAccumulate method, highlighting concurrency mechanisms and performance considerations.

AtomicLongCASJava
0 likes · 13 min read
Understanding Java LongAdder and Its Underlying Striped64 Implementation