1. Tubelator AI
  2. >
  3. Videos
  4. >
  5. Science & Technology
  6. >
  7. #4 Java Programming CompletableFuture tutorial(Exception Handling)

#4 Java Programming CompletableFuture tutorial(Exception Handling)

Available In Following Subtitles
English
Variant 1
Posted on:
Java 8 Completablefuture is an extension to Java's Future API which was introduced in Java 5. In this tutorial series, you are going to learn how to use the Java 8 programming. You are going to learn how to handle exceptions using Java completablefutures. Completablefuture for asynchronous programming. You can use completable futures to run processes in the background using a different thread, thereby avoiding blocking the main thread. You would learn how to use supply async, run async, then accept, then apply, exceptionally and much more. #LemubitAcademy
tubelator logo

Instantly generate YouTube summary, transcript and subtitles!

chrome-icon Install Tubelator On Chrome

Video Summary & Chapters

No chapters for this video generated yet.

Video Transcript

0:00
in the last lesson I showed you how to
0:03
use completely features run a sync and
0:07
supply a sink before we get on with this
0:12
very lesson let us demonstrate the trade
0:15
that these processes actually run what
0:20
do I mean by that
0:21
now in a process it's actually possible
0:27
checkout switched read that processes
0:30
running on I can actually print out
0:34
trade thoughts current trade this will
0:40
print out the current read this long
0:42
process is going to run on if I go on to
0:45
the main method and I write long little
0:48
process let's run this
0:54
so if you look at it it's running in the
0:57
main trade that is why it's blocking the
1:01
main trade when it takes some time to
1:03
other kids now this time let us use
1:07
completely features so if I say
1:09
completely future that supply async I
1:14
come over here and I run long natural
1:20
process I can put in six
1:26
and now see then accepts once the part
1:30
is ready let's print it out
1:36
all right so to make this really nice
1:42
let us sleep the main thread in its bits
1:49
over on this I guess it does
1:59
now the tread is in the pool
2:04
longer in the main thread that's just
2:08
proof that this is running on a
2:10
different thread I want to treat then
2:15
apply normally five continually feature
2:19
honestly supply I think I could have a a
2:27
long natural process and a 14-7
2:33
and sidon accepts once is ready you can
2:38
print it out that's fine let's say I
2:44
have a simple method picks in a value
2:49
now if that value is even to add 1 to
2:54
the value if it's not even a to I'll
2:57
treat the value on its own back the
2:59
value what will my go with is currently
3:05
if I come here of sleeping it'll let us
3:09
remove this trade statement since we
3:12
already know the trade is running on and
3:17
around this is going to print out 70 yes
3:21
because he collects 7 most long metal
3:27
process what applies it by 10 aren't
3:33
owns it so what if after a long metal
3:38
process probably I want to take the
3:42
value or con it a little bit probably do
shape-icon

Download extension to view full transcript.

chrome-icon Install Tubelator On Chrome