ThreadLocal in Java - what is it used for?As the name suggests this Java library class is used for supporting thread-local variables - the variables which are local to the particular thread instance and hence each thread will have their own copy of such variables which will be initialized every time a new thread is spawned.To be more clear, let's take one simple example. If you have a class