final fields and thread-safety

Posted by pcjuzer on Stack Overflow See other posts from Stack Overflow or by pcjuzer
Published on 2011-08-22T08:39:56Z Indexed on 2012/06/02 4:40 UTC
Read the original article Hit count: 138

Filed under:
|
|

Should it be all fields, including super-fields, of a purposively immutable java class 'final' in order to be thread-safe or is it enough to have no modifier methods?

Suppose I have a POJO with non-final fields where all fields are type of some immutable class. This POJO has getters-setters, and a constructor wich sets some initial value. If I extend this POJO with knocking out modifier methods, thus making it immutable, will extension class be thread-safe?

© Stack Overflow or respective owner

Related posts about java

Related posts about thread-safety