Java ThreadLocal

preview_player
Показать описание
The Java ThreadLocal class is capable of keeping a single value internally per thread that accesses it. That means, that if multiple threads share a Java ThreadLocal, each of them can set their own value inside the ThreadLocal without overwriting each other's values. When getting the value again, each thread will get the latest value it has set on the ThreadLocal - and not any value set by other threads.

Chapters
0:00 Java ThreadLocal introduction incl. set() and get()
3:18 Java ThreadLocal remove() method
5:20 Java ThreadLocal with initial value
8:33 Set value lazily on Java ThreadLocal
10:21 Using a Java ThreadLocal from within an thread pool
11:39 Java InheritableThreadLocal

Java ThreadLocal - text:

Java Concurrency - text / video

Java Examples GitHub repo:
Рекомендации по теме
Комментарии
Автор

Guys don't get overwhelmed, its a simple Map for threads. Each thread has it's own key and value.

wizzard
Автор

You have created one of the best tutorial for multi threading.

av
Автор

God of Concurency..i have bene flowing you since my 2014 when you used to write blog post only...by going through your post i attend interview like a LION when they ask mutithreading a Lot form 10+ yrs exp guy from BLR, India.

shubhamagarwal
Автор

First time i ever felt someone giving correct portion of details for a concept in java using reasonable and correct language usage. ❤❤❤

shankar
Автор

When I saw name 'Jakob Jenkov', I immediately remembered a lot of your blogs on your website and I was sure your videos won't be let down as well. And as expected these are great!

shobhanksharma
Автор

Thanks, Jenkov, I really appreciate your work. Finally, I understood how the hell Thread Local work without confusion. I read your article. I liked it and that was enough, but it also inspired me to see your vlog and I also saw it. Both of them are really best and worth spending time on both of them

farhaankazi
Автор

The best tutorial on multithreading. Thanks for making my life easy - was struggling to understand ThreadLocal concept.

tousif
Автор

Great. Clear the of confusion around using ThreadLocal in the thread pool. Thanks.

gparasharu
Автор

Best channel for any Java related concepts! Please keep coming with more such contents. 🙂

developerscentre
Автор

good to see your youtube channel.
I have learned a lot from your blogs.
thanks for creating your youtube channel.
looking forward to your upcoming video

abhishekbaghel
Автор

Thanks Jakob for posting these videos. I have been following your articles for over 4-5 years now. and Its nice to see you are posting videos on YouTube as well. Java Concurrency has been a painful topic for me. I hope to see more videos from you on Java Concurrency.

Thanks Again !!!!

akshukla
Автор

Not a single dislike, well deserved, awesome content! 😊

Golipillas
Автор

Thanks for great video

Todo: take notes
ThreadLocal in a thread pool will let tasks share variables stored in the threadlocal if the tasks are run by the same threads, this may not be what you want

Inheritable thread local allow child threads to share values, normal thread local is per thread

mostinho
Автор

Thanks, it's awesome guide to multithreading in Java.

maluginp
Автор

Dude, I love the content you have in your website and your videos make things even better

isaiassalles
Автор

Such a valuable resource. Thank you very much.

namigtahmazli
Автор

Well done with the presentation and explanation!

oliveryt
Автор

Great tutorial! Thanks a lot. I also read it in text version, love it :)))

kafychannel
Автор

thank you for the excellent videos in high quality

SoeaOu
Автор

Hi there! I have recently finished a grad scheme as a software engineer and find your articles really helpful! Not sure if you’ve heard of the Disruptor library (from LMAX) but it would be cool to see you eventually teach that since it’s pretty cool the way they incorporate mechanical sympathy! Thanks and please do continue creating vids !

ghettoteacher
join shbcf.ru