File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Class Level Locking

 
Micheal John
Ranch Hand
Posts: 344
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How locking mechanism will wotk for class level?

Suppose if we synchronize a non-static method in a class, then not more than one thran can access the synchronized non-static method, but however more than one threads can still access the methods which is not synchronized on the same object.

What about when using synchronization for a static method? it's a calss level lock..correct..? Can a thread can access any method which is not synchronized in that class?
 
Burkhard Hassel
Ranch Hand
Posts: 1274
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Micheal John posted December 09, 2006 05:50 AM

What about when using synchronization for a static method? it's a calss level lock..correct..? Can a thread can access any method which is not synchronized in that class?


Yes, you say: all static synchronized methods can only be called from one thread at the same time. Means they are synchronized.

All methods that are not static and not synchronized are - errr - not synchronized.


Bu.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic