wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Obtaining locks Static syncronized methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Obtaining locks Static syncronized methods" Watch "Obtaining locks Static syncronized methods" New topic
Author

Obtaining locks Static syncronized methods

mansoor iqbal
Ranch Hand

Joined: Aug 14, 2000
Posts: 91
Mughal says:
Classes also have class-specific moniors which is is analogous to the object monitor. Such a monitor is actually a monitor on the Class object of the class
huh?.....
what is the difference between obtaining a lock on an object and getting a lock on the class ...??
petfishlf
Greenhorn

Joined: Mar 02, 2001
Posts: 7
The lock is similar with variable. A lock of a object is realted to the instance , if you have many objects of the same class in program ,they will monitor independent locks owned by themselves;But the class lock is only one which is shared by all instance. The lock of class is analogus to the static variable.
Do I say it clear?
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
petfishIf,
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please choose a new name which meets the requirements.
Thanks.


"JavaRanch, where the deer and the Certified play" - David O'Meara
Ishaan Mohan
Ranch Hand

Joined: Jan 20, 2001
Posts: 115
Hi Mansoor,
Check the Maha's Page and see the discussion on thread. You will find very good examples and explanation there.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Obtaining locks Static syncronized methods