Lock Striping in Java

There are dozens of decent lock-free hashtable implementations. Usually, those data structures, instead of using plain locks, are using CAS-based operations to be lock-free. with this narrative, it might sound I’m gonna use this post to build an argument for lock-free data structures. that’s not the case, quite surprisingly. on the contrary, here we’re going to talk about plain old locks.

Now that everybody’s onboard, let’s implement a concurrent version of Map with this simple contract:

Java Records: A Closer Look

Records is a new preview feature in Java 14, providing a nice compact syntax to declare classes that are supposed to be dumb data holders. In this article, we’re going to see what Records looks like under the hood. So buckle up!

Class Representation

Let’s start with a very simple example: