Home
Gaurav's GitHub Page
Cancel

Java Multithreading - Re-entrant Locks

This following post is based on the Udemy Course: Java Multithreading USING REENTRANT LOCK: THE WRONG WAY App.java We create two threads which will run the firstThread() and secondThread() met...

Java Multithreading - Producer/Consumer (Using Low-Level Synchronization)

This following post is based on the Udemy Course: Java Multithreading In the updated version of the application, the main app remains unchanged. It creates two threads: one for the producer and ...

Java Multithreading - Wait and Notify

This following post is based on the Udemy Course: Java Multithreading wait() The wait() method is a part of java.lang.Object class. When wait() method is called, the calling thread stops its ex...

Java Multithreading - Producer/Consumer

This following post is based on the Udemy Course: Java Multithreading Blocking Queue (thread-safe queue implementation) A Queue that additionally supports operations that wait for the queue to ...

Design Pattern: Prototype

PROTOTYPE IDEA Imagine a situation where creating an object is a costly task. This can happen when we need certain information from a database or external service before we can create the object....

Java Multithreading - Countdown Latches

This following post is based on the Udemy Course: Java Multithreading A synchronization aid that allows one or more threads to wait until a set of operations being performed in other threads ...

Design Pattern: Builder

BUILDER Thought Process: We need to create an object of a class which has numerous attributes and they need some kind of validation before we create the object Although we can directly use a...

Java Multithreading - Thread Pools

This following post is based on the Udemy Course: Java Multithreading We will use the ExecutorService class to create a thread pool. Think of it as have multiple threads which will act as worker...

Design Pattern: Singleton

SINGLETON The objective is to ensure that a single object of a particular class can exist for an app. Thought Process: We will have to make the constructor of that class private so that other...

Java Multithreading - Multiple Locks; Using Synchronized Code Blocks

This following post is based on the Udemy Course: Java Multithreading Basic App without threads package demo; public class App { public static void main(String[] args) { //create a new ...