Does access/write to Boolean object needs synchronization

Posted by Suraj Chandran on Stack Overflow See other posts from Stack Overflow or by Suraj Chandran
Published on 2010-04-16T03:49:33Z Indexed on 2010/04/16 3:53 UTC
Read the original article Hit count: 363

Filed under:
|
|

This may seem a very silly question. Consider this:

I have a simple Boolean object with a getter and a setter. Now both of the methods are called from a lot of threads very frequently.

  1. Do I need to have a synchronization for this boolean?
  2. Also are Boolean assignments atomic operations?

© Stack Overflow or respective owner

Related posts about java

Related posts about boolean