Tagged articles
3 articles
Page 1 of 1
Selected Java Interview Questions
Selected Java Interview Questions
Jan 3, 2022 · Fundamentals

Understanding AtomicInteger: Optimistic Locking and CAS in Java

AtomicInteger provides a thread‑safe, lock‑free counter in Java by employing optimistic locking and CAS operations, offering higher efficiency than synchronized blocks; the article explains its motivation, usage examples, underlying Unsafe mechanisms, volatile semantics, and key methods such as incrementAndGet and compareAndSet.

AtomicIntegerCASJava
0 likes · 7 min read
Understanding AtomicInteger: Optimistic Locking and CAS in Java
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Sep 22, 2020 · Backend Development

Understanding AtomicInteger, CAS, and Lock‑Free Concurrency in Java

This article explains how Java's AtomicInteger and related atomic classes provide lock‑free thread‑safe operations to replace non‑atomic constructs like i++, detailing their inheritance, underlying Unsafe mechanisms, CAS implementation, memory barriers, optimistic locking, the ABA problem, and practical code examples for increment, decrement, and custom CAS‑based locks.

AtomicIntegerCASJava
0 likes · 15 min read
Understanding AtomicInteger, CAS, and Lock‑Free Concurrency in Java
Programmer DD
Programmer DD
May 19, 2018 · Backend Development

Build a Flash‑Sale System with Optimistic Locking, Redis Limiting, and Kafka

This article walks through the step‑by‑step implementation of a high‑throughput flash‑sale (seckill) service in Java, covering request flow, database schema, optimistic‑locking updates, Redis‑based rate limiting, CI scripts, and optional Kafka asynchronous order processing to achieve fast, reliable, and scalable sales handling.

JavaMicroservicesOptimisticLocking
0 likes · 18 min read
Build a Flash‑Sale System with Optimistic Locking, Redis Limiting, and Kafka