Thread Synchronization:
When a Thread is already acting on one object,preventing any other thread from acting on the same object is called "Thread Synchronization" or "Thread Safe". The Object on which the threads are synchronized is called "Synchronized Object".Thread Synchronization is recommended when multiple threads are used on the same object(in multiThreading).
Thread Locale:
Thread locale is a scope of access like,global Scope,local scope to a specific Thread,which is accessing an object.
Example:
I can point out one use case where I used thread local. Consider you have a
Servlet which calls some business methods. You have a requirement to generate a unique transaction id for each and every request this servlet process and you need to pass this transaction id to the business methods, for logging purpose. One solution would be passing this transaction id as a parameter to all the business methods. But this is not a good solution as the code is redundant and unnecessary.
To solve that, you can use Thread Local. You can generate a transaction id (either in servlet or better in a filter) and set it in the Thread Local. After this, what ever the business method, that this servlet calls, can access the transaction id from the thread local.
This servlet might be servicing more that one request at a time. Since each request is processed in separate thread, the transaction id will be unique to each thread (local) and will be accessible from all over the thread’s execution (global).