This may seem like a very stupid question. Consider this:
I have a simple Boolean object with a getter and setter. Now both methods are called from a large number of threads very often.
- Do I need to have synchronization for this boolean?
- Do logical operations with atoms also occur?
[UPDATE]: I already know about Atomic Boolean. I already have many diverse solutions, but I specifically looked for answers and justification for the answers to the above question.
java synchronization boolean
Suraj chandran
source share