Dabaoshi
Author

Dabaoshi

Practical utilities

49
Articles
0
Likes
23
Views
0
Comments
Recent Articles

Latest from Dabaoshi

49 recent articles
Dabaoshi
Dabaoshi
Aug 21, 2026 · Backend Development

Concurrency Series Finale: Virtual Threads and Structured Concurrency

The article explains why platform threads are costly, how JDK 21 virtual threads eliminate that cost, and provides practical guidance on creating, using, and debugging virtual threads, including pinning pitfalls, rules against pooling, structured concurrency, ScopedValue, and a detailed model‑selection comparison.

JDK 21JavaStructured Concurrency
0 likes · 34 min read
Concurrency Series Finale: Virtual Threads and Structured Concurrency
Dabaoshi
Dabaoshi
Aug 19, 2026 · Backend Development

Mastering Java Synchronization Utilities: CountDownLatch, CyclicBarrier, Semaphore, Phaser, and Exchanger

This article explains how Java's synchronization utilities—CountDownLatch, CyclicBarrier, Semaphore, Phaser, and Exchanger—solve coordination problems such as one‑time startup waits, repeated barrier synchronization, resource‑quota limiting, dynamic multi‑stage collaboration, and two‑thread data exchange, with concrete code examples and a full seckill‑system case study.

CountDownLatchCyclicBarrierExchanger
0 likes · 18 min read
Mastering Java Synchronization Utilities: CountDownLatch, CyclicBarrier, Semaphore, Phaser, and Exchanger
Dabaoshi
Dabaoshi
Aug 18, 2026 · Backend Development

ConcurrentHashMap Deep Dive: Understanding Java’s Core Concurrent Container

This article explains why HashMap isn’t thread‑safe, how Hashtable’s single lock hurts performance, and walks through the evolution from JDK 1.7 segment locks to JDK 1.8’s CAS‑plus‑synchronized bucket locking, including lock‑free size counting and a comparison with CopyOnWriteArrayList for read‑heavy scenarios.

ConcurrentHashMapCopyOnWriteArrayListJDK8
0 likes · 17 min read
ConcurrentHashMap Deep Dive: Understanding Java’s Core Concurrent Container
Dabaoshi
Dabaoshi
Aug 18, 2026 · Backend Development

Thread Pool Mechanics and Tuning: Avoid new Thread() in Production

This article explains why creating raw threads in production is costly, breaks down the seven ThreadPoolExecutor parameters, shows the exact execution flow of a submitted task, compares queue choices and Executors factories, and provides practical tuning, rejection‑policy and graceful‑shutdown guidance.

ExecutorServiceJavaPerformance Tuning
0 likes · 16 min read
Thread Pool Mechanics and Tuning: Avoid new Thread() in Production
Dabaoshi
Dabaoshi
Aug 17, 2026 · Fundamentals

Concurrency 07: Understanding Deadlocks and Thread‑Safety Strategies

This article explains how deadlocks arise from four necessary conditions, shows how to detect them with jstack, outlines practical ways to prevent deadlock, distinguishes livelock and starvation, and presents three prioritized approaches—immutability, thread confinement, and synchronization—to achieve thread safety in Java.

DeadlockImmutableJava
0 likes · 16 min read
Concurrency 07: Understanding Deadlocks and Thread‑Safety Strategies
Dabaoshi
Dabaoshi
Aug 16, 2026 · Backend Development

AQS Deep Dive: How Java’s AbstractQueuedSynchronizer Powers Concurrency

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.

AQSJavaLockSupport
0 likes · 15 min read
AQS Deep Dive: How Java’s AbstractQueuedSynchronizer Powers Concurrency
Dabaoshi
Dabaoshi
Aug 16, 2026 · Fundamentals

CAS and Java Atomic Classes Explained: Mechanics, Pitfalls, and LongAdder

This article demystifies Java's Compare‑And‑Swap (CAS) instruction, shows how atomic classes like AtomicInteger achieve lock‑free increments, discusses CAS's three main drawbacks, surveys the entire java.util.concurrent.atomic family, and explains how LongAdder improves high‑contention counting.

Atomic ClassesCASJava
0 likes · 15 min read
CAS and Java Atomic Classes Explained: Mechanics, Pitfalls, and LongAdder
Dabaoshi
Dabaoshi
Aug 13, 2026 · Fundamentals

Why Concurrency Is Hard: The Surprising Result of Two Threads Incrementing an int

The article explains why Java concurrency is difficult by showing that two threads each incrementing an int ten thousand times may not produce twenty thousand, then explores the motivations for multithreading, the differences between concurrency and parallelism, and the three core challenges of visibility, atomicity, and ordering.

AtomicityJavaMultithreading
0 likes · 23 min read
Why Concurrency Is Hard: The Surprising Result of Two Threads Incrementing an int
Dabaoshi
Dabaoshi
Aug 13, 2026 · Fundamentals

Design Patterns 23 – Final Overview: Mapping All 23 Patterns onto One Diagram

The article wraps up the "Design Pattern Dissection" series by showing how the 23 GoF patterns appear in JDK, Spring and MyBatis, clarifying the most confusing pattern pairs, warning against over‑design, and presenting a comprehensive map that links each pattern to the seven core design principles.

Design PatternsGoFJava
0 likes · 12 min read
Design Patterns 23 – Final Overview: Mapping All 23 Patterns onto One Diagram