Some Idea, Project and Programming Notes

  • Home
  • About

multithread

Java synchronized keyword : fixing Race condition

January 18, 2018Mashruf Leave a comment

In a multithreaded Java program read and write operation from different thread at the same time creates race condition. The simple example here gives different output at different times: public class RaceCondition {     public static void main(String[] args) throws InterruptedException{         final LongWrapper longWrapper = new LongWrapper(0L);       … Continued

JavaJava, multithread

Categories