• 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 ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Synchronization  RSS feed

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Can anybody tell me what is Synchronization. I don't have much knowledge in this.

Regards,
Suganya

EasyCalculation
ToFocus
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
synchronized is a key word, applicable for method Only.
Using synchronization means only one thread access a shared resource at a time. so it avoid the data corruption.
 
Bartender
Posts: 3320
86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Muthukumar Chellappa:
synchronized is a key word, applicable for method Only.

You can also declare a block of code as being synchronized on a particular object eg


 
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Tony Docherty:
You can also declare a block of code as being synchronized on a particular object



In fact, that is a much more important use of "synchronized" than in method declarations.

One may consider that "synchronized" in a method declaration is just a convenient shorthand for a synchronized block using "this".
 
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
suganya, I recommend you check out the Java Tutorial to get an introduction. Here's the section on concurrency, and here's the subsection on synchronization in particular.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!