<img alt="" src="https://secure.leadforensics.com/150446.png " style="display:none;">

Blogs

Synchronizers In Java - CyclicBarrier

Along with CountDownLatch, FutureTask and Semaphore, the Concurrency API in Java 5 also introduced a barrier – CyclicBarrier. This class is used as a barrier for a set of threads, to keep them waiting until all the threads have reached it. Once all the threads reach the barrier, it is tripped, allowing them to perform further execution. The number of threads in WAITING state, which when reached should trip the barrier, is passed as an argument to the constructor of CyclicBarrier. A Runnable action to be performed when the barrier is tripped can also be defined optionally while instantiating CyclicBarrier. The last thread to enter the barrier executes this action before the other waiting threads are released. If the action throws exception, the barrier is broken and all the other threads receive a checked exception BrokenBarrierException.

Topics: CyclicBarrier Java Multithreading Concurrency API Technology synchronizers

Synchronizers In Java - CountDownLatch

The Concurrency API introduced in Java 5 provides a latch – CountDownLatch. A latch is a synchronizer which acts like a gate. CountDownLatch acts like a one-time closed gate which is initially closed and can be opened only once. Once it is opened it will remain open.

Topics: synchronizer Java ExecutorService Multithreading latch Concurrency API CountDownLatch Technology synchronizers

e-Zest is a leading digital innovation partner for enterprises and technology companies that utilizes emerging technologies for creating engaging customers experiences. Being a customer-focused and technology-driven company, it always helps clients in crafting holistic business value for their software development efforts. It offers software development and consulting services for cloud computing, enterprise mobility, big data and analytics, user experience and digital commerce.