Java 20 - From ThreadLocal to ScopedValue with Loom Full Tutorial - JEP Café #16

Author: Java
Published At: 2023-01-10T00:00:00
Length: 18:18

Summary

Description

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

Translated At: 2025-02-23T20:52:27Z

Request translate (One translation is about 5 minutes)

Version 3 (stable)

Optimized for a single speaker. Suitable for knowledge sharing or teaching videos.

Recommended Videos