Java Concurrency Revisited: Synchronized vs. ReentrantLock

Java Concurrency in Practice is the bible of Java multi-threading. It’s dense, thorough, and frankly, a bit intimidating. For years, I relied heavily on Java’s java.util.concurrent package (ConcurrentHashMap, my beloved), ignoring the low-level mechanics underneath. Why reinvent the wheel when the standard library is so good? But to truly master scalability, you have to understand what happens under the hood. Recently, I decided to peel back the layers and revisit the building blocks of Java concurrency: synchronized and ReentrantLock. ...

November 22, 2025 · 5 min · 1018 words · Me

Sneak peek at the asynchronous Java

Java 19 is here with the preview of loom project. Loom project is the one helps Java become asynchronous and come back to the table to compete with other asynchronous language such as Golang. But why do we need Java to be asynchronous? Blocking It is all because we don’t want to be blocked. And the best example must be how you do your driver license renewal at the DMV. I remember I work up at 5:30 in the morning and drove to the DMV where there was already a line of 50 people. But I have no choice but to join them. After several hours’ waiting, I can finally check in and get a number for my case. Then I was eligible to walk in and find a chair to continue my waiting. After another couple hours, I finally got called at a window and finished my license renewal task. ...

September 16, 2023 · 3 min · 623 words · Me