Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Obtaining locks Static syncronized methods  RSS feed

 
mansoor iqbal
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
Ishaan Mohan
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mansoor,
Check the Maha's Page and see the discussion on thread. You will find very good examples and explanation there.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!