CONCURRENCY / CATATAN</>↗Concurrency14 Apr 2025
When working with a multithreaded application, ConcurrentHashMap is a great choice for safely sharing data between threads. It is a thread-safe version of a HashMap that provides high concurrency for both retrieval and updates. Here are some guidelines to safely use a ConcurrentHashMap in a multithreaded environment: 1. Use Thread-Safe Access Operations ConcurrentHashMap ensures that […]
CONCURRENCY / CATATAN</>↗Concurrency14 Apr 2025
The ScheduledExecutorService is a Java concurrency utility used for scheduling tasks to run after a delay or to execute periodically. Introduced in Java 5 as part of the java.util.concurrent package, it provides flexible scheduling functionality. Here’s how you can use it: 1. Getting an Instance of ScheduledExecutorService You can obtain an instance using the Executors […]
CONCURRENCY / CATATAN</>↗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 / CATATAN</>↗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 / CATATAN</>↗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 / CATATAN</>↗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 […]