O'Reilly logo

Hands-On High Performance with Spring 5 by Dinesh Radadiya, Prashant Goswami, Pritesh Shah, Subhash Shah, Chintan Mehta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Synchronizers

Java provides a synchronized keyword to write synchronized code, but it is difficult to correctly write synchronized code through the synchronized keyword alone. The java.util.concurrent package provides various utility classes, such as CountDownLatch, CyclicBarrier, Exchanger, Semaphore, and Phaser, which are known as synchronizers. Synchronizers are concurrency utilities that provide thread synchronization without using the wait() and notify() methods. Let's have a look at the following classes:

  • CountDownLatch: This allows one thread to wait for one or more threads to complete before it can start processing.
  • CyclicBarrier: This is very similar to CountdownLatch, but it allows multiple threads to wait for each other before ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required