• 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:
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

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: 3321
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
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.
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!