Тёмный

A Guide To CompletableFuture in Java with Examples | Asynchronous Operations in Java | Geekific 

Geekific
Подписаться 29 тыс.
Просмотров 21 тыс.
50% 1

Support us on Patreon: / geekific
GitHub Repository: github.com/geekific-official/...
Stay updated on our videos by subscribing to the channel and hitting the like button!
Java’s Future API was introduced in Java 5, and a Future is used as a reference to the result of an asynchronous computation. We previously explained and gave a lot of examples related to multi-threaded operations in Java, and in this video we further expand on this topic by tackling Completable Futures which were introduced in Java 8 and their main purpose was to handle the limitations of the Future class.
Timestamps:
00:00 Introduction
00:07 What are Completable Futures?
01:00 What are Future Limitations? Why Completable Futures?
02:49 Creating a Completable Future
03:54 Acting on a Completable Future
05:55 Combining Completable Futures
08:11 Exception Handling
09:21 Thanks for Watching!
If you found this video helpful, check other Geekific uploads:
- Object-Oriented Programming Fundamentals: • What is Object-Oriente...
- SOLID Principles and Best Practices: • SOLID Design Principle...
- Recursion Made Simple, Recursive Methods: • What is Recursion? | R...
- Use-Case and Sequence Diagrams: • UML Use-Case and Seque...
- What is a Thread? (Process, Program, Parallelism, Scheduler Explained): • What is a Thread? | Th...
- The Volatile and Synchronized Keywords in Java, Atomic Variables in Java: • The Volatile and Synch...
- Creating Threads and Executing Tasks in Java (Thread, Runnable, Callable, Future, ExecutorService): • Creating Threads and E...
- Locks, Monitors and Semaphores Explained in Java, Optimistic Locking: • Locks, Monitors and Se...
#Geekific #CompletableFuture #Java #Multithreading

Опубликовано:

 

27 май 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 20   
@OldBalance42
@OldBalance42 8 месяцев назад
Great explanation, better than other guides on the internet.
@liam45537
@liam45537 Год назад
Hands down the best explanation of completable futures out there. You're a master at explaining difficult concepts
@geekific
@geekific Год назад
Thanks! Glad it helped :)
@caiosaldanha2371
@caiosaldanha2371 Месяц назад
That was the best explamnation so far! Thank you very much!
@petrow_
@petrow_ 27 дней назад
So cool, at last. Thanks a lot!
@mac_88_59
@mac_88_59 3 месяца назад
This explanation is amazing and so clear. Thank you.
@svalyavasvalyava9867
@svalyavasvalyava9867 Год назад
Thank you!!! Great topic and explanation of it.
@iaburrahman3454
@iaburrahman3454 6 месяцев назад
Enjoyable explanation. Thanks a lot.
@radhikashroff2643
@radhikashroff2643 6 месяцев назад
Excellent Explanation !
@Official_Joshua
@Official_Joshua 10 месяцев назад
Thanks so much for this video it helped alot. This is the best one yet. i tried all the other videos and this one made it clear
@gamesandstuff4188
@gamesandstuff4188 2 месяца назад
Great explanation
@shashikantnipanikar860
@shashikantnipanikar860 Месяц назад
Really helpful
@ppdmartell
@ppdmartell 10 месяцев назад
@geekific dude, your videos are jewels.
@khaled.noordin
@khaled.noordin Год назад
Thanks a lot
@abdelkrimhaddadi5098
@abdelkrimhaddadi5098 Год назад
Perfect Thanks a lot !
@geekific
@geekific Год назад
Glad it was helpful!
@misaelpereira9679
@misaelpereira9679 4 месяца назад
Such a wonderful explanation with good examples of each scenario, definitely you get to the point!, you get a new suscriber!
@arnabchowdhury4892
@arnabchowdhury4892 6 месяцев назад
Please create video on fork and join
@acekokuren
@acekokuren Год назад
I wondered if you might have tackled it elsewhere, but when I attempt to use the .sleep() method, it says that an InterruptedException can be thrown. Now I can handle this by either adding it to the method signature, or use a try-catch block. Now when I use a try-catch block, there is a warning that it is not enough to simply ignore the exception that is thrown, it needs to be re-thrown or interrupted. I have used something along the lines of: ``` ... try { TimeUnit.x.sleep(y); } catch (InterruptedException e) { Thread.currentThread.interrupt(); } ... ``` Now I have no idea what the reason is behind this, and then when I have tried to throw the InterruptedException, it asks me to surround it in a try catch block inside the catch block. Not sure if this is thread specific, and if you covered it anywhere else, or able to cover it. Thanks in advance for any information.
@geekific
@geekific Год назад
First, you just gave me an idea for a video! Thanks :) And to briefly answer your question, yes what you are doing is the way to go, and that's because each thread has kind of an "interrupted" flag, and if you simply ignore the exception, the thread's interrupted flag will not be set, and it will continue executing as if nothing happened, or that thread won't be handled appropriately by other threads. By calling this method in the catch block, you are setting the interrupted flag on the thread that was interrupted, allowing other parts of your code to check it and handle the thread appropriately. Hope this partly answers it, and stay tuned for more videos!
Далее
Introduction to CompletableFuture in Java 8
19:34
Просмотров 317 тыс.