Home
Gaurav's GitHub Page
Cancel

Design Pattern: Facade

FACADE The Facade design pattern is a structural design pattern that provides a simplified interface to a complex system, making it easier to use. It encapsulates the complexity of the system behi...

Design Pattern: Decorator

DECORATOR Decorator design pattern is a structural design pattern that allows us to add extra features or behaviors to an object without changing its original structure. In this example, we have ...

Design Pattern: Adapter

ADAPTER The Adapter design pattern is a structural design pattern that allows objects with incompatible interfaces to work together. It acts as a bridge between two incompatible interfaces, conver...

Java Multithreading - Interrupting Threads

This following post is based on the Udemy Course: Java Multithreading UNDERSTANDING INTERRUPT USING CODE The main thread pauses for 500 milliseconds (0.5 seconds) using Thread.sleep(500). This ...

Java Multithreading - Callable and Future

This following post is based on the Udemy Course: Java Multithreading CALLABLE AND FUTURE Callable is an interface that represents a task or computation that can be executed in a separate threa...

Java Multithreading - Semaphores

This following post is based on the Udemy Course: Java Multithreading SEMAPHORES A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each acquire() blocks if necessar...

Java Multithreading - Deadlock

This following post is based on the Udemy Course: Java Multithreading DEADLOCK Process 1 Process 2 +-----------------+ +-----------------+ | Resource A | | Resource B |...

Design Pattern: Factory

FACTORY This pattern involves creating two key components: a “product” and a “factory.” In this example, the “product” is the Database interface. It defines the common methods that all types of d...

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 ...