Browse by Topic

Popular

Latest

Latest Java Posts

Diagram showing a java LinkedBlockingQueue connecting producer and consumer threads with a bounded buffer.
Java

Java LinkedBlockingQueue: Producer-Consumer Implementation

Learn how Java's LinkedBlockingQueue works, its capacity behavior, and how to use it in producer-consumer patterns with practical examples.

java concurrencyblocking queueproducer-consumerthread safety
Illustration of a bounded circular queue with producer and consumer threads accessing an ArrayBlockingQueue, representing Java concurrency.
Java

Java ArrayBlockingQueue: Bounded Queue for Concurrency

Learn how to use Java's ArrayBlockingQueue, a bounded, thread-safe queue for producer-consumer patterns, including capacity, fairness, blocking operations, and performance tradeoffs.

Java ConcurrencyBlockingQueueProducer-ConsumerThread Safety
Illustration of Java BlockingQueue with producer and consumer threads exchanging data through a bounded queue.
Java

Java BlockingQueue: Blocking Methods and Implementations

Understand Java BlockingQueue's blocking methods, implementations, and how to choose the right queue for producer-consumer concurrency.

JavaConcurrencyBlockingQueueProducer-Consumer
Illustration of a list being copied on write operation in Java concurrency.
Java

Java CopyOnWriteArrayList: Usage and Tradeoffs

Learn how CopyOnWriteArrayList works, its snapshot iteration semantics, and when to use it in concurrent Java applications.

JavaConcurrent CollectionsCopyOnWriteArrayListThread Safety
Illustration of a ConcurrentHashMap with multiple threads accessing different bins concurrently, showing parallel read and write operations.
Java

Java ConcurrentHashMap: Thread-Safe Map for High Concurrency

Learn how Java's ConcurrentHashMap provides thread-safe map operations with high concurrency: atomic methods, weakly consistent iteration, performance tradeoffs, and common pitfalls.

ConcurrentHashMapJava ConcurrencyThread SafetyJava Collections
Illustration of Java concurrent collections showing multiple threads accessing a segmented thread-safe map with lock striping.
Java

Java Concurrent Collections: A Practical Selection Guide

A practical guide to Java's concurrent collections: how they work, when each type fits, and how to avoid common thread-safety pitfalls.

ConcurrentHashMapThread SafetyBlockingQueueCopyOnWriteArrayList
Illustration of a CompletableFuture chain with an exception being handled by a recovery stage
Java

Java CompletableFuture Exception Handling

Learn how to handle exceptions in Java CompletableFuture chains using exceptionally, handle, and whenComplete, with practical examples and common pitfalls.

CompletableFutureException HandlingAsynchronous ProgrammingConcurrency
Illustration of multiple asynchronous tasks racing, with the first one highlighted as the winner in a Java CompletableFuture anyOf operation.
Java

Java CompletableFuture anyOf: Waiting for the First Result

How to use CompletableFuture.anyOf to wait for the first completed future, extract its result, handle exceptions, and avoid common pitfalls in Java asynchronous code.

CompletableFutureAsync ProgrammingConcurrencyJava
Illustration of Java CompletableFuture.allOf combining multiple asynchronous futures into a single completion point.
Java

Java CompletableFuture allOf: Wait for Multiple Futures

Learn how to use Java's CompletableFuture.allOf to wait for multiple async tasks, collect results, and handle failures.

CompletableFutureConcurrencyAsynchronous ProgrammingJava
Two parallel branches merging into a single node representing CompletableFuture thenCombine
Java

Java CompletableFuture thenCombine: Combining Async Results

Learn how to combine two independent CompletableFutures with thenCombine, handle errors, and choose the right composition method.

CompletableFutureJava ConcurrencyAsync ProgrammingthenCombine