The key to synchronization in Java is monitor. A monitor is an object which is used for obtaining a mutual exclusive lock. Once a thread acquires a lock, it is said to have entered the monitor. When one thread is inside the monitor, no other thread is allowed to acquire a lock until that thread exits the monitor. Every object in Java has an implicit monitor associated with it. To enter an object’s monitor, a method which is modified using synchronized keyword should be called. Synchronized Methods A method that is modified with the synchronized keyword is called a synchronized method.
The post How do you achieve synchronization in java programming appeared first on Coding Security.
How do you achieve synchronization in java programming
read more
Tidak ada komentar:
Posting Komentar