Java 20 - Từ ThreadLocal đến ScopedValue với Hướng dẫn đầy đủ về Loom - JEP Café #16

Tác giả: Java
Ngày xuất bản: 2023-01-10T00:00:00
Length: 18:18

ThreadLocal variables can help you share sensitive information among the different components of an application, without resorting to method calls. They have drawbacks that are now fixed with ScopedValue variables. Understand how ScopedValue are working and how you can use them as an incubator feature in JDK 20.

⎯⎯⎯⎯⎯⎯ Chapters ⎯⎯⎯⎯⎯⎯

0:00 Intro

1:09 Why have ThreadLocal variables been introduced?

2:44 How does ThreadLocal variables work?

4:57 ThreadLocal variables drawbacks: leaking and memory footprint

7:39 How Virtual Threads are changing the need for ThreadLocal

10:10 Introducing the new requirements for ScopedValue

11:02 Creating and using a ScopedValue

13:09 Reading a ScopeValue and dealing with errors

14:17 What is the scope of a ScopedValue?

16:59 Setting several ScopedValue for a task, rebinding a ScopedValue

17:55 Final words and outro

⎯⎯⎯⎯⎯⎯ Resources ⎯⎯⎯⎯⎯⎯

◦ Project Loom ➱ https://openjdk.org/projects/loom/

◦ Project Loom mailing list ➱ https://mail.openjdk.org/mailman/listinfo/loom-dev

◦ Scoped Values (Incubator) ➱ https://openjdk.org/jeps/429

◦ Virtual Threads (2nd Preview) ➱ https://openjdk.org/jeps/436

◦ Structured Concurrency (2nd Incubator) ➱ https://openjdk.org/jeps/437

◦ JEP Café 12 on Virtual Threads ➱ https://youtu.be/UVoGE0GZZPI

◦ JEP Café 13 on Structured Concurrency ➱ https://youtu.be/2nOj8MKHvmw

◦ Dev.java ➱ https://dev.java

◦ Inside.java ➱ https://inside.java

◦ JDK 20 ➱ https://openjdk.org/projects/jdk/20

◦ OpenJDK ➱ https://openjdk.org

◦ Oracle Java ➱ https://www.oracle.com/java/

Tags: #Java #Java17 #Java20 #OpenJDK #JDK #JDK17 #Loom #VritualThreads #JEPCafe #insidejava

Dịch Vào Lúc: 2025-02-23T20:52:27Z

Yêu cầu dịch (Một bản dịch khoảng 5 phút)

Phiên bản 3 (ổn định)

Tối ưu hóa cho một người nói. Phù hợp cho video chia sẻ kiến thức hoặc giảng dạy.

Video Đề Xuất