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

Synchronization

 
suganya raj
Greenhorn
Posts: 10
  • 0
  • 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
 
Muthukumar Chellappa
Greenhorn
Posts: 9
  • 0
  • 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.
 
Tony Docherty
Bartender
Pie
Posts: 2878
59
  • 0
  • 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


 
Peter Chase
Ranch Hand
Posts: 1970
  • 0
  • 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".
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • 0
  • 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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic