CONCURRENCY / NOTES</>↗Concurrency03 May 2025
To use a BlockingQueue to pass data between threads in Java, you can follow these steps: 1. Understand BlockingQueue BlockingQueue is part of the java.util.concurrent package and is designed for thread-safe communication between producer and consumer threads. It provides methods such as put() and take(), which handle blocking behavior: put(E e): Blocks if the queue […]
CONCURRENCY / NOTES</>↗Concurrency03 May 2025
To gracefully shut down an ExecutorService in Java, you should follow these steps: Call shutdown(): This will prevent the ExecutorService from accepting any new tasks while allowing already submitted tasks to be completed. Wait for Termination: You can use awaitTermination(long timeout, TimeUnit unit) to wait for a specified amount of time for all tasks to […]
JSCH / NOTES</>↗JSch02 May 2025
Port forwarding is a technique commonly used to access remote services, such as databases or web applications, via SSH. Using Java, you can achieve this by leveraging the JSch (Java Secure Channel) library. Below, you’ll find a step-by-step guide to setting up port forwarding. 1. Understanding Port Forwarding with JSch Port forwarding allows you to […]
CONCURRENCY / NOTES</>↗Concurrency02 May 2025
To submit multiple tasks and get results using invokeAll in Java, you can make use of the ExecutorService. The invokeAll method submits a collection of Callable tasks to the executor and waits for all of them to complete. Once completed, it returns a list of Future objects, each representing the result of a corresponding task. […]
SPRING CORE / NOTES</>↗Spring Core02 May 2025
Understanding Inversion of Control (IoC) and Dependency Injection (DI) in the Spring Framework can seem tricky at first, but it becomes intuitive when approached step by step. Here is a simplified explanation: 1. Inversion of Control (IoC) IoC is a principle in software design where the control of creating and managing objects is transferred (inverted) […]
JAVA 10 / NOTES</>↗Java 1002 May 2025
Java 10 introduced enhancements to the Garbage Collection (GC) interface through the JEP 304: GC Interface, which abstracts garbage-collection implementations to improve integration and monitoring capabilities. While these improvements primarily simplify the addition of new garbage collectors to the JVM, they can also be leveraged to monitor memory usage and GC behavior in real time. […]