From the course: Java SE 21 Developer (1Z0-830) Cert Prep
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Virtual threads, part 2 - Java Tutorial
From the course: Java SE 21 Developer (1Z0-830) Cert Prep
Virtual threads, part 2
- Now as we mentioned, the virtual thread class isn't public, so you can't say new virtual thread. Instead, you have several ways of creating a virtual thread and getting it to execute your code. One of them is a method in the thread class, start virtual thread, and you give it a runnable and off it goes. There's also a builder. The builder is likely to be the most useful mechanism in many cases, maybe not the most useful, but it's one of the two more likely ways of doing it. With a thread builder, what you can do, the thread.builder interface is actually, as you see, a member of the thread class itself. You can say thread.ofvirtual, and it will give you a thread.builder implementation. And using that, you can create a new thread and off you go. However, because there are certain differences between the capabilities of platform threads where you can actually set a priority and it's meaningful, you can set it as non…
Download courses and learn on the go
Watch courses on your mobile device without an internet connection. Download courses using your iOS or Android LinkedIn Learning app.
Contents
-
-
(Locked)
Module introduction48s
-
(Locked)
Learning objectives1m 6s
-
(Locked)
Java operators, part 110m 6s
-
(Locked)
Java operators, part 210m 47s
-
Promotions14m 39s
-
(Locked)
Casting5m 25s
-
(Locked)
Wrapper classes6m 41s
-
(Locked)
Primitives, references, aliasing, and equality16m 39s
-
(Locked)
Question deep dive6m 27s
-
(Locked)
-
-
(Locked)
Learning objectives23s
-
(Locked)
Date-time API foundations, part 19m 44s
-
(Locked)
Date-time API foundations, part 29m 58s
-
(Locked)
Manipulating date-time objects10m 6s
-
Time-zone considerations, part 17m 34s
-
(Locked)
Time-zone considerations, part 210m 15s
-
(Locked)
Time-zone considerations, part 38m 2s
-
(Locked)
Question deep dive2m 40s
-
(Locked)
-
-
(Locked)
Module introduction47s
-
(Locked)
Learning objectives47s
-
(Locked)
Simple loops11m 16s
-
(Locked)
Control using break and continue7m 10s
-
(Locked)
Using if/else statements3m 22s
-
(Locked)
Using switch statements4m 50s
-
(Locked)
The arrow form of switch11m 31s
-
(Locked)
Expressions with switch16m 3s
-
(Locked)
Pattern matching with switch: Foundations8m 15s
-
(Locked)
Pattern matching with switch: Rules7m 27s
-
(Locked)
Pattern matching with switch: Handling records4m 43s
-
(Locked)
Pattern matching with switch: Quick questions9m 21s
-
(Locked)
Question deep dive6m 56s
-
(Locked)
-
-
(Locked)
Learning objectives34s
-
(Locked)
Flow control with try/catch/finally18m 32s
-
(Locked)
Flow control with try-with-resources4m
-
(Locked)
Multi-catch and rethrowing4m 57s
-
Implementing AutoCloseable, part 110m 9s
-
(Locked)
Implementing AutoCloseable, part 29m 55s
-
(Locked)
Question deep dive5m 58s
-
(Locked)
-
-
(Locked)
Module introduction1m 55s
-
(Locked)
Learning objectives39s
-
(Locked)
Source files and basic type declarations10m 29s
-
(Locked)
Nested type declarations8m 31s
-
(Locked)
Inner class declarations, part 17m 6s
-
(Locked)
Inner class declaration, part 215m 22s
-
(Locked)
Local and anonymous class declarations9m 44s
-
(Locked)
Reachability analysis12m 59s
-
(Locked)
Question deep dive4m 14s
-
(Locked)
-
-
(Locked)
Learning objectives48s
-
(Locked)
Instance and static fields, part 18m 52s
-
(Locked)
Instance and static fields, part 212m 9s
-
(Locked)
Instance and static methods, part 18m 57s
-
(Locked)
Instance and static methods, part 211m 9s
-
(Locked)
Variable length argument handling3m 10s
-
(Locked)
Overloaded and overridden methods, part 19m 24s
-
(Locked)
Overloaded and overridden methods, part 212m 29s
-
(Locked)
Defining records12m 2s
-
(Locked)
Features of records14m 26s
-
(Locked)
Question deep dive3m 34s
-
(Locked)
-
-
(Locked)
Learning objectives1m 3s
-
(Locked)
Object and reference type11m 41s
-
(Locked)
Pattern matching in instanceof12m
-
(Locked)
Additional topics in pattern-matched instanceof10m 6s
-
(Locked)
Possible and impossible casts6m 9s
-
(Locked)
Virtual method invocation6m 1s
-
(Locked)
Covariant returns2m 27s
-
(Locked)
Question deep dive2m 54s
-
(Locked)
-
-
(Locked)
Learning objectives57s
-
(Locked)
Collection and reduction, part 113m 8s
-
(Locked)
Collection and reduction, part 26m 42s
-
(Locked)
Grouping and partitioning with collectors6m 33s
-
(Locked)
Downstream operations with collectors9m 10s
-
(Locked)
Parallel stream operation7m 21s
-
(Locked)
Question deep dive3m 53s
-
(Locked)
-
-
(Locked)
Module introduction47s
-
(Locked)
Learning objectives55s
-
(Locked)
Runnable and thread13m 57s
-
(Locked)
ExecutorService and Future9m 22s
-
(Locked)
ExecutorService lifecycle, part 112m
-
(Locked)
ExecutorService lifecycle, part 28m 24s
-
(Locked)
Virtual threads, part 18m 26s
-
(Locked)
Virtual threads, part 217m 28s
-
(Locked)
Question deep dive4m 33s
-
(Locked)
-
-
(Locked)
Learning objectives54s
-
(Locked)
Race conditions, deadlock, and livelock12m 20s
-
(Locked)
Transactional integrity12m 32s
-
(Locked)
Visibility16m 49s
-
(Locked)
Concurrent queues and collections10m 23s
-
(Locked)
Synchronizers, locks, and atomic types, part 114m
-
(Locked)
Synchronizers, locks, and atomic types, part 215m 57s
-
(Locked)
Question deep dive1m 26s
-
(Locked)