SupportWriter space ↗
REFERENCE LIBRARY

References from other publishers

Republished articles with source attribution. This collection is separate from Diary Coding’s original guides and does not display ads.

Read original guides → · Editorial policy

FOR YOUR CURIOSITY

Latest notes.

HTTPCLIENT / NOTES</>↗
HttpClient16 Apr 2025

How do I set a timeout on HTTP requests in Java 11?

To set a timeout on HTTP requests in Java 11, you can use the HttpClient provided by the java.net.http module. The HttpClient API allows you to configure timeouts for requests in a convenient and standardized way. Here’s how you can do it: Set a Connection Timeout: This controls the timeout when establishing a connection to […]

Wayan · 2 min read
HTTPCLIENT / NOTES</>↗
HttpClient16 Apr 2025

How do I set custom headers in Java 11 HttpRequest?

In Java 11, the java.net.http package introduced the new HttpClient API, which simplifies working with HTTP requests and responses. To set custom headers for an HttpRequest, you can use the headers method or the setHeader method while building your request using the HttpRequest.Builder. Here’s a step-by-step guide for setting custom headers: Example Code package org.kodejava.net.http; […]

Wayan · 2 min read
HTTPCLIENT / NOTES</>↗
HttpClient15 Apr 2025

How do I handle HTTP response status codes with Java 11 HttpClient?

Handling HTTP response status codes with Java 11’s HttpClient API involves making a request, receiving a response, and then checking the status code returned in the response. Here’s how you can do this: Steps to Handle HTTP Response Status Codes Create the HttpClient: Build an instance of HttpClient. Build the Request: Define the HTTP request […]

Wayan · 3 min read
CONCURRENCY / NOTES</>↗
Concurrency15 Apr 2025

How do I use Callable and Future to return results from threads?

In Java, the Callable interface and Future interface are used in conjunction to run tasks asynchronously in a separate thread and fetch the result of the computation once it is complete. This is particularly useful when you need the task to return a result or throw a checked exception. Here’s a step-by-step guide to how […]

Wayan · 4 min read
CONCURRENCY / NOTES</>↗
Concurrency14 Apr 2025

How do I safely share data between threads with ConcurrentHashMap?

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 […]

Wayan · 4 min read
CONCURRENCY / NOTES</>↗
Concurrency14 Apr 2025

How do I schedule tasks using ScheduledExecutorService?

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 […]

Wayan · 3 min read
✳

Knowledge grows when shared.

Stay curious. There is always something new to learn.

Explore notes ↗
Putu Adi Guna Permana
ABOUT THE AUTHOR

Dr (C). Ir. Putu Adi Guna Permana, S.Kom., M.Kom., IPM., ASEAN Eng.

Writer and founder of Diary Coding — sharing notes, tutorials, and experiences about programming for anyone who wants to keep learning.