TOOLS / CATATAN</>↗Tools03 Mei 2025
SDKMAN (Software Development Kit Manager) is a command-line tool that allows you to manage multiple versions of Java and other SDKs easily. Here’s how you can install and manage multiple Java versions using SDKMAN: Step 1: Install SDKMAN Open your terminal. Run the following command to install SDKMAN: curl -s "https://get.sdkman.io" | bash Follow the […]
JSCH / CATATAN</>↗JSch03 Mei 2025
To execute multiple commands sequentially using JSch’s ChannelShell, you need to establish a persistent shell session and then pass the commands in sequence. The ChannelShell uses an input and output stream to communicate with the remote host. Here is a step-by-step approach and a sample implementation: Steps to Execute Commands Sequentially Initialize the JSch session: […]
CONCURRENCY / CATATAN</>↗Concurrency03 Mei 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 / CATATAN</>↗Concurrency03 Mei 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 / CATATAN</>↗JSch02 Mei 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 / CATATAN</>↗Concurrency02 Mei 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. […]