Thread Synchronization
Java Thread Synchronization :
In multi-threading environment, When two or more
threads need access to a any shared resource then
their should be some mechanism to ensure that the
resource will be used by only one thread at a time.
Thread Synchronization is a process by which this
synchronization is achieved.
Thread Synchronization is used to prevent thread
interference and consistency problem.
Thread Synchronization is achieved through keyword
synchronized.
Types of Synchronization :
--------------------------
There are two types of thread synchronization :
Synchronized method.
Synchronized block.
static synchronization.