Code Pumpkin

Tag Archives: Concurrency

CountDownLatch Vs CyclicBarrier | Java Concurrency Utilities

CountDownLatch Vs CyclicBarrier : Though both are used as a synchronization aid that allows one or more threads to wait but there are certain differences between them that you should know in order to know when one of these utilities will serve you better.  As per the java.util.concurrent API,  CountDownLatch: A synchronization aid that allows one or more threads to […]

CyclicBarrier | Java Concurrency Utilities

May 25, 2017
Posted by Abhi Andhariya

CyclicBarrier  was introduced in Java 5 along with other concurrent classes like CountDownLatch, ConcurrentHashMap, CopyOnWriteArrayList, BlockingQueue within java.util.Concurrent package. There are scenarios in concurrent programming when you want set of threads to wait for each other at a common point until all threads in the set have reached that common point.  The java.util.concurrent.CyclicBarrier class is a barrier that […]

InterruptedException in Java Multithreading

InterruptedException is thrown when a thread is waiting, sleeping, or otherwise occupied, and the thread is interrupted, either before or during the activity. Before reading this article, I recommend you to go through my article interrupt(), interrupted() and isInterrupted() in Java Multithreading. There are some methods in JDK that check the Interrupt status flag for us and throw InterruptedException, if it […]

interrupt(), interrupted() and isInterrupted() in Java Multithreading

In this post, we will understand about interrupt(), interrupted() and  isInterrupted() methods in Java Multithreading. If you are interested in reading more about interruption mechanism you can look into our post InterruptedException in Java Multithreading. In Java, thread starts its execution when we call start() method on Thread object. It internally calls overridden run() method. Thread is said to be terminated when […]

CountDownLatch in Java Concurrency Utilities

May 5, 2017
Posted by Abhi Andhariya

CountDownLatch in Java Concurrency is a type of synchronizer which allows one Thread to wait for one or more Threads before it starts processing. You can implement the same functionality using wait() & Notify() mechanism but it requires lot of code and getting it write in first attempt is tricky,  With CountDownLatch it can  be done in […]

Producer Consumer Design Pattern

April 5, 2017
Posted by Abhi Andhariya

Producer Consumer Problem is a classical concurrency problem. In fact it is one of the concurrency design pattern.  It is also known as the bounded-buffer problem. The problem describes two processes, the producer and the consumer, who share a common, fixed-size buffer used as a queue. The producer's job is to generate data and put it into […]

Producer Consumer Design Pattern using BlockingQueue

April 5, 2017
Posted by Abhi Andhariya

Producer Consumer Problem is a classical concurrency problem. In fact it is one of the concurrency design pattern.   This article is continuation of my post Producer Consumer Design Pattern in which I have explained basic idea, real life example, uses and benefits of Producer Consumer Design Pattern.   Producer Consumer Design Patter can be implemented using […]

Producer Consumer Design Pattern using wait() and notify()

April 3, 2017
Posted by Abhi Andhariya

Producer Consumer Problem is a classical concurrency problem. In fact it is one of the concurrency design pattern.   This article is continuation of my post Producer Consumer Design Pattern in which I have explained basic idea, real life example, uses and benefits of Producer Consumer Design Pattern.   Producer Consumer Design Patter can either be implemented […]

Next posts
Total Posts : 124
follow us in feedly

Like Us On Facebook