Guide to CountDownLatch in Java | When and How to use ?

แชร์
ฝัง
  • เผยแพร่เมื่อ 13 ต.ค. 2024

ความคิดเห็น • 7

  • @AnkurVashishtha01
    @AnkurVashishtha01 ปีที่แล้ว +1

    Your service initialization example solved a lot of doubts for me. Thank you.

  • @tanson86
    @tanson86 ปีที่แล้ว +2

    In completablefuture when the main thread dies all the other thread dies (to prevent this we use the join method), but why is it behaving different over here... Even after the main thread finished the log from thread that took 7 seconds got printed.

    • @TechRecipesTR
      @TechRecipesTR  ปีที่แล้ว +1

      In completable future threads which are created are daemon threads by default hence we had to join. Here we are using new Thread() so these are non-daemon threads hence thread continues even when main thread finishes.

    • @tanson86
      @tanson86 ปีที่แล้ว +1

      @@TechRecipesTR🙏Appreciate

    • @TechRecipesTR
      @TechRecipesTR  ปีที่แล้ว +1

      No problem, good observation 👍🏼

  • @9547970570
    @9547970570 7 หลายเดือนก่อน +1

    This is the best explanation of countdown latch I found in the internet .
    Your videos are underrated 😊