File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

synchronized

 
Chinmay Bajikar
Ranch Hand
Posts: 159
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Would I have a class level lock if I write a synchronized block for a static member of the class rather than an object level lock that I would get when I put "synchronized" in the method signature.
Thanks,
Chinmay
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. In Java, for every loaded class in the JVM, there's an instance of java.lang.Class that represents that class. Synchronized static methods use the class's java.lang.Class object as a lock.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic