Tagged articles
ReentrantLock
81 articles · Page 1 of 1
This article explains five Java thread communication methods—volatile flag, Object wait/notify, CountDownLatch, ReentrantLock with Condition, and LockSupport—with runnable code examples showing how each coordinates a producer thread adding items and a consumer thread triggered at the fifth addition.
ConcurrencyCountDownLatchJava
0 likes · 10 min read

This article demonstrates the evolution from synchronized/wait/notify to Lock/Condition for producer-consumer patterns, showing how notifyAll causes spurious wakeups with multiple threads and how Condition enables precise signaling via separate condition queues for producers and consumers.
ConcurrencyConditionJava
0 likes · 14 min read

This article explains Java's AbstractQueuedSynchronizer (AQS) core model using a service counter analogy, detailing how the state variable and CLH queue manage thread synchronization, the template method pattern separating queuing logic from acquisition rules, and how LockSupport.park/unpark enable efficient thread blocking and waking, illustrated with ReentrantLock and CountDownLatch examples.
AQSAbstractQueuedSynchronizerCLH Queue
0 likes · 7 min read

This article compares Java's synchronized keyword with the Lock interface (ReentrantLock), demonstrating how Lock provides finer-grained control through timeout acquisition (tryLock), interruptible locking (lockInterruptibly), fair/non-fair policies, and manual unlock in finally blocks, with code examples for each scenario.
ConcurrencyFair LockJava
0 likes · 9 min read

This article explains Java Semaphore's core decoupling property—where any thread can acquire or release permits—contrasting it with ReentrantLock's thread-owned locking, demonstrates with Java 17 code examples, and shows real-world rate-limiting applications in Sentinel, Dubbo, and Tomcat.
ConcurrencyDecouplingJava
0 likes · 8 min read

This article explains thread starvation in Java concurrency, demonstrates it with a code example showing unfair lock acquisition and cumulative wait times, and provides two solutions: moving slow operations outside synchronized blocks and using ReentrantLock tryLock with timeout to bound waiting.
Java ConcurrencyPerformance OptimizationReentrantLock
0 likes · 10 min read

This article provides a comprehensive source-code level comparison of Java's ReentrantLock and synchronized, covering their underlying implementations (JVM monitor vs AQS/CLH), lock upgrade mechanisms, fairness, interruptibility, timeout support, condition variables, and performance characteristics across JDK versions to guide practical selection.
AQSCLH QueueJVM Internals
0 likes · 21 min read

This article provides a comprehensive source-code-level analysis of Java's AbstractQueuedSynchronizer (AQS), detailing its three core components—state, CLH wait queue, and ConditionObject—and walking through exclusive lock acquisition/release, fair vs non-fair locking, shared lock propagation, and condition variable await/signal mechanics with code examples.
AQSCLH QueueJava Concurrency
0 likes · 37 min read

This article provides a line-by-line analysis of Java's AbstractQueuedSynchronizer (AQS), covering its CLH variant queue, CAS-based state management, exclusive and shared synchronization modes, Condition implementation, and core design decisions like CLH vs MCS and volatile vs synchronized.
AQSCASCLH Queue
0 likes · 22 min read


DabaoshiAug 16, 2026 · Backend Development
This article dissects Java’s AbstractQueuedSynchronizer (AQS), explaining its three core components—volatile state, CAS, and a FIFO wait queue—how exclusive and shared modes operate, the step‑by‑step lock acquisition flow, ReentrantLock implementation details, fairness trade‑offs, and the underlying template‑method design pattern.
AQSConcurrencyJava
0 likes · 15 min read

This article enumerates thirteen frequent Java mistakes—from returning null and misusing string concatenation to improper synchronization and lock handling—showing the flawed code, explaining why it is problematic, and providing concise, correct alternatives with runnable examples.
ConcurrentModificationExceptionJavaJava21
0 likes · 14 min read

This article thoroughly compares Java's synchronized keyword with ReentrantLock, explains lock implementation details, fairness, interruptibility, timeout, and Condition usage, provides practical code examples and interview tips, and offers guidance on when to choose each synchronization mechanism.
AQSConcurrencyCondition
0 likes · 8 min read

This article provides a self‑test for interview preparation, presenting twelve common interview questions and detailed answers on an e‑commerce concurrency case, covering serial vs async performance, CompletableFuture.allOf, ConcurrentHashMap.compute atomicity, layered cache design, Semaphore rate limiting, ReentrantLock fairness, AtomicInteger CAS, exceptional fallback, double‑layer protection, concurrency safety testing, thread‑pool configuration, and precise cache invalidation.
CacheCompletableFutureConcurrency
0 likes · 21 min read

The article breaks down a common Netease interview task—hand‑coding a BlockingQueue in five minutes—by explaining the underlying lock‑and‑condition mechanism, the relevant design patterns and principles, common pitfalls such as spurious wakeups, and provides a concise, 50‑line Java implementation with step‑by‑step commentary.
BlockingQueueDesign PatternsJava Concurrency
0 likes · 20 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 examines the core differences between Java's synchronized keyword and the Lock interface, covering their principles, performance, flexibility, visibility guarantees, reentrancy, interruption handling, and practical selection guidelines with code examples, tables, and real‑world scenarios to help developers choose the appropriate locking mechanism.
JavaLockReentrantLock
0 likes · 9 min read

In ultra‑high‑concurrency scenarios, synchronized becomes a bottleneck, while ReentrantLock can boost QPS by about 30% thanks to its active AQS state management, avoidance of biased‑lock revocation, more flexible spinning, and richer APIs, and the article outlines when to choose each.
AQSJava ConcurrencyReentrantLock
0 likes · 7 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 article explains the classification of Java locks—including pessimistic, optimistic, fair, and unfair variants—details their state transitions from biased to heavyweight, and walks through the source code of ReentrantLock and Condition to illustrate how synchronization, queuing, and thread parking are implemented in the JVM.
AQSConcurrencyCondition
0 likes · 20 min read

This article dissects Java’s ReentrantLock implementation, detailing its delegation to AbstractQueuedSynchronizer, the lock acquisition process, the role of non‑fair and fair sync subclasses, the internal CLH queue mechanics, and how unlocking is handled, while comparing Lock with synchronized.
AbstractQueuedSynchronizerConcurrencyJava
0 likes · 14 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 core concepts of Java's AbstractQueuedSynchronizer (AQS), covering semaphore vs. monitor, lock acquisition and release mechanisms, the internal FIFO queue, code examples of ReentrantLock and a custom mutex, and how AQS underpins many concurrency utilities.
AQSConcurrencyJava
0 likes · 28 min read

The article explains Java’s ReentrantLock implementation, contrasting fair locks that queue threads in request order with non‑fair locks that allow immediate acquisition, detailing the internal Sync, FairSync and NonfairSync classes, lock/unlock mechanisms, performance trade‑offs, and guidance on selecting the appropriate lock type.
AQSFair LockJUC
0 likes · 19 min read

This article compares Java's built‑in synchronized keyword with the explicit ReentrantLock class, covering their underlying implementations, performance differences across JDK versions, feature sets such as fairness and interruptibility, lock release mechanisms, and best‑fit scenarios for each approach.
JavaReentrantLocklocking
0 likes · 5 min read

This article explains what unfair locks are, why they can improve throughput compared to fair locks, provides a Java ReentrantLock example with code, describes the internal acquisition process, and outlines typical high‑concurrency scenarios where unfair locks are advantageous.
ConcurrencyJavaMultithreading
0 likes · 5 min read

Reentrant locks are thread‑safe synchronization tools that let the same thread acquire the same lock multiple times without deadlocking, tracking acquisition counts, and offering advantages over traditional synchronized blocks, with Java’s ReentrantLock providing flexible features such as interruptible and timed locking, illustrated by a complete code example.
ConcurrencyJavaReentrantLock
0 likes · 6 min read

This article explains the core concepts of Java’s AbstractQueuedSynchronizer (AQS), its exclusive and shared modes, the template‑method design it uses, and walks through the actual source code showing how ReentrantLock implements both fair and non‑fair locking, complete with diagrams and code snippets for interview preparation.
AQSConcurrencyJava
0 likes · 10 min read

This article explains the Java java.util.concurrent.locks.Lock interface and its ReentrantLock implementation, detailing the advantages of reentrancy, interruptibility, and timeout features, and provides practical code examples for blocking, interruptible, and timed lock acquisition along with best‑practice recommendations.
ConcurrencyLockMultithreading
0 likes · 12 min read

This article explains the concepts, creation methods, usage examples, and internal implementation details of fair and unfair locks in Java's ReentrantLock, comparing their performance characteristics and providing guidance on when to choose each type in multithreaded applications.
ConcurrencyFairLockJava
0 likes · 23 min read

This article demonstrates five Java thread‑communication approaches—using a volatile flag, Object.wait()/notify(), CountDownLatch, ReentrantLock with Condition, and LockSupport—each illustrated with complete code examples and explanations of their behavior and limitations.
ConcurrencyCountDownLatchJava
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 multithreading, introduces the ReentrantLock class from java.util.concurrent.locks, demonstrates blocking, interruptible, and timed lock usage with code examples, discusses best practices, fairness, reentrancy, and performance considerations for effective concurrency control.
ConcurrencyJavaReentrantLock
0 likes · 8 min read

This article explains five Java thread‑communication techniques—volatile variables, Object.wait()/notify(), CountDownLatch, ReentrantLock with Condition, and LockSupport—providing code examples and detailed explanations of how each method works and its synchronization behavior, including sample programs that add elements to a list, demonstrate notification timing, and show how locks are acquired and released.
ConcurrencyCountDownLatchJava
0 likes · 11 min read

This article compares five Java thread‑communication techniques—volatile flag, Object.wait()/notify(), CountDownLatch, ReentrantLock with Condition, and LockSupport—by presenting concrete code examples, explaining their underlying mechanisms, and discussing their advantages and drawbacks.
ConcurrencyCountDownLatchJava
0 likes · 13 min read

The article explains Java’s AbstractQueuedSynchronizer framework and how ReentrantLock uses its inner Sync classes—FairSync and NonfairSync—to manage lock acquisition via CAS, queueing, spinning, and parking, detailing the acquire/release loops, fair vs non‑fair behavior, and interview‑ready insights.
AQSJavaLock
0 likes · 12 min read

This article delves into the often‑overlooked locking mechanisms inside Java’s ThreadPoolExecutor, explaining the purpose of the mainLock ReentrantLock, the worker‑level lock, and how they prevent interrupt storms, ensure accurate statistics, and coordinate thread‑safe access to internal data structures.
ConcurrencyJavaLocks
0 likes · 14 min read

This article explains the design and implementation of Java’s AbstractQueuedSynchronizer (AQS), detailing its state management, CLH queue, Node structure, and how ReentrantLock (both fair and non‑fair) leverages AQS for lock acquisition and release, with concrete code examples and step‑by‑step analysis.
AQSCLH QueueJava Concurrency
0 likes · 18 min read

This article introduces Java's java.util.concurrent (J.U.C) package, explains its lock mechanisms—including Lock, ReentrantLock, ReentrantReadWriteLock, and Condition—provides detailed code examples, and discusses lock types such as fair, non‑fair, and read/write locks for effective multithreaded synchronization.
ConditionJUCJava
0 likes · 16 min read

This article explains the concept of thread synchronization in Java and provides detailed examples of four implementation methods—using the synchronized keyword, ReentrantLock, atomic variables, and ThreadLocal—along with code snippets and a comparison of their advantages and usage scenarios.
ReentrantLockThreadLocalatomic
0 likes · 6 min read

This article explains how Java's ReentrantLock works, detailing the role of the AbstractQueuedSynchronizer framework, the lock's internal architecture, the FIFO wait‑queue implementation, lock acquisition and release processes, and how these mechanisms avoid the herd effect in multithreaded environments.
AQSConcurrencyJava
0 likes · 11 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 how Java's synchronized keyword works at the JVM level, detailing monitorenter/monitorexit bytecode, the role of object monitors, differences between synchronized methods and blocks, and compares its behavior and performance with explicit Lock implementations such as ReentrantLock, including code examples and practical considerations.
ConcurrencyJVMJava
0 likes · 8 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 explains the principles of CAS, the ABA problem, and how Java's AbstractQueuedSynchronizer underpins ReentrantLock, comparing fair and non‑fair lock implementations, with code examples and discussion of their performance trade‑offs in.
AQSCASFair Lock
0 likes · 8 min read

This article explains the fundamentals of CAS (compare‑and‑swap), the ABA problem and its version‑stamp solution, introduces AbstractQueuedSynchronizer (AQS) as the core of Java concurrency utilities, and compares fair and non‑fair lock implementations in ReentrantLock with code examples and diagrams.
ABAAQSCAS
0 likes · 9 min read

The article explains Android’s user‑space locking hierarchy—from Java intrinsic and JUC locks to C++ std::mutex and pthread mutexes—detailing their internal structures, state transitions, and reliance on futex system calls for kernel‑level blocking, helping developers optimize synchronization across Java and native layers.
AndroidJavaLocks
0 likes · 17 min read

This article explains the Go sync.Once primitive, demonstrates its one‑time execution with concurrent goroutines, and shows how to recreate the same functionality in Java by using a static collection and ReentrantLock to ensure a block of code runs only once across multiple threads.
ConcurrencyJavaReentrantLock
0 likes · 5 min read

This article provides a comprehensive walkthrough of Java's ReentrantLock implementation, covering linked list and queue data structures, the AbstractQueuedSynchronizer (AQS) framework, lock acquisition and release mechanisms, fair vs. non-fair locks, and detailed code analysis with illustrative diagrams.
AQSLockReentrantLock
0 likes · 27 min read

This article explains how Java’s ReentrantLock relies on the AbstractQueuedSynchronizer (AQS) to manage lock state and a FIFO wait queue, detailing the step‑by‑step acquisition process with CAS, node insertion, parking, and the release mechanism that unparks successors.
AQSConcurrencyLock
0 likes · 9 min read

This article explains the key differences between Java's ReentrantLock and synchronized, covering fairness, tryLock, timeout, interruptibility, condition support, underlying implementations, and usage examples with code snippets, presented as an interview dialogue for candidates.
ConcurrencyJavaReentrantLock
0 likes · 10 min read

This article examines whether multiple threads can simultaneously invoke two synchronized methods within the same class, comparing Java's intrinsic synchronized lock with the explicit ReentrantLock, and demonstrates through various code scenarios how object locks and lock instances affect concurrent execution.
JavaReentrantLockSynchronization
0 likes · 16 min read


政采云技术Feb 17, 2022 · Backend Development
This article provides an in‑depth overview of Java locking mechanisms, covering lock classifications, the inner workings of the synchronized keyword, ReentrantLock, AbstractQueuedSynchronizer, various lock optimizations, and practical implementations of distributed locks using Redis and Zookeeper.
AQSConcurrencyDistributedLock
0 likes · 28 min read

This article examines how Java's synchronized keyword and ReentrantLock behave when multiple threads invoke two synchronized methods of the same class, exploring scenarios with the same instance, different instances, and Runnable run methods, and summarizing the resulting concurrency rules.
ConcurrencyJavaMultithreading
0 likes · 15 min read


JavaEdgeDec 11, 2021 · Backend Development
This article explains the full spectrum of Java concurrency locks—including pessimistic, optimistic, exclusive, shared, fair, unfair, segment, reentrant, and spin locks—detailing their principles, typical use cases, implementation details, and code examples to help you ace interview questions.
CASJavaLocks
0 likes · 12 min read

This article introduces Java's ReentrantLock as an easy-to‑use alternative to synchronized, explains its core lock() and unlock() methods, demonstrates practical code examples, and covers advanced APIs such as tryLock, getQueueLength, isLocked, and getHoldCount for robust multithreaded programming.
BackendConcurrencyJava
0 likes · 5 min read

This article explains how Java locks solve concurrent access problems, compares the built‑in synchronized lock with ReentrantLock, describes their upgrade mechanisms, usage patterns, and scenarios, and offers guidance on choosing the appropriate lock for different environments.
ConcurrencyJavaLocks
0 likes · 7 min read

This article explains the internal workings of Java's ReentrantLock, comparing fair and non‑fair lock acquisition, detailing the role of AQS, CLH queues, CAS operations, thread parking, and unlock procedures with full source‑code excerpts.
ConcurrencyFairLockJava
0 likes · 10 min read


JavaEdgeApr 27, 2021 · Backend Development
This article explains the core concepts of Java concurrency, comparing mutual exclusion and synchronization, detailing how JUC's Lock and Condition implement monitors, why Lock offers interruptible, timed, and non‑blocking acquisition, and how visibility and reentrancy are guaranteed through volatile state and Happens‑Before rules.
JUCJavaReentrantLock
0 likes · 9 min read

This article explains the principles of Java's AbstractQueuedSynchronizer (AQS), compares semaphore and monitor mechanisms, analyzes the source code of ReentrantLock, and demonstrates how to create a custom non-reentrant mutex using AQS, with detailed diagrams and code examples.
AQSConcurrencyJava
0 likes · 29 min read

This article breaks down the inner workings of Java’s ReentrantLock, explaining spin locks, the role of AbstractQueuedSynchronizer, fair vs. non‑fair locking, and step‑by‑step thread execution with code examples and diagrams to illustrate the complete lock acquisition and release process.
AQSConcurrencyJava
0 likes · 17 min read

This article explains the concept of reentrant locks in Java, compares ReentrantLock with the synchronized keyword, and provides a detailed walkthrough of the internal source code for lock acquisition, fairness policies, and lock release using AQS, complete with code examples.
AQSConcurrencyJava
0 likes · 17 min read

This article explains the various types of locks provided by Java, compares optimistic and pessimistic locking, introduces spin locks and adaptive spin locks, details lock states such as biased, lightweight, and heavyweight, and examines fair versus non‑fair, reentrant versus non‑reentrant, and exclusive versus shared locks with source code references.
CASConcurrencyJava
0 likes · 25 min read

This article explains why Java introduced the Lock API after Java 1.5, compares it with synchronized, details the explicit lock features, walks through the AQS (AbstractQueuedSynchronizer) implementation, and shows how ReentrantLock, fairness, reentrancy, and conditions are built on top of AQS.
AQSConcurrencyJava
0 likes · 36 min read

This article provides a comprehensive walkthrough of Java's AbstractQueuedSynchronizer (AQS), its state and FIFO wait queue, the inner workings of ReentrantLock with both non‑fair and fair lock strategies, and the detailed mechanics of Condition objects with code examples and diagrams.
AQSConditionFairLock
0 likes · 21 min read

This article explains Java's thread synchronization mechanisms by comparing synchronized blocks with the Lock interface, detailing thread basics, lifecycle methods, lock types, code demonstrations, fairness settings, and underlying JVM implementations, helping readers understand when and how to use each construct effectively.
ConcurrencyJavaLock
0 likes · 17 min read

This article summarizes the main types of Java locks—including fair/unfair, reentrant, exclusive/shared, mutex/read‑write, optimistic/pessimistic, segment, biased/lightweight/heavyweight, and spin locks—provides brief definitions, usage notes, and a code example to help interview candidates answer concurrency questions effectively.
ConcurrencyInterviewJava
0 likes · 8 min read

This article provides a comprehensive analysis of Java's AbstractQueuedSynchronizer (AQS) framework, explains how ReentrantLock is built on AQS, walks through lock acquisition and release mechanisms, discusses queue management, and demonstrates how to create a custom lock using AQS.
AQSConcurrencyJava
0 likes · 32 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

The article explains Java’s AbstractQueuedSynchronizer as the foundation of many concurrency utilities, details how ReentrantLock leverages AQS’s FIFO CLH queue, state field, and lock acquisition/release mechanisms, compares it with synchronized, and demonstrates building a custom lock with AQS.
AQSConcurrencyJava
0 likes · 33 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

This article explains the different types of Java locks—including fair, reentrant, exclusive, read‑write, optimistic, pessimistic, segment, biased, lightweight, heavyweight, and spin locks—describes their characteristics, usage scenarios, and provides concrete code examples for each implementation.
AQSJavaReentrantLock
0 likes · 15 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 the internal design of Java’s ArrayBlockingQueue—a fixed‑size, FIFO blocking queue that uses a ReentrantLock and Condition objects to coordinate producers and consumers, detailing its fields, fairness option, and the concrete implementations of add, offer, poll, and take methods.
ArrayBlockingQueueBlockingQueueConcurrency
0 likes · 10 min read

This article explains how Java's ReentrantLock guarantees memory visibility for shared variables without using volatile, by leveraging the Java Memory Model's happens‑before guarantees, the lock's internal volatile state, and underlying CPU memory‑barrier instructions such as the LOCK prefix.
Happens-BeforeJavaMemory Model
0 likes · 10 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 explains why lock optimization matters in high‑concurrency Java applications and presents practical techniques such as reducing lock hold time, shrinking lock granularity, using read‑write locks, lock splitting, lock coarsening, and lock elimination to improve performance.
AQSConcurrencyJava
0 likes · 8 min read

This article explores Java’s Lock interface and its underlying implementation, detailing the role of AbstractQueuedSynchronizer (AQS) in building ReentrantLock, the internal class hierarchy, synchronization mechanisms, and provides a step‑by‑step guide to creating a custom lock using AQS.
AQSConcurrencyCustomLock
0 likes · 12 min read

This article explains how Java's Lock interface and its ReentrantLock implementation provide flexible thread synchronization, inter‑thread communication via Condition objects, and the distinction between fair and non‑fair locking, complemented by illustrative code screenshots.
ConcurrencyConditionJava
0 likes · 7 min read

This article explains Java’s synchronized keyword’s reentrant lock capability, demonstrates how nested synchronized methods acquire the same lock without deadlock, explores additional features such as automatic lock release on exceptions, using arbitrary objects as monitors, and illustrates the double‑checked locking pattern for singleton implementation.
ConcurrencyJavaReentrantLock
0 likes · 5 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
