Tagged articles
ReadWriteLock
24 articles · Page 1 of 1
This article explains Java's ReadWriteLock and the newer StampedLock, compares their performance, shows practical code examples for read, write, optimistic reads, and lock conversion, and highlights important limitations such as lack of reentrancy and Condition support.
JavaReadWriteLockStampedLock
0 likes · 10 min read

This article explores Java’s advanced lock mechanisms—ReentrantLock, ReentrantReadWriteLock, StampedLock, and Semaphore—detailing their core features, practical code examples, and ideal usage scenarios, helping developers decide which synchronization tool best fits their performance and concurrency requirements.
ConcurrencyJavaLocks
0 likes · 9 min read

This article explains Java 8's built‑in lock mechanisms—including synchronized, ReentrantLock, ReadWriteLock, and StampedLock—detailing their characteristics, advanced features, and practical usage through inventory, banking, and order‑processing examples with complete code demonstrations.
ConcurrencyConditionJava
0 likes · 22 min read

This comprehensive guide explores Java multithreading fundamentals, covering thread creation, lifecycle, synchronization challenges, context switching costs, deadlock detection, various lock mechanisms such as synchronized, ReentrantLock, ReadWriteLock, and the underlying AbstractQueuedSynchronizer architecture with practical code examples and performance tips.
AQSConcurrencyCondition
0 likes · 42 min read

This article explains the concepts, key features, internal implementation, and practical usage of Java's ReentrantReadWriteLock, illustrating how read and write locks interact, how fairness and lock downgrading work, and provides a complete code example with multithreaded readers and writers.
ConcurrencyJUCJava
0 likes · 12 min read

This article explains the read‑write lock separation design pattern, its principles, suitable scenarios such as high‑concurrency inventory queries, and provides a complete Java implementation with ReentrantReadWriteLock, including code samples, testing, performance benefits, and a discussion of its advantages and limitations.
BackendInventoryManagementJava
0 likes · 9 min read

This article dissects RocketMQ's concurrency mechanisms, explaining why it uses ReentrantReadWriteLock with HashMaps, how Semaphore controls async send rates, the SemaphoreReleaseOnlyOnce wrapper, the CountDownLatch‑based sync‑to‑async pattern, and the CompletableFuture redesign that reduces blocking in message replication.
CompletableFutureConcurrencyDistributed Messaging
0 likes · 10 min read

This article provides a comprehensive guide to Java locking mechanisms, covering ReentrantLock, synchronized, ReadWriteLock, and spin locks, with detailed code examples, performance considerations, common use cases, and best practices to ensure thread safety, avoid deadlocks, and optimize concurrency in multithreaded applications.
ConcurrencyJavaLocks
0 likes · 17 min read

This article explains thread safety in Java by detailing how the synchronized keyword and various Lock implementations work, covering their underlying JVM mechanisms, lock upgrade paths, optimizations like biased and lightweight locks, and practical differences between synchronized, ReentrantLock, and ReadWriteLock.
ConcurrencyJVMJava
0 likes · 19 min read

This article explains Java thread‑safety concepts, the synchronized keyword, its underlying monitor implementation, lock‑upgrade stages, JVM optimizations such as lock elimination and coarsening, and compares explicit Lock interfaces like ReentrantLock and ReadWriteLock, helping developers choose the appropriate synchronization tool.
JVMLockReadWriteLock
0 likes · 16 min read

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

This article explains the principles of Java's ReentrantReadWriteLock, details lock downgrade and upgrade mechanisms, provides a full source analysis of read and write lock implementations, and presents a custom upgradable lock with test code and performance observations.
ConcurrencyJavaLockUpgrade
0 likes · 22 min read

This article explains how Eureka Server receives and stores service registration requests by examining the relevant source code, highlighting the use of Jersey for HTTP handling, ConcurrentHashMap for registration storage, and ReentrantReadWriteLock for fine‑grained concurrency control.
ConcurrentHashMapEurekaJava
0 likes · 8 min read

This article explains how Java's ReentrantReadWriteLock provides read‑write separation, allowing concurrent reads while enforcing exclusive access for writes, and demonstrates its behavior with sample code and thread‑execution results that illustrate read‑read sharing, read‑write mutual exclusion, and write‑write mutual exclusion.
JavaReadWriteLockReentrantReadWriteLock
0 likes · 5 min read


JavaEdgeMay 5, 2021 · Backend Development
This article explains how Java's ReadWriteLock works, compares it with mutex locks, shows caching strategies for high‑concurrency scenarios, illustrates thread‑contention problems, and discusses lock upgrade and downgrade nuances to help developers write safe, performant backend code.
BackendJavaReadWriteLock
0 likes · 6 min read

This article explains how to build a distributed read‑write lock using MySQL tables and transactions, covering the business scenario, lock table design, detailed SQL procedures for write and read operations, logging, dead‑lock handling, and a cleanup job.
DatabaseConcurrencyDistributedLockLockTable
0 likes · 13 min read

This article explains Java's ReentrantReadWriteLock, covering the motivation for read‑write locks, their properties, a simple implementation example, lock upgrade and downgrade mechanisms, the internal AQS‑based design, fairness modes, and the roles of ReadLock and WriteLock classes.
JavaReadWriteLockReentrantReadWriteLock
0 likes · 10 min read

This article explains the evolution and implementation of Java's JVM‑level locks—including synchronized, ReentrantLock, ReentrantReadWriteLock, and LongAdder—detailing their lock‑upgrade process, internal object layout, AQS‑based algorithms, and how they improve concurrency and performance in multithreaded applications.
LocksLongAdderReadWriteLock
0 likes · 24 min read

This article provides a comprehensive overview of Java concurrency locks, covering classifications such as optimistic, pessimistic, fair, unfair, reentrant, exclusive/shared, spin, and segmented locks, as well as detailed explanations of synchronized, ReentrantLock, and ReadWriteLock usage with code examples.
JavaLocksReadWriteLock
0 likes · 21 min read

This article provides a comprehensive overview of various Java lock mechanisms—including fair, non‑fair, reentrant, read/write, biased, lightweight, heavyweight, and spin locks—explaining their classifications, usage, underlying AQS implementation, and includes illustrative code snippets for each type.
AQSConcurrencyJava
0 likes · 22 min read

The article explains Java’s various lock mechanisms—including optimistic vs. pessimistic, spin and adaptive spin, no‑lock through heavyweight states, fair vs. unfair, reentrant vs. non‑reentrant, and exclusive vs. shared locks—using JDK 8 source code and practical examples to guide developers in choosing the appropriate lock for different concurrency scenarios.
CASConcurrencyJava
0 likes · 26 min read

This article explains why read‑write locks are needed, presents a simple Java implementation, and dives into the inner workings of ReentrantReadWriteLock, covering state encoding, acquisition and release algorithms, lock downgrading, and fairness policies.
AQSJavaLock
0 likes · 18 min read

This article explains the structure, features, and internal workings of Java's ReentrantReadWriteLock, compares it with ReentrantLock and synchronized, provides usage examples, analyzes state management with bitwise operations, and covers lock acquisition, release, downgrade, and the role of LockSupport.
ConcurrencyJavaLockSupport
0 likes · 10 min read

This article demonstrates how to use Java's ReentrantLock, Condition, and ReentrantReadWriteLock classes to implement synchronization, waiting/notification, producer‑consumer patterns, and read‑write locking, providing code examples, execution results, and tips for avoiding deadlocks and improving thread coordination.
ConditionReadWriteLockReentrantLock
0 likes · 17 min read
