Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note that if Foo was mutable, the Helper field would need to be declared volatile as shown in CON00-J. Declare shared variables as volatile to ensure visibility and prevent reordering of accessesKnow when to use volatile. Also, the method getHelper() is an instance method and the accessibility of the helper field is private. This allows safe publication of the Helper object, in that, a thread cannot observe a partially initialized Foo object (CON26-J. Do not publish partially-constructed objects).

...