Tag

CountDownLatch

2 views collected around this technical thread.

FunTester
FunTester
Jun 17, 2025 · Backend Development

How to Test Java ExecutorService Without Thread.sleep(): Reliable Strategies

This article explains why using Thread.sleep() in Java ExecutorService unit tests is unreliable and inefficient, and introduces three robust alternatives—Future.get(), CountDownLatch, and shutdown/awaitTermination—to achieve stable and performant testing of asynchronous code.

CountDownLatchExecutorServiceFuture
0 likes · 13 min read
How to Test Java ExecutorService Without Thread.sleep(): Reliable Strategies
Top Architecture Tech Stack
Top Architecture Tech Stack
May 12, 2025 · Operations

Load Testing with Postman, Apache Bench, JMeter, and Java Concurrency Utilities

This article explains how to perform HTTP load testing using Postman, Apache Bench, JMeter, and Java concurrency classes such as CountDownLatch and Semaphore, providing step‑by‑step setup, configuration, and code examples for simulating high‑traffic scenarios.

Apache BenchCountDownLatchJMeter
0 likes · 8 min read
Load Testing with Postman, Apache Bench, JMeter, and Java Concurrency Utilities
Full-Stack Internet Architecture
Full-Stack Internet Architecture
May 5, 2025 · Backend Development

Using CountDownLatch in Java to Synchronize Multiple Threads for a Lucky Card Collection Example

This article explains the Java CountDownLatch utility, demonstrates its countdown synchronization mechanism with a lucky‑card‑collection scenario, provides a complete runnable example, and shows how the main thread waits for all worker threads to finish before proceeding to the lottery step.

CountDownLatchJavaSynchronization
0 likes · 5 min read
Using CountDownLatch in Java to Synchronize Multiple Threads for a Lucky Card Collection Example
FunTester
FunTester
Jan 9, 2025 · Backend Development

Understanding and Using CountDownLatch in Java Concurrency

This article explains the purpose, basic methods, best‑practice usage, and typical scenarios of Java's CountDownLatch utility, providing code examples and a comparison with Thread.sleep to help developers synchronize multiple threads effectively.

CountDownLatchJavaThread Synchronization
0 likes · 9 min read
Understanding and Using CountDownLatch in Java Concurrency
Top Architecture Tech Stack
Top Architecture Tech Stack
Nov 26, 2024 · Backend Development

Understanding CountDownLatch and CompletableFuture in Java Concurrency

This article explains the purpose, typical usage scenarios, and provides concrete code demonstrations of Java's CountDownLatch and CompletableFuture, comparing their synchronization versus asynchronous capabilities and guiding developers on selecting the appropriate tool for effective multithreaded programming.

CompletableFutureCountDownLatchJava
0 likes · 6 min read
Understanding CountDownLatch and CompletableFuture in Java Concurrency
Sanyou's Java Diary
Sanyou's Java Diary
Jul 22, 2024 · Backend Development

Why Does My ThreadPool Freeze? Uncovering the Hidden Deadlock Pitfall

This article explains a subtle thread‑pool deadlock caused by parent‑child task interactions, demonstrates the issue with a reproducible demo, analyzes why the latch logic fails, and provides a practical solution of isolating thread pools to avoid false‑deadlock behavior in microservices.

CountDownLatchJavaconcurrency
0 likes · 11 min read
Why Does My ThreadPool Freeze? Uncovering the Hidden Deadlock Pitfall
Top Architect
Top Architect
Aug 17, 2023 · Backend Development

Thread Communication in Java: volatile, wait/notify, CountDownLatch, ReentrantLock+Condition, and LockSupport

This article explains five Java thread‑communication techniques—volatile variables, Object.wait()/notify(), CountDownLatch, ReentrantLock with Condition, and LockSupport—providing code examples and detailed explanations of how each method works and its synchronization behavior, including sample programs that add elements to a list, demonstrate notification timing, and show how locks are acquired and released.

CountDownLatchJavaLockSupport
0 likes · 11 min read
Thread Communication in Java: volatile, wait/notify, CountDownLatch, ReentrantLock+Condition, and LockSupport
Mike Chen's Internet Architecture
Mike Chen's Internet Architecture
Apr 20, 2023 · Backend Development

Overview of Four Core Java Concurrency Utilities

This article introduces the four essential Java concurrency utilities—CountDownLatch, CyclicBarrier, Semaphore, and Exchanger—explaining their functions, underlying principles, typical usage patterns, and practical scenarios such as thread synchronization, resource limiting, and data exchange in multithreaded applications.

CountDownLatchCyclicBarrierExchanger
0 likes · 7 min read
Overview of Four Core Java Concurrency Utilities
Selected Java Interview Questions
Selected Java Interview Questions
Sep 17, 2022 · Backend Development

Converting Asynchronous Calls to Synchronous in Java: Five Common Techniques

This article explains how to turn Java asynchronous invocations into synchronous ones by demonstrating five approaches—wait/notify, condition locks, Future, CountDownLatch, and CyclicBarrier—each illustrated with complete code examples and detailed execution flow.

CountDownLatchCyclicBarrierFuture
0 likes · 11 min read
Converting Asynchronous Calls to Synchronous in Java: Five Common Techniques
Selected Java Interview Questions
Selected Java Interview Questions
May 19, 2022 · Backend Development

How to Detect When a ThreadPoolExecutor Has Finished All Tasks in Java

This article compares several practical techniques—using isTerminated after shutdown, comparing task counts, employing CountDownLatch, maintaining a manual counter, and checking Future.isDone—to reliably determine when a Java ThreadPoolExecutor has completed all submitted jobs, complete with code examples and pros and cons for each method.

CountDownLatchFutureJava
0 likes · 10 min read
How to Detect When a ThreadPoolExecutor Has Finished All Tasks in Java
IT Services Circle
IT Services Circle
Apr 3, 2022 · Backend Development

Four Ways to Determine When a Java ThreadPool Has Completed All Tasks

This article explains four practical techniques—using isTerminated, comparing task counts, CountDownLatch, and CyclicBarrier—to reliably detect when a Java ThreadPoolExecutor has finished executing all submitted tasks, including code examples, advantages, disadvantages, and a summary of each method.

CountDownLatchCyclicBarrierJava
0 likes · 12 min read
Four Ways to Determine When a Java ThreadPool Has Completed All Tasks
FunTester
FunTester
Dec 25, 2021 · Backend Development

Java Thread Synchronization Utilities: CountDownLatch, CyclicBarrier, and Phaser

An overview of Java’s three primary thread‑synchronization tools—CountDownLatch, CyclicBarrier, and Phaser—explaining their placement in java.util.concurrent, typical use‑cases such as coordinating multi‑threaded tasks in performance testing, and the advantages of each, complemented by illustrative diagrams.

CountDownLatchCyclicBarrierJava
0 likes · 7 min read
Java Thread Synchronization Utilities: CountDownLatch, CyclicBarrier, and Phaser
Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
Nov 1, 2021 · Backend Development

Understanding Java Concurrency Utilities: CyclicBarrier, CountDownLatch, Semaphore, and Exchanger

This article provides a comprehensive overview of Java's core concurrency utilities—CyclicBarrier, CountDownLatch, Semaphore, and Exchanger—explaining their purposes, internal mechanisms, constructors, usage patterns, and code examples to help developers master multithreaded programming.

CountDownLatchCyclicBarrierExchanger
0 likes · 11 min read
Understanding Java Concurrency Utilities: CyclicBarrier, CountDownLatch, Semaphore, and Exchanger
政采云技术
政采云技术
Oct 22, 2021 · Fundamentals

Java Concurrency Tools: CountDownLatch, CyclicBarrier, and Semaphore

This article explains three Java concurrency tools - CountDownLatch, CyclicBarrier, and Semaphore - detailing their mechanisms, source code analysis, and practical usage scenarios with code examples.

AQSCountDownLatchCyclicBarrier
0 likes · 13 min read
Java Concurrency Tools: CountDownLatch, CyclicBarrier, and Semaphore
Top Architect
Top Architect
Aug 10, 2021 · Backend Development

Understanding Java Concurrency Utilities: CountDownLatch, CyclicBarrier, Semaphore, and Exchanger

This article explains four Java concurrency utilities—CountDownLatch, CyclicBarrier, Semaphore, and Exchanger—detailing their concepts, typical use cases, and providing complete code examples that demonstrate synchronization patterns such as thread coordination, resource limiting, and data exchange.

CountDownLatchCyclicBarrierExchanger
0 likes · 13 min read
Understanding Java Concurrency Utilities: CountDownLatch, CyclicBarrier, Semaphore, and Exchanger
Top Architect
Top Architect
May 24, 2021 · Backend Development

Understanding CountDownLatch, CyclicBarrier, Semaphore, and Exchanger in Java

This article explains Java’s concurrency utilities CountDownLatch, CyclicBarrier, Semaphore, and Exchanger, illustrating their concepts with race‑style analogies, providing complete code examples, and showing execution results to demonstrate how threads can synchronize, wait, limit, and exchange data.

CountDownLatchCyclicBarrierExchanger
0 likes · 12 min read
Understanding CountDownLatch, CyclicBarrier, Semaphore, and Exchanger in Java
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Apr 9, 2021 · Backend Development

Understanding and Using CountDownLatch in Java for Thread Coordination

This article explains the concept of Java's CountDownLatch, compares it with join(), demonstrates how to coordinate thread‑pool tasks using the latch, provides complete example code, and details its internal mechanism and common methods for synchronizing concurrent operations.

CountDownLatchJavaSynchronization
0 likes · 8 min read
Understanding and Using CountDownLatch in Java for Thread Coordination