Java ExecutorService - Part 4 - Callable / Future

Поділитися
Вставка
  • Опубліковано 15 вер 2024
  • Learn how to parallelize your tasks and operations easily in Java without cooking up your own Threads.
    Part 1: Introduction - • Java ExecutorService -...
    Part 2: Type of Pools - • Java ExecutorService -...
    Part 3: Constructor / LifeCycle - • Java ExecutorService -...
    Part 4: Callable/Future - • Java ExecutorService -...
    Channel
    ----------------------------------
    Master difficult programming concepts in few minutes. I try to explain difficult concepts like Java concurrency in simple to understand manner using animations and small code snippets. Explore videos on topics like Spring Boot, Cloud Foundry, Java 8 (with more coming soon). I am happy to clarify your doubts. Ask me anything in the comments. I am also happy to take requests for new videos.
    New video added every Sunday.
    Subscribe or explore the channel - bit.ly/defog_tech
    Playlists
    ----------------------------------
    Java Executor Service - bit.ly/exec_srvc
    Java Concurrency - bit.ly/java_crncy
    Spring Boot 2.0 - bit.ly/spr_boot2
    Java 8 - bit.ly/java_8-11
    Intellij IDEA Shortcuts - bit.ly/i_idea
    Popular Videos
    ----------------------------------
    Executor Service - • Java ExecutorService -...
    Introduction to CompletableFuture - • Introduction to Comple...
    Understand how ForkJoinPool works - • Understanding how Fork...
    Java Memory Model in 10 minutes - • Java Memory Model in 1...
    Volatile vs Atomic - • Using volatile vs Atom...
    What is Spring Webflux - • What is Spring Webflux...

КОМЕНТАРІ • 327

  • @beautifully_scarred_lea
    @beautifully_scarred_lea 4 роки тому +100

    The only coding youtuber that I have watch their whole ExecutorService class series. Thanks I got my home work done in no time!!!! Keep up with the quality content. You just got another subscriber ;-)

  • @Velanvms
    @Velanvms 5 років тому +77

    Simple and Awesome explanation. You deserve much more subscribers.

  • @kscd009
    @kscd009 4 роки тому +2

    Watched all 4 videos at once. Precise, crisp, concise, has all the important details along with coding examples. Just wonderful. Lockdown regards.

  • @chantifg
    @chantifg 5 років тому +2

    your are the only guy who let me understand all of the Thread concepts... thank you

  • @adeshpandey6989
    @adeshpandey6989 2 роки тому +3

    You're the rare type of person who explains their things like they wanted.
    Never thought learning Thread would be so much fun and easy.
    Best explanation I found in the internet. Seems you gave your heart out in the video.

    • @DefogTech
      @DefogTech  2 роки тому +2

      Thank you so much Adesh!

  • @GanaviN-f1o
    @GanaviN-f1o 2 місяці тому

    Bhai, u created this videos 6years back.. but this videos are really helpful now aswell. thanks a lot for explaining this concepts in a easy way .

  • @harshadakhandekar7013
    @harshadakhandekar7013 4 роки тому +1

    Never seen a such simple explanation of one of the most trivial topics. Thank u so much.Amazing . Unparalleled explanation.

  • @samirpanchal5883
    @samirpanchal5883 2 роки тому

    I was always confused with ExecutorService but after watching 4 video series i wrote and understood some production level complex codes and its explained so deeply that i no longer have to refer any website. Thank you very much and keep delivering quality content.

  • @Amansharma-dr6cx
    @Amansharma-dr6cx 3 роки тому +2

    The content, the explanation, along with the code usage , everything is amazing man.

  • @mahimaverma711
    @mahimaverma711 3 роки тому

    Perfect video for a beginner in Executor service. Best part is visualization. Thanks for making this! really appreciate.

  • @sakship1558
    @sakship1558 Рік тому

    I have watched so many tutorials on executor service none of them can match this explanation, thanks a lot

  • @pushkarraju
    @pushkarraju 4 роки тому +1

    I had some confusion earlier on ExecutorService. After watching your presentations, things are much clear now. Thank you for great explanation!!.

  • @abhishekkumarsingh3125
    @abhishekkumarsingh3125 5 років тому +2

    Thanks bro .. I was working with Grpc Server in my Internship . All though the server service implementation is quite Easy I failed in doing unit testing for Asynch Server calls .. Your videos helped a lot

  • @nitishsingla1234
    @nitishsingla1234 6 років тому

    That's a deep, crystal clear explanation of the concepts. Threads used to give me nightmares, which no longer is the case. Many thanks for uploading these videos.

    • @DefogTech
      @DefogTech  6 років тому +1

      You're welcome sir! I'm happy it helped

  • @r_if_aleee5218
    @r_if_aleee5218 3 роки тому

    Could not have understood this clearly ever. Thanks for putting this concept in such a short simple way🙏

  • @vipinahuja6096
    @vipinahuja6096 3 роки тому

    Woww .. this was available since 2018 and I got to know this today. I would have nailed interviews if watched earlier. however, as we say it's never late for knowledge. Thanks, Mate for this

  • @user-tn2bj9oh3g
    @user-tn2bj9oh3g 2 роки тому

    Thank you very much!
    despite it is sometimes hard to understand your speech (because of indian accent), your lessons are short nice and concise
    you keep it simple, I like that

  • @syednoorullahshah9194
    @syednoorullahshah9194 4 роки тому +4

    great explanation my friend. I watched this entire threadpool series (Y).

  • @TomarSahab
    @TomarSahab 3 роки тому

    Awesome after 3 days of searching finally found the correct video

  • @rohit190388
    @rohit190388 3 роки тому

    Excellent video...never understood the Executor service better than today

  • @SovietFrontier
    @SovietFrontier 5 років тому +1

    hands down the best explanation for Callable and Future 👍

  • @akshayvishwanath2591
    @akshayvishwanath2591 3 роки тому

    You're a legend. 🔥 It's 3am now.. I've got my interview tomorrow morning with one of the top product companies and these videos of your's are 🤘🏿😎

    • @DefogTech
      @DefogTech  3 роки тому +1

      Best of luck!

    • @akshayvishwanath2591
      @akshayvishwanath2591 3 роки тому

      @@DefogTech Got through round 1. Thank you boss ! I'd like to meet you someday and learn a thing or two _/\_

  • @sreenivasareddy6325
    @sreenivasareddy6325 4 роки тому

    One of the best content related to ExecutorService .

  • @pratapjavasingh3239
    @pratapjavasingh3239 3 роки тому +1

    U have really outstanding knowledge special in Threading sections seriously u deserve more and more subscribers Thanks a lot's 🙏

  • @mriduljayan4466
    @mriduljayan4466 2 роки тому

    The best explanation ever! Thank you. Better than java concurrency in practice

  • @rizwansayyed7893
    @rizwansayyed7893 2 роки тому

    watching this after 3 years still a gem

  • @adityamarreddy7082
    @adityamarreddy7082 4 роки тому

    You earned another subscriber. You are just fantastic than many coding youtubers or Udemy instructors. Defog Tech you are awesome.

  • @chinna_chinnu_6542
    @chinna_chinnu_6542 6 років тому

    wonderful explanation. no lagging. every second is valid and clear. please continue the same way.

    • @DefogTech
      @DefogTech  6 років тому

      Thank you for the kind words!

  • @vitaliidombrovskyi9335
    @vitaliidombrovskyi9335 2 роки тому

    man, your concurrency series is absolutely amazing!

  • @RahulSingh-qe4sw
    @RahulSingh-qe4sw Рік тому

    Excellent videos on executorService, understood every part of it. Thanks a lot :)

  • @custardapple5031
    @custardapple5031 5 років тому +1

    Very clear explanation ... thanks.. you Rock !!!

  • @daumtto
    @daumtto Рік тому

    amazing teacher / guru. Thanks Defog Tech.

  • @shub0y
    @shub0y 5 років тому

    This is just extra ordinary explanation. Hats off!

  • @mvaishu22
    @mvaishu22 3 роки тому

    The explanation is very crisp and neat. Thank you so much!!🙌🏽🙌🏽

  • @richardbux8079
    @richardbux8079 4 роки тому

    Brother your content is specific and well formatted. Have cleared many doubts. Keep Going. God bless.

  • @explore_with_ganesh
    @explore_with_ganesh 2 роки тому

    Very good series on executors ! I didn't find any other better videos for this topic. Thank you!

  • @manishmanghwani731
    @manishmanghwani731 3 роки тому

    Great explanation as usual. Wanted to add one point for the blocked state. If the input is bounded and we know the count of Futures then we can use combination of count && isDone() method so that main method / caller function never goes into blocked state.

  • @vipinkoul9129
    @vipinkoul9129 3 роки тому

    Repeating visitor, and repeating LOUD... AWESOME :-)

  • @abhinavraut3099
    @abhinavraut3099 5 років тому

    omg bro the only channel that could explain it properly!

  • @sriyansh100
    @sriyansh100 4 роки тому +3

    Give this man a medal 🥉

  • @aatifnazar8203
    @aatifnazar8203 3 роки тому

    Fell in love with interrupts in java is a different ball game.

  • @yuvarajgaddam8217
    @yuvarajgaddam8217 Рік тому

    your explanation is far better than any udemy course........ :)

  • @harikavolam7123
    @harikavolam7123 3 роки тому

    Thanks a lot for explaining.. You saved a lot of time and I got the knowledge for which I am looking for by watching whole your Executor series... Keep doing great content..

  • @kamireddysrinu4505
    @kamireddysrinu4505 3 роки тому

    Best Explanation I have seen so far.

  • @rakesh7105
    @rakesh7105 3 роки тому

    ExecutorService series is simple and crisp. +1 subscribed.

  • @sureshnamala6776
    @sureshnamala6776 8 місяців тому

    Awesome explanation of the entire series. Thanks a lot!!

  • @legendofarthur
    @legendofarthur 5 років тому

    My god. You saved my android project for college. Now I finally learned how to use the thread pools! Thanks!!!

    • @DefogTech
      @DefogTech  5 років тому +1

      That is awesome to hear! I am very happy!

  • @hiteshsannithi7836
    @hiteshsannithi7836 5 років тому

    The best tutorial for multi threading.Thanks a lot buddy!!

  • @JimmyChane
    @JimmyChane 4 роки тому +1

    I love how the way you explain things, keep up the good work!!

  • @itichauhan8605
    @itichauhan8605 3 роки тому

    Crisp, clear and helpful.

  • @pravinkhurd9437
    @pravinkhurd9437 4 роки тому

    Good explanation. would be happy to see ExecutorCompletionService as part of this video. Its really helpful.

  • @jagansinghchoudhary
    @jagansinghchoudhary 4 роки тому

    Things that are not easy to find on google with respect to Programming context are available here. Great Work. I will continue to follow you. Add CompletableFuture to this series or let me know if already available. Keep up the good work, I am sure, Future is great :)

  • @harshitanand8216
    @harshitanand8216 Рік тому

    Best video of callable interface

  • @AkashMulik7
    @AkashMulik7 2 роки тому

    Very clear explanation.. thank you buddy!!

  • @sultanahmed5646
    @sultanahmed5646 5 років тому

    Very Complicated topic in java and got everything which i want.... Thanks alot for it

  • @rush2589
    @rush2589 3 роки тому

    This threadpool series was no less than Chernobyl or Spy. I watched it in 1 go :p

  • @faheemsyed9481
    @faheemsyed9481 2 роки тому

    i really like the way you explain . fabulous thanks sir

  • @dixitgupta6868
    @dixitgupta6868 3 роки тому +1

    Hey... been through some of your videos and those were more informative than CS degree😂. Keep up the good work buddy!👍

  • @johnpranoy2860
    @johnpranoy2860 2 роки тому

    Thanks for this ExecutorService series :)

  • @veenachaudhari1480
    @veenachaudhari1480 3 роки тому

    I love all your videos. I have actually understood the multithreading concepts from your videos. Please make some for more basic core java concepts!!!

  • @akware977
    @akware977 4 роки тому

    Thanks alot for wonderful series...clear all concept from scratch...
    If possible please make videos on Java Cryptography...no good contents available on UA-cam..

  • @georgi_verstapen33
    @georgi_verstapen33 2 роки тому

    Very helpful and easy to understand video, thank you :)

  • @ja3ekja
    @ja3ekja 4 роки тому +1

    You have a really good teaching skills!

  • @shellindebted5328
    @shellindebted5328 6 років тому

    Much thanks for these videos.Hats off to you for delivering such awesome explanation of Multithreading topics.

    • @DefogTech
      @DefogTech  6 років тому

      +shailesh p Thank you sir! I'm glad it helped

  • @ardhendusaha2072
    @ardhendusaha2072 6 років тому

    Nice video... Executor service is clear to me after watching your video. Thank you very much for making this tutorial.

    • @DefogTech
      @DefogTech  6 років тому

      You're welcome. Glad it helped!

  • @МарияПавлова-з4е

    This is amazing tutorial. Thank you so much!!

  • @theunusual4566
    @theunusual4566 Рік тому

    Exceptional Wonderful. Thank you.

  • @sathishravindrannair297
    @sathishravindrannair297 7 місяців тому

    Thanks for the wonderful Explanation

  • @Bibhaw
    @Bibhaw 5 років тому

    very well explained all the four video tutorials for executor service

  • @abhijitdaund237
    @abhijitdaund237 5 років тому +1

    Can you please create a video on how exactly threads in thread pool are kept alive even after executing given tasks? In normal case once thread is finished with execution of a task, the thread is killed. How exactly it is handled in ExecutiveService?

  • @ashutoshshukla650
    @ashutoshshukla650 4 роки тому

    very good and simple explanation... Keep upload new video Sir..

  • @kbhoyi
    @kbhoyi 5 років тому

    Defog Tech - Your this series of videos is simply awesome. Are you serious that multi-threading can be explained in such a simple manner? I'm wowwed .with your art of making it easy to understand. Stay blessed !

    • @DefogTech
      @DefogTech  5 років тому +1

      Thank you so much for your kind words!

  • @atirashok
    @atirashok 5 років тому

    I like the way you have put this content, I'd still say: put one or two programmatic demos for audience to get hands on... regardless: still super cool!!!! Good Luck

  • @sachinchauhan4859
    @sachinchauhan4859 5 років тому

    Thanks for Sharing the video's, they are so knowledgeable and explained in a very simple manner. I will eagerly wait for your videos in the future. Thanks

  • @sadas929
    @sadas929 5 років тому

    Simple and effective explanation.. Thanks for this video.

  • @aditydud
    @aditydud 3 роки тому

    Thank you for such a wonderful explanation

  • @suryakantsapkal8242
    @suryakantsapkal8242 5 років тому

    Thank you so much sir!!..You saved my days..Executor Service is complex topic and taught so easily..Respect#
    I will definitely go through all your other videos👍..Thanks

    • @DefogTech
      @DefogTech  5 років тому

      You're welcome sir! I am so happy it helped.. let me know if there are any other topics for videos

    • @suryakantsapkal8242
      @suryakantsapkal8242 5 років тому

      I would be very grateful if you upload some videos on internal working of concurrent data structures of java. I have seen all your videos on milti threading and I consider myself lucky that I could find your channel on UA-cam...I have no words to thank you✌️

    • @DefogTech
      @DefogTech  5 років тому +1

      @@suryakantsapkal8242 Thank you very much for your kind words! Will definitely add more on concurrency.. one about Project Loom (Java Fibers) coming this weekend hopefully

  • @nishanthk9100
    @nishanthk9100 4 роки тому

    You got a new subscriber today :) Keep going in the same pace with such an amazing, crystal clear explanation of the concepts!

  • @SatnamSingh-qn5jl
    @SatnamSingh-qn5jl 4 роки тому

    Bro.....Keep doing this work... you are awsm

  • @jaleelpasha3301
    @jaleelpasha3301 6 місяців тому

    Introduction:
    - The video covers advanced topics related to the ExecutorService in Java.
    - It focuses on the Callable interface and Future objects for handling tasks that return values.
    Key Points:
    - Runnable tasks cannot return values in Java.
    - The Callable interface is designed for tasks that return values.
    - Callable tasks implement the `call` method instead of `run` and specify the return type using generics.
    - The `submit` method is used to submit Callable tasks to the ExecutorService.
    - The `submit` method returns a Future object, which acts as a placeholder for the eventual result.
    - Future objects allow asynchronous retrieval of task results.
    - The `get` method of Future blocks until the result is available, or until a timeout occurs.
    - Multiple tasks can be submitted concurrently, and their Future objects can be stored in a list for later retrieval.
    - Future objects provide methods to check if the task is done, canceled, or completed successfully.
    - The `cancel` method allows for canceling tasks, but it may not be effective if the task has already started execution.
    - Methods like `isCancelled` and `isDone` provide status information about the tasks.
    Summary:
    - The Callable interface and Future objects enable handling tasks that return values in Java.
    - Callable tasks are submitted using the `submit` method, which returns a Future object representing the task's eventual result.
    - Future objects provide methods for retrieving task results, checking task status, and canceling tasks.
    - These features enhance the functionality and flexibility of the ExecutorService for managing asynchronous tasks.

  • @gauravvats7857
    @gauravvats7857 5 років тому

    Very nice explanation in all videos....Thanks for the stuff.

  • @saiprasadkyatam1702
    @saiprasadkyatam1702 6 років тому

    Truly valuable all videos and great work Defog Tech.

  • @AnimeshPaul23
    @AnimeshPaul23 5 місяців тому

    Thank you for the videos. This is great work. Could you please create a lecture on Reflection in Java?

  • @GuillermoPaulman
    @GuillermoPaulman 8 місяців тому

    Well explained! Much appreciated

  • @mufizshaikh8439
    @mufizshaikh8439 4 роки тому

    very clean, easy to comprehend. Thank you!

  • @Lucky-uz3je
    @Lucky-uz3je 5 років тому

    Hi,
    I have two doubts here.
    1. What happens to blocking call thread future.get() when respective running thread of thread pool throw exception or terminated abruptly before any return.
    2. After timeout of future.get(3000) , main thread executes further but what happens to the respective thread of the threadpool. Whether it executes further or get terminated?

  • @michaelfitzpatrick6942
    @michaelfitzpatrick6942 3 роки тому

    This video was very well done.

  • @khushable
    @khushable 3 роки тому

    Loved your series. Please keep up the good work!

  • @santoshshukla6055
    @santoshshukla6055 5 років тому +4

    Dude, you're awesome. Respect!

    • @DefogTech
      @DefogTech  5 років тому

      Thank you so much buddy!

    • @santoshshukla6055
      @santoshshukla6055 5 років тому

      @@DefogTech Any way we can reach out to you. Would might require help in preparing Data Structures?
      What are the next few topics we can expect? Any plans to hit DS?

    • @DefogTech
      @DefogTech  5 років тому +1

      I regularly check the UA-cam comments, you can post here or support@defogtech.com. Feel free to reach out.
      No immediate plans for DS though, I think its already covered by many folks. Are there any DS topics which are particularly tricky that you want me to create video for?
      Upcoming videos would be about Spring Webflux, Cloud Foundry and Testing. Do let me know if any other broad topics should be covered, will add it to the list

  • @venkatk161
    @venkatk161 6 років тому

    Very well explained. Thank you very much. Please keep posting

    • @DefogTech
      @DefogTech  6 років тому

      Thank you for the kind words sir! I definitely plan to keep posting more.

  • @ravi-thestar8501
    @ravi-thestar8501 5 років тому

    hi ajay,, one more channel..great buddy..well done..good job

    • @DefogTech
      @DefogTech  5 років тому +1

      This is not Ajay's channel, though I will take it as a compliment. He is a friend and a colleague of mine, immense respect :)

  • @rahulthakur00
    @rahulthakur00 5 років тому

    I liked these ExecutorService videos , thanks

  • @rishavmasih9450
    @rishavmasih9450 Рік тому

    You earned a subscriber my friend.

  • @manasranjan4
    @manasranjan4 6 років тому

    Really excellent explanation. Its a God given man. Use it. Keep it up...

  • @yashchamoli8695
    @yashchamoli8695 2 місяці тому

    thank you so much for this awesome playlist

  • @SachinVerma-wn1lg
    @SachinVerma-wn1lg 6 років тому

    Excellent explanation.
    Please create videos on
    1. Custom thread pool.
    2. Producer consumer problem.
    3. Locking.
    Thanks

    • @DefogTech
      @DefogTech  6 років тому

      I have plans to add video for locking.
      For Producer consumer problem, I suggest just use BlockingQueue, its best fit for such problems. Not sure I will make a video about it soon.

    • @SachinVerma-wn1lg
      @SachinVerma-wn1lg 6 років тому

      thanks, if possible please make some videos on design patterns as well.

  • @sukiriparanavithana677
    @sukiriparanavithana677 3 роки тому

    Hi, great visual explanation again. Yet I have same doubt why you are not creating any Blocking Queue object to be bound with thread pool here. You illustration shows a queue. Yet no queue used in the code. Does that means the futures does not need specific blocking queue?

  • @AbhaySingh-ir4fy
    @AbhaySingh-ir4fy 4 роки тому

    Very nice explanation.Thank you for your efforts. It would be helpful if you can add a series on java collections.

  • @dineshparmar1679
    @dineshparmar1679 3 роки тому

    Thanks for clearing the java threads, I hope u make an tutorial for DS and Algorithms too

  • @afnanrehman866
    @afnanrehman866 4 роки тому

    You have done an amazing job explaining this.