aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Class lock Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Class lock" Watch "Class lock" New topic
Author

Class lock

Ambapali Pal
Ranch Hand

Joined: Dec 17, 2002
Posts: 47
What is class lock?
Do we need to know class lock for scpj 1.4 ?

Thank you,
Ambapali
Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

I have no idea what it is -- and I've read two SCPJ exam books -- so I'm gonna say no -- you don't need to know it (whatever it is)
John Paverd
Ranch Hand

Joined: Nov 17, 2002
Posts: 115

When synchMethod2 is called, the JVM will obtain a lock on the object my.
When synchMethod1 is called, the JVM will obtain a lock on the instance of java.lang.Class that represents MyClass, rather than obtaining a lock on a particular instance of MyClass.
For the exam it is probably enough to know that for a particular class, only 1 synchronized static method can be executing at a particular point in time, but many synchronized instance methods can run concurrently, as long as they are associated with different instances of that class.
[ January 13, 2003: Message edited by: John Paverd ]

SCJP 1.4
Ambapali Pal
Ranch Hand

Joined: Dec 17, 2002
Posts: 47
Thank you Jhon.
Ambapali Pal
Ranch Hand

Joined: Dec 17, 2002
Posts: 47
I am sorry. John not Jhon
John Paverd
Ranch Hand

Joined: Nov 17, 2002
Posts: 115
Originally posted by Ambapali Pal:
I am sorry. John not Jhon

Thats quite OK, Amabpali, oops I mean Ambapali

If you click on the little pencil and paper symbol above your post, you can correct it. I know this because I have to use this feature a lot on my own posts. In fact, you can see that I edited my first post in this topic.
You Can Call Me Al! - Paul Simon
 
Consider Paul's rocket mass heater.
 
subject: Class lock