• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Class level syncronization v/s Method level Syncronization  RSS feed

Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,

I have never found out the difference between class level syncronization and method level organization.

Can anyone elaborate on the same with some example?

I have been asked this question many a times in the interview but never got answer for myself.

Thanks in advance,
author and iconoclast
Posts: 24220
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's nothing called "method level synchonization" that contrasts with anything that could be called "class level sychronizations". One thing you might possibly be referring to is the difference between synchronization of class (static) methods and instance (non-static) methods. Instance methods are synchronized at the instance level -- i.e., threads compete for individual objects, but the same method can be called simultaneously on two separate objects. Static methods are synchronized on the Class object for the class, and all Threads must compete for that to call any static synchronized methods in a class.

I'm going to move this to our Threads and Synchronization forum; it surely isn't Advanced Java.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!