Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

What is race condition in java? How will you find and solve race condition?

user-image
Question ajoutée par Mohd shahnawaz khan , Associate Project , Cognizant Technology Solution
Date de publication: 2015/02/12
mostafa mohamed korkar
par mostafa mohamed korkar , java developer , Etisalat misr

A race condition occurs when two or more threads can access shared data and they try to change it at the same time.

To Solve : 

In order to prevent race conditions from occurring, you would typically put a lock around the shared data to ensure only one thread can access the data at a time. where you will use the keyword Synchronized