volatile is a keyword in java it is used to indicate java compiler and java thread that do not cache the value of the variable preceded with the volatile keyword and all time read the volatile variable's value from the main memory.
So whenever you want read and write operation to be atomic on any variable then declare that variable with volatile keyword.
also take a look at what is transient in java
So whenever you want read and write operation to be atomic on any variable then declare that variable with volatile keyword.
also take a look at what is transient in java
No comments:
Post a Comment