O'Reilly logo

Java 9 Cookbook by Nick Samoylov, Mohamed Sanaulla

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

There's more...

Different types of locks for different needs and with different behavior are assembled in the java.util.concurrent.locks package.  

The java.util.concurrent.atomic package provides support for lock-free, thread-safe programming on single variables.

The following classes provide synchronization support too:

  • Semaphore: This restricts the number of threads that can access some resource
  • CountDownLatch: This allows one or more threads to wait until a set of operations being performed in other threads are completed
  • CyclicBarrier: This allows a set of threads to wait for each other to reach a common barrier point
  • Phaser: This provides a more flexible form of barrier that may be used to control phased computation among multiple threads ...

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