Synchronization and concurrency before Java 5

Prior to Java 5, there were basically five means to correctly synchronize data between threads ("shared" here means "accessed by multiple threads"):

For most programmers, the first two of these are probably the bread-and-butter means of synchronizing data. I suspect that the last two or three on this list are unknown to many otherwise experienced Java programmers. (The last is actually rare and generally unrecommended, but we consider it for completeness.) We'll review each of these methods briefly here, starting with the synchronized keyword.


If you enjoy this Java programming article, please share with friends and colleagues. Follow the author on Twitter for the latest news and rants.

Editorial page content written by Neil Coffey. Copyright © Javamex UK 2021. All rights reserved.