wood burning stoves 2.0*
The moose likes Threads and Synchronization and the fly likes Synchronization Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Synchronization" Watch "Synchronization" New topic
Author

Synchronization

suganya raj
Greenhorn

Joined: Aug 08, 2007
Posts: 10
Hi,

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

Regards,
Suganya

EasyCalculation
ToFocus
Muthukumar Chellappa
Greenhorn

Joined: Aug 02, 2007
Posts: 9
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.
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2248
    
  47
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


Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
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".


Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
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.


"I'm not back." - Bill Harding, Twister
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Synchronization