The Volatile keyword only has visibility and does not have synchronization (atomicity). It is a lightweight synchronized. Its performance is much stronger than that of synchronized, and it will not cause blocking. If you want to ensure the atomicity of data, you can use the atomic class to ensure itself. The atomicity of methods, but atomic does not guarantee the atomicity of multiple operations
A note on the volatile keyword
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=324730395&siteId=291194637
Ranking