CONCURRENCY / NOTES</>↗Concurrency13 Apr 2025
In Java, the java.util.concurrent.Executors class provides factory methods for creating and managing thread pools easily. Below are common ways to create a thread pool using Executors: 1. Fixed Thread Pool A fixed thread pool contains a fixed number of threads. This is useful when you have a specific number of tasks to manage and want […]
CONCURRENCY / NOTES</>↗Concurrency13 Apr 2025
In Java, the ExecutorService interface is part of the java.util.concurrent package and provides a higher-level replacement for managing threads and tasks. It simplifies the execution of tasks in a multithreaded environment by abstracting thread creation and management. Here’s how you can use ExecutorService to run tasks in Java: 1. Creating an ExecutorService You can create […]
SERVLET / NOTES</>↗Servlet12 Apr 2025
Managing sessions using HttpSession in Jakarta Servlets is a straightforward process. HttpSession is a part of the Jakarta Servlet API which provides a way to handle session management between a client and server during multiple requests. Here’s a structured guide on using and managing sessions with HttpSession: 1. Introduction to HttpSession The HttpSession interface is […]
SERVLET / NOTES</>↗Servlet12 Apr 2025
In a Jakarta EE (or formerly Java EE) web application, you can use the HttpServletRequest object to read request parameters sent by a client (e.g., from a form, URL query string, or other mechanisms). Below are the common ways to read the parameters: 1. Using getParameter(String name) This method is used when you need to […]
SERVLET / NOTES</>↗Servlet11 Apr 2025
Handling GET and POST requests in Jakarta Servlets involves overriding the doGet() and doPost() methods provided by the HttpServlet class. Here’s a step-by-step guide: 1. Import Necessary Packages First, ensure you import the jakarta.servlet and jakarta.servlet.http packages in your servlet class. import jakarta.servlet.ServletException; import jakarta.servlet.annotation.WebServlet; import jakarta.servlet.http.HttpServlet; import jakarta.servlet.http.HttpServletRequest; impor...
SERVLET / NOTES</>↗Servlet11 Apr 2025
In this post I will show you the step-by-step instructions to deploy a WAR file in Tomcat 11: 1. Build Your WAR File A WAR file (.war) is a packaged web application. To build it: If you’re using Maven, run the following command in your project directory: mvn clean package This generates a WAR file […]