Versions Compared

Key

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

...

The field flag is not required to be volatile because the initialization is being carried out in a static initializer and is guaranteed to finish before the object becomes usable.

Compliant Solution (static initializer, no background threads)

This compliant solution also uses a static initializer but does not spawn a background thread from it.

...