CONCURRENCY / CATATAN</>↗Concurrency05 Mei 2025
To control access to shared resources in a multithreaded environment, a Semaphore is frequently used, which is part of the java.util.concurrent package. A semaphore manages a set number of permits that control how many threads can access a shared resource simultaneously. Threads acquire permits before accessing the resource and release the permits after they are […]
JSCH / CATATAN</>↗JSch04 Mei 2025
When using JSch (Java Secure Channel) for SSH key-based authentication with a passphrase, you need to set your private key file (which is protected by the passphrase) and optionally the passphrase itself. Below is an example demonstrating how to configure key-based authentication using JSch: Code Example package org.kodejava.jsch; import com.jcraft.jsch.*; public class JSchKeyBasedAuthentication { public […]
CONCURRENCY / CATATAN</>↗Concurrency04 Mei 2025
When working with concurrent collections in Java, thread safety issues can be minimized or completely avoided by using the right tools and patterns provided by the Java concurrency library. Here are some guidelines for avoiding thread safety issues using concurrent collections: 1. Use Concurrent Collections Java provides a range of thread-safe collections in the java.util.concurrent […]
SPRING CORE / CATATAN</>↗Spring Core04 Mei 2025
Creating your first Spring bean using XML configuration is a straightforward process. Here’s a step-by-step guide: 1. Add Spring Framework to Your Project Make sure you have Spring dependencies added to your project. If you’re using Maven, include the following dependencies in your pom.xml: <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>6.2.6</version> <!– Update to a stable version –> […]
JAVA 10 / CATATAN</>↗Java 1004 Mei 2025
Java 10 introduced the List.copyOf(), Set.copyOf(), and Map.copyOf() methods as convenient ways to create unmodifiable copies of existing collections. These methods are part of the java.util package and provide a simpler way to create immutable collections compared to using older methods like Collections.unmodifiableList(). Here’s how you can use them: 1. List.copyOf() The List.copyOf() method creates […]
CONCURRENCY / CATATAN</>↗Concurrency04 Mei 2025
In Java, the CountDownLatch is a synchronization aid that allows one or more threads to wait until a set of operations being performed in other threads is complete. It is part of the java.util.concurrent package. How It Works A CountDownLatch is initialized with a given count. Each time one of the threads completes its task, […]