|
5 | 5 | import java.util.concurrent.Executors; |
6 | 6 |
|
7 | 7 | /** |
8 | | - * CountDownLatch Java class to synchronize your threads’ activities. |
9 | | - * |
| 8 | + * {@link java.util.concurrent.CountDownLatch} Java class to synchronize your threads’ activities. |
| 9 | + * <br><br> |
10 | 10 | * Source: |
11 | | - * (http://stackoverflow.com/questions/17827022/what-is-countdown-latch-in-java-multithreading) |
| 11 | + * <em>http://stackoverflow.com/questions/17827022/what-is-countdown-latch-in-java-multithreading</em><br> |
| 12 | + * |
12 | 13 | * Any thread, usually main thread of application, which calls |
13 | | - * CountDownLatch.await() will wait until count reaches zero or its interrupted |
| 14 | + * {@link java.util.concurrent.CountDownLatch#await()} will wait until count reaches zero or its interrupted |
14 | 15 | * by another thread. All other thread are required to do count down by calling |
15 | | - * CountDownLatch.countDown() once they are completed or ready. |
16 | | - * |
| 16 | + * {@link java.util.concurrent.CountDownLatch#countDown()} once they are completed or ready. |
| 17 | + * <br> |
17 | 18 | * As soon as count reaches zero, Thread awaiting starts running. One of the |
18 | | - * disadvantage of CountDownLatch is that its not reusable once count reaches to |
19 | | - * zero you can not use CountDownLatch any more. |
20 | | - * |
21 | | - * Use CountDownLatch when one thread like main thread, require to wait for one |
22 | | - * or more thread to complete, before it can start processing. |
23 | | - * |
24 | | - * Classical example of using CountDownLatch in Java is any server side core |
25 | | - * Java application which uses services architecture, where multiple services |
| 19 | + * disadvantage of {@link java.util.concurrent.CountDownLatch} is that it's |
| 20 | + * not reusable once the count reaches to |
| 21 | + * zero you can not use {@link java.util.concurrent.CountDownLatch} any more. |
| 22 | + * <br><br> |
| 23 | + * Use {@link java.util.concurrent.CountDownLatch} when one thread, like main |
| 24 | + * thread, require to wait for one or more threads to complete, before it can |
| 25 | + * start processing. |
| 26 | + * <br><br> |
| 27 | + * Classical example of using {@link java.util.concurrent.CountDownLatch} in |
| 28 | + * Java is any server side core Java application which uses services |
| 29 | + * architecture, where multiple services |
26 | 30 | * are provided by multiple threads and application can not start processing |
27 | 31 | * until all services have started successfully. |
28 | | - * |
29 | | - * Codes with minor comments are from http://www.caveofprogramming.com/youtube/ |
| 32 | + * <br><br> |
| 33 | + * Codes with minor comments are from <em>http://www.caveofprogramming.com/youtube/</em><br> |
30 | 34 | * also freely available at |
31 | | - * https://www.udemy.com/java-multithreading/?couponCode=FREE |
| 35 | + * <em>https://www.udemy.com/java-multithreading/?couponCode=FREE</em> |
32 | 36 | * |
33 | 37 | * @author Z.B. Celik <[email protected]> |
34 | 38 | */ |
|
0 commit comments