~/talk

Is ThreadLocal Obsolete? A Detailed Comparison with ScopedValue

TalkinRussianat Joker 2025 · 2025-10-17..10-18· [java]
links:none on file
slides:none on file

Compares Java's ThreadLocal and the Java 21 ScopedValue as context-passing mechanisms, explaining why ScopedValue was introduced and whether ThreadLocal will be deprecated. Covers API/design differences and their impact on performance and memory, behavior with virtual threads and structured concurrency, and common anti-patterns that can break applications.

AI-written summary · about

  1. 0:00Introduction
  2. 1:26Speakers
  3. 2:50ThreadLocal vs ScopedValue
  4. 8:07ThreadLocal internals
  5. 13:00ThreadLocal in child threads
  6. 14:46ScopedValue internals
  7. 23:58ScopedValue optimizations
  8. 25:26Memory usage
  9. 27:55Benchmark setup
  10. 31:03ScopedValue cache
  11. 33:08JVM performance factors
  12. 35:49Lambda memory impact
  13. 38:08Stack chunk overhead
  14. 38:51Performance benchmarks
  15. 41:44Key takeaways
  16. 43:07When to use each
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.