What is CountDownLatch and How to Use It?

In Java’s concurrency API, CountDownLatch is a synchronizer that allows one or more threads to wait for a set of operations to complete. Imagine you’re developing a server application that relies on various resources to be initialized before it can start processing requests. These resources could be things like: Loading configuration files Establishing database connections … Read more

Java Thread Programming (Part 15)

Learn how to do asynchronous method invocation with Callable and Future with a practical example.

Java Thread Programming (Part 12)

Let’s find out what are the ways to create ThreadPool using the Executor framework in java and use result-bearing tasks using Callable and Future

Java Thread Programming (Part 11)

Learn how to ask the executor framework at startup to provision threads for us and they will be reused as long as the application runs.

Java Thread Programming (Part 10)

Let’s learn about BlockingQueue, one of the essential concurrent collections available in the concurrent package in the JDK.

Java Thread Programming (Part 9)

Let’s continue the discussion and share a few more thread-safe classes that we can use in our day-to-day coding!

Java Thread Programming (Part 8)

The term thread safety is a frequently and commonly pronounced word among Java developers. However, it is still one of the misunderstood terms as well. In this article, I will try to explain in a very simplified way what it is and how we can achieve it while we write our day-to-day code. The idea … Read more

Java Thread Programming (Part 7)

Can we create as many Java threads as we want? I will try to come up with an answer via an exercise, so bear with me!

Java Thread Programming (Part 6)

Have you ever wondered what is the purpose of the “wait()”, “notify()”, “notifyAll()” methods that come with each Java object?

Java Thread Programming (Part 5)

In this article, we will discuss another situation called “race conditions” and how we can resolve it.