Gaurava Agarwal wrote:I am concerned about how class lock works. As per standard behaviour of synchronization, " only one synchronized static method can be called at a time "
please correct me if am wrong.
Hi Guarava,
Welcome to JavaRanch, it is good to see you here :-)
We have a standard policy here called
Don't Wake The Zombies, basically, rather than wake up a 5 year old thread with your question, your question deserves its own Thread. Searching is great, we
Definitely Encourage Searching but if you don't find what you want, you will probably get better results with a new Thread rather than an old one.
Anyway, to your question. You ask if only one synchronized static method can be called at a time. The answer is yes, for a given Class, only one synchronized static method can be called at a time. Synchronized static methods of different Classes, however, can be called at the same time, because the lock is on different instances of the Class object.
Does that help?