when relevant content is
added and updated.
The new JDK™ 9 early access release contains a JDK enhancement proposal JEP 143, Improve Contended Locking, to improve the performance of contended monitors.
Monitors are used by the java synchronized statement to lock the access to a code block. If the synchronized block is called by many threads, the monitor becomes contended. This can degrade the performance dramatically.
Therefore we benchmarked a synchronized method with jmh for different JDK versions. Our Benchmark showed that for 16 Threads JDK 8 needs 2580 ns while JDK 9 only needs 1655 ns for our method. This is an improvement by more than 60 percent. In JDK 9 contended monitors are almost as performant as contended reentrant locks.