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...
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 ;-)
Simple and Awesome explanation. You deserve much more subscribers.
Thank you!!
Agree! Very well explained with workflows!
Watched all 4 videos at once. Precise, crisp, concise, has all the important details along with coding examples. Just wonderful. Lockdown regards.
your are the only guy who let me understand all of the Thread concepts... thank you
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.
Thank you so much Adesh!
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 .
Never seen a such simple explanation of one of the most trivial topics. Thank u so much.Amazing . Unparalleled explanation.
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.
The content, the explanation, along with the code usage , everything is amazing man.
Perfect video for a beginner in Executor service. Best part is visualization. Thanks for making this! really appreciate.
I have watched so many tutorials on executor service none of them can match this explanation, thanks a lot
I had some confusion earlier on ExecutorService. After watching your presentations, things are much clear now. Thank you for great explanation!!.
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
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.
You're welcome sir! I'm happy it helped
Could not have understood this clearly ever. Thanks for putting this concept in such a short simple way🙏
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
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
great explanation my friend. I watched this entire threadpool series (Y).
Awesome after 3 days of searching finally found the correct video
Excellent video...never understood the Executor service better than today
hands down the best explanation for Callable and Future 👍
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 🤘🏿😎
Best of luck!
@@DefogTech Got through round 1. Thank you boss ! I'd like to meet you someday and learn a thing or two _/\_
One of the best content related to ExecutorService .
U have really outstanding knowledge special in Threading sections seriously u deserve more and more subscribers Thanks a lot's 🙏
The best explanation ever! Thank you. Better than java concurrency in practice
watching this after 3 years still a gem
You earned another subscriber. You are just fantastic than many coding youtubers or Udemy instructors. Defog Tech you are awesome.
wonderful explanation. no lagging. every second is valid and clear. please continue the same way.
Thank you for the kind words!
man, your concurrency series is absolutely amazing!
Excellent videos on executorService, understood every part of it. Thanks a lot :)
Very clear explanation ... thanks.. you Rock !!!
amazing teacher / guru. Thanks Defog Tech.
This is just extra ordinary explanation. Hats off!
The explanation is very crisp and neat. Thank you so much!!🙌🏽🙌🏽
Brother your content is specific and well formatted. Have cleared many doubts. Keep Going. God bless.
Very good series on executors ! I didn't find any other better videos for this topic. Thank you!
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.
Repeating visitor, and repeating LOUD... AWESOME :-)
omg bro the only channel that could explain it properly!
Give this man a medal 🥉
Fell in love with interrupts in java is a different ball game.
your explanation is far better than any udemy course........ :)
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..
Best Explanation I have seen so far.
ExecutorService series is simple and crisp. +1 subscribed.
Awesome explanation of the entire series. Thanks a lot!!
My god. You saved my android project for college. Now I finally learned how to use the thread pools! Thanks!!!
That is awesome to hear! I am very happy!
The best tutorial for multi threading.Thanks a lot buddy!!
I love how the way you explain things, keep up the good work!!
Crisp, clear and helpful.
Good explanation. would be happy to see ExecutorCompletionService as part of this video. Its really helpful.
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 :)
found
Best video of callable interface
Very clear explanation.. thank you buddy!!
Very Complicated topic in java and got everything which i want.... Thanks alot for it
This threadpool series was no less than Chernobyl or Spy. I watched it in 1 go :p
i really like the way you explain . fabulous thanks sir
Hey... been through some of your videos and those were more informative than CS degree😂. Keep up the good work buddy!👍
Thanks for this ExecutorService series :)
I love all your videos. I have actually understood the multithreading concepts from your videos. Please make some for more basic core java concepts!!!
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..
Very helpful and easy to understand video, thank you :)
You have a really good teaching skills!
Much thanks for these videos.Hats off to you for delivering such awesome explanation of Multithreading topics.
+shailesh p Thank you sir! I'm glad it helped
Nice video... Executor service is clear to me after watching your video. Thank you very much for making this tutorial.
You're welcome. Glad it helped!
This is amazing tutorial. Thank you so much!!
Exceptional Wonderful. Thank you.
Thanks for the wonderful Explanation
very well explained all the four video tutorials for executor service
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?
very good and simple explanation... Keep upload new video Sir..
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 !
Thank you so much for your kind words!
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
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
Simple and effective explanation.. Thanks for this video.
Thank you for such a wonderful explanation
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
You're welcome sir! I am so happy it helped.. let me know if there are any other topics for videos
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✌️
@@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
You got a new subscriber today :) Keep going in the same pace with such an amazing, crystal clear explanation of the concepts!
Bro.....Keep doing this work... you are awsm
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.
Very nice explanation in all videos....Thanks for the stuff.
Truly valuable all videos and great work Defog Tech.
Thank you sir!
Thank you for the videos. This is great work. Could you please create a lecture on Reflection in Java?
Well explained! Much appreciated
very clean, easy to comprehend. Thank you!
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?
This video was very well done.
Loved your series. Please keep up the good work!
Dude, you're awesome. Respect!
Thank you so much buddy!
@@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?
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
Very well explained. Thank you very much. Please keep posting
Thank you for the kind words sir! I definitely plan to keep posting more.
hi ajay,, one more channel..great buddy..well done..good job
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 :)
I liked these ExecutorService videos , thanks
You earned a subscriber my friend.
Really excellent explanation. Its a God given man. Use it. Keep it up...
Thank you sir!
thank you so much for this awesome playlist
Excellent explanation.
Please create videos on
1. Custom thread pool.
2. Producer consumer problem.
3. Locking.
Thanks
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.
thanks, if possible please make some videos on design patterns as well.
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?
Very nice explanation.Thank you for your efforts. It would be helpful if you can add a series on java collections.
Thanks for clearing the java threads, I hope u make an tutorial for DS and Algorithms too
You have done an amazing job explaining this.