Guys don't get overwhelmed, its a simple Map for threads. Each thread has it's own key and value.
@shankar74357 ай бұрын
I do agree but it's a luxury to have it and use it without doing all that additional map work. Loved this feature in language. ❤❤❤
@av983 жыл бұрын
You have created one of the best tutorial for multi threading.
@JakobJenkov3 жыл бұрын
Thank you very much! :-) Glad it is helpful!
@shankar74357 ай бұрын
First time i ever felt someone giving correct portion of details for a concept in java using reasonable and correct language usage. ❤❤❤
@JakobJenkov6 ай бұрын
Thank you !! 😊
@shubhamagarwal14348 ай бұрын
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 qns.......Thanks a Lot form 10+ yrs exp guy from BLR,India.
@JakobJenkov7 ай бұрын
Thanks :-)
@shobhanksharma653 жыл бұрын
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!
@JakobJenkov3 жыл бұрын
Thanks - I am glad I did not disappoint you :-D
@tousif1612 жыл бұрын
The best tutorial on multithreading. Thanks for making my life easy - was struggling to understand ThreadLocal concept.
@JakobJenkov2 жыл бұрын
You are welcome! :-) Great to know my tutorial was helpful to you! :-)
@gparashar4u4 жыл бұрын
Great. Clear the of confusion around using ThreadLocal in the thread pool. Thanks.
@JakobJenkov4 жыл бұрын
You are welcome! :-)
@farhaankazi71342 жыл бұрын
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
@JakobJenkov2 жыл бұрын
Thank you very much for your kind words! :-) I am happy that my tutorials are helpful to you! :-)
@akshukla044 жыл бұрын
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 KZbin as well. Java Concurrency has been a painful topic for me. I hope to see more videos from you on Java Concurrency. Thanks Again !!!!
@JakobJenkov4 жыл бұрын
Hi Akhilesh, thank you for your feedback! :-) I plan to post several more videos within the Java Concurrency topic over the coming months. Hopefully you will find them useful too :-)
@abhishekbaghel4 жыл бұрын
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
@JakobJenkov4 жыл бұрын
You are welcome :-)
@maluginp4 жыл бұрын
Thanks, it's awesome guide to multithreading in Java.
@JakobJenkov4 жыл бұрын
Thank you - it's still "under development" :-)
@Golipillas3 жыл бұрын
Not a single dislike, well deserved, awesome content! 😊
@JakobJenkov3 жыл бұрын
Thank you very much! :-)
@developerscentre9 ай бұрын
Best channel for any Java related concepts! Please keep coming with more such contents. 🙂
@JakobJenkov8 ай бұрын
Thank you very much! I've got a video on the Java ForkJoinPool coming out next week!
@mostinho73 жыл бұрын
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
@JakobJenkov3 жыл бұрын
You are welcome! :-)
@manOfPlanetEarth2 жыл бұрын
@@JakobJenkov wow! nice issue!:) Bit of advice: when it'not clear which thread prints null, add pls a string, it's more illustrative. Like: Sout(some_null_var); -> Sout("Thread 1: " + some_null_var);
@isaiassalles11802 жыл бұрын
Dude, I love the content you have in your website and your videos make things even better
@JakobJenkov2 жыл бұрын
Thank you very much! ... working on a new video, by the way. It will probably be out next week :-)
@namigtahmazli78702 жыл бұрын
Such a valuable resource. Thank you very much.
@JakobJenkov2 жыл бұрын
You are welcome! :-)
@alanbidu13 жыл бұрын
Thank you for sharing knowledge.
@JakobJenkov3 жыл бұрын
You are welcome :-)
@SoeaOu3 жыл бұрын
thank you for the excellent videos in high quality
@JakobJenkov3 жыл бұрын
You are welcome ! Glad you like them! :-)
@oliveryt71682 жыл бұрын
Well done with the presentation and explanation!
@JakobJenkov2 жыл бұрын
Thank you 😊
@kafychannel Жыл бұрын
Great tutorial! Thanks a lot. I also read it in text version, love it :)))
@JakobJenkov Жыл бұрын
Great to hear! :-) I am happy my tutorials are helpful!
@ghettoteacher87134 жыл бұрын
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 !
@JakobJenkov4 жыл бұрын
Thank you very much for your kind words about my tutorials! :-) I am aware of the Disruptor, but it's only one of many ways to achieve high performance samethreaded / singlethreaded style architectures. I may be getting to those later in this tutorial series. I have already discussed many of them on my tutorial website.
@ashutoshkumarsingh13 жыл бұрын
U r awesome man👍🏻
@JakobJenkov3 жыл бұрын
Thank you ! :-)
@antonhen234 жыл бұрын
Great lesson!
@JakobJenkov4 жыл бұрын
Thanks :-)
@pubgbattleground92083 жыл бұрын
nice video. good work
@JakobJenkov2 жыл бұрын
Thank you! :-)
@pawelchrzanowski82 жыл бұрын
very good content
@JakobJenkov2 жыл бұрын
Thanks, Pawel :-)
@mr.swapyyc2 жыл бұрын
Helpful!
@JakobJenkov2 жыл бұрын
Thanks! :-)
@RaviNagubandi3 жыл бұрын
Thanks Jakob for awesome content. Can you share the code snippets in your github repository?
@JakobJenkov3 жыл бұрын
Eventually I will - but right now they are not shared. It's a time issue... so much to do - so little time! :-)
@menchomenchev89732 жыл бұрын
Hello Jakob. Very well presented. There is a missing piece, however, why does the Threadlocal class is capable of keeping a single value internally per thread that accesses it? and why would we want to to use the class (as a container) in the first place?
@JakobJenkov2 жыл бұрын
ThreadLocal is typically used to create thread level singletons.
@menchomenchev89732 жыл бұрын
@@JakobJenkov Thank you, appreciate it!
@varunupadhyay38363 жыл бұрын
The second thread can actually end up seeing the value being set by thread one if we don't include the sleep as part of thread 2. Not sure if its some form of reference leakage or its necessary to remove the value as part of same thread.
@JakobJenkov3 жыл бұрын
Two different threads setting variables on a ThreadLocal should always only see the value they set themselves. They should not be able to see each other's values set on a ThreadLocal.
@almonyplony12804 жыл бұрын
To be honest, I didn't understand what is the difference between this ThreadLocal and a regular local variable? What can this ThreadLocal solve for me, that a regular local variable can't?
@JakobJenkov4 жыл бұрын
If two threads use the same ThreadLocal instance, they can store their own value inside it. They don't see each other's values. The values stored by a thread in a ThreadLocal is "local" to the thread that stored it. If you just used a standard shared value instead, all threads would see the same variable value - the last stored value by any thread (provided access to the variable is properly synchronized - or the variable is volatile) - not the value stored by the thread reading the variable (as is the case with ThreadLocal).
@muammaryusuf70833 жыл бұрын
@@JakobJenkov, why not user private local variable? is problem solve for syncronize? so... how if we want share same variable for two thread? for example we have shareObject1, i want share those with Thread1 and Thread2? howto solve using ThreadLocal?
@LuneAgent3 жыл бұрын
First thing that comes to mind: you can use ThreadLocal to count the number of tasks that each thread has completed. You can have just one variable field that will show different numbers for each thread in the pool when accessed from corresponding threads.
@Manuel-oe4gv Жыл бұрын
@@LuneAgent You can have a local variable inside the thread doing the same thing right?
@ahmeedev3 жыл бұрын
Thanks😍
@JakobJenkov3 жыл бұрын
You are welcome! :-)
@MissBlurryFace Жыл бұрын
At 13:03 you are mentioning that child thread does not know about the threadLocal but only inheritableThreadLocal. This part is not clear to me? Both the threadLocals have been set in the parent thread yet child only sees the inheritableLocalThread. . Btw thank you so much for these videos.
@dontwanna67594 жыл бұрын
hey jacob i love your java tutorial i am just finishing with core java concepts can you share beginner friendly projects
@JakobJenkov4 жыл бұрын
I have more beginner friendly tutorials on my tutorial website, here: tutorials.jenkov.com/
@muammaryusuf70833 жыл бұрын
If only for save and get data for locally thread, why not use local variable instead?, can you tell me when ThreadLocal usefull usage?
@JakobJenkov3 жыл бұрын
If you have an object that is being called by more than one thread, and you need to keep some state in the object between calls, and you don't want that state shared between the threads, then using a ThreadLocal instead of a normal member variable (AKA field) can solve the problem.
@muammaryusuf70833 жыл бұрын
@@JakobJenkov , great... thanks very much....
@threadRunnable9 ай бұрын
why to use threadlocal if we have local variable to use?
@JakobJenkov9 ай бұрын
ThreadLocal is not for local variables, but for member variables in objects that are shared among threads - but which should be "local" to each thread.
@mehedihassan51842 жыл бұрын
Best
@JakobJenkov2 жыл бұрын
Thanks 😊
@liu-zl9df3 жыл бұрын
good man
@JakobJenkov3 жыл бұрын
Thanks :-)
@ersachin12044 жыл бұрын
sir how to create KZbin downloader in android studio ?
@JakobJenkov4 жыл бұрын
I don't know, unfortunately!
@subashsakthivels88082 жыл бұрын
Good video, but it's make me sleep
@JakobJenkov2 жыл бұрын
Thank you! ... sad my tone of voice makes you sleepy :-) ... I am trying not to speak too fast, so as many as possible can keep up. By the way, you can play the video in 1.25 or 1.5 x normal speed - maybe that helps?
@manOfPlanetEarth2 жыл бұрын
@@JakobJenkov :)) Now i am playing at 0.75x speed and with subtitles in order to think over what was said.
@oliveryt71682 жыл бұрын
I actually like the way he talks... like a normal human being...