How to do it...

Follow these steps to implement the example:

  1. Create a class named Videoconference and specify that it implements the Runnable interface. This class will implement the video conference system:
        public class Videoconference implements Runnable{
  1. Declare a CountDownLatch object named controller:
        private final CountDownLatch controller;
  1. Implement the constructor of the class that initializes the CountDownLatch attribute. The Videoconference class will wait for the arrival of the number of participants received as a parameter:
        public Videoconference(int number) {           controller=new CountDownLatch(number);         }
  1. Implement the arrive() method. This method will be called each time a participant arrives for the video conference. ...

Get Java 9 Concurrency Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.