This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I am not sure I am getting the idea of how synchronized static methods. synchronized blocks and synchronized static blocks works correctly
For synchronized static methods, as far as I understand every class has its own lock through its corresponding instance of java.lang.Class...which means that no matter how many objects do exist for the class that do have the synchhronized static methods, only ONE lock can be done at a time on the synchronized static methods of the class through its corresponding instance of java.lang.Class
Now what I am confused about in the classes which contains synchronized static methods or to be more specific in classes that contain synchronized static methods, synchronized methods, synchronized static blocks AND synchronized blocks in ONE class...what will happen for example if a thread gained lock on the synchronized static method of this class...can other threads access the synchronized methods, synchronized static blocks, synchronized blocks of this same class?
For instance and static blocks, I really don't understand how their blocking mechanism work, also the object on which the lock will happen so I will appreciate it so much if someone can please help me by explaining those two parts as well
Thanks in advance for your time and efforts
Mahmoud Metwally<br />Preparing for SCJP...<br /> <br />"Try not to become a man of success but a man of value" - Albert Einstein