When a method is synchronized, only one thread can enter that object's method at a given point in time. If any other thread tries to enter the synchronized method, it will NOT be allowed to enter. It will be put in the BLOCKED state. In this post, let’s learn a little more details about synchronized... Continue Reading →
Java Static Synchronized method behavior
In our earlier post, we learnt that when a method is synchronized, only one thread will be allowed to enter the method. In this post, let's discuss the behavior of static synchronized methods. Video: To see the visual walk-through of this post, click below: https://youtu.be/YFNklSkT1js Multiple static synchronized methods in a same object example To facilitate... Continue Reading →
Java synchronized block
In the earlier post we learnt about the Java synchronized method. In this post, let's learn about the synchronized block. Video: To see the visual walk-through of this post, click below: https://youtu.be/NIeEiK_eklE What is Synchronized Block? Synchronized block is used to prevent multiple threads from executing a portion of a code in a method at the... Continue Reading →
Can threads execute same synchronized method on different objects?
In our earlier post, we learnt that when a method is synchronized, only one thread will be allowed to enter the method. In this post, let's do a little bit of deep dive - let’s discuss whether threads can invoke the same synchronized method on different objects at the same point in time. Video: To see... Continue Reading →