Java Thread Synchronization: Wait/Notify, Condition, and LockSupport
Java provides several mechanisms for managing thread coordination. Understanding these methods and their nuances is crucial for building robust multithreaded applications.
1. Object.wait() and Object.notify()
This pair of methods allows a thread to yield its execution until another thread notifies it. Both wait() and notify() (or notifyAll()) m ...
Posted on Sun, 05 Jul 2026 17:29:51 +0000 by greenhorn666
In-Depth Analysis of ReentrantLock Implementation and Mechanism in Java
ReentrantLock is a reentrant mutual exclusion mechanism built atop the AbstractQueuedSynchronizer (AQS) framework. It provides flexible thread synchronization in Java, supporting both fair and non-fair acquisition policies.
Structural Overview
ReentrantLock implements the Lock interface. Internally it defines a nested Sync class extending AQS, ...
Posted on Sun, 05 Jul 2026 16:52:08 +0000 by mligor
Implementing Task Queues in Go Using Goroutines and Channels
Go excels at building asynchronous systems through lightweight goroutines and channels, offering simpler constructs than many languages' async/await models. Below are practical patterns for implementing task queues.
Direct Asynchronous Execution
For trivial cases, firing off a task asynchronously requires no queue:
go handleTask(item)
This suf ...
Posted on Sat, 04 Jul 2026 17:32:35 +0000 by Lee
Understanding MySQL Transactions: ACID Properties and Concurrency Control
Transaction Characteristics
MySQL transactions follow the ACID principles:
Atomicity: All operations within a transaction either complete successfully or fail entirely. Implemented through undo logs.
Consistency: Data remains in a valid state throughout the transaction. Maintained by the combination of all ACID properties.
Isolation: Concurren ...
Posted on Thu, 02 Jul 2026 17:30:32 +0000 by andreas
Advanced Java: Concurrency, Networking, and Reflection
Concurrency in Java allows multiple threads to execute parts of a program. Concurrency involves multiple instructions interleaving on a single CPU, while parallelism involves multiple instructions executing simultaneously on multiple CPUs.
Thread Implementation
There are several ways to implement multithreading in Java:
Extending the Thread c ...
Posted on Tue, 30 Jun 2026 16:03:21 +0000 by 182x
Exploring Thread Visibility Issues in Java: Output Statements, Sleep, and Integer Operations
Java thread visibility issues can produce unexpected behavior when shared variables are accessed across threads without proper synchronization. This article examines three peculiar cases where programs behavee differently than expected due to JVM optimizations and memory visibility effects.
Basic Visibility Problem
Consider this simple program ...
Posted on Mon, 29 Jun 2026 17:28:12 +0000 by Fantast
Thread Pool Deadlock Caused by Parent-Child Task Dependencies
The Concurrency PitfallConsider a scenario where a fixed-size thread pool is used to process multiple primary operations. Each primary operation retrieves a collection of records and processes them sequentially. To optimize throughput, the processing of individual records is offloaded to the same thread pool as asynchronous sub-tasks, while the ...
Posted on Mon, 29 Jun 2026 17:14:09 +0000 by Yola
Implementing Java Multithreading by Extending the Thread Class
In Java, one of the fundamental approaches to creating concurrent execution paths is by extending the Thread class. By inheriting from Thread, a class acquires the capability to run as an independent unit of execution.Defining a custom thread involves overriding the run() method. This method serves as the entry point for the new thread and cont ...
Posted on Mon, 29 Jun 2026 16:58:11 +0000 by Rayhan Muktader
Preventing Duplicate Data in High-Concurrency Systems
Background
Recently, our testing team reported a bug where a batch product duplication API was generating duplicate product data. After investigating, I discovered this issue was more complex than initially apparent, involving multiple challenges.
Initial Requirements
The product team requested a feature where users could select brands and, up ...
Posted on Sun, 28 Jun 2026 17:05:38 +0000 by Goop3630
In-Depth Java ThreadPoolExecutor Source Code Analysis
ThreadPoolExecutor Constructor Parameters
The ThreadPoolExecutor constructor provides the core parameters for configuring the thread pool:
public ThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
Blo ...
Posted on Sat, 27 Jun 2026 18:01:22 +0000 by zoidberg