This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Obtaining locks Static syncronized methods
 
Similar Threads
please explain me why this program is not going into deadlock scenario
synchronized classes?
Is a monitor the same thing as a lock?
How to Synchronize a class??
What does monitor mean?