Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: add anchor for CON03-EX1

...

The static initializer can be used to initialize any other shared, class fields. Alternatively, the fields can be initialized from the initialValue() method.

Exceptions

Wiki Markup
*CON03:<ac:structured-macro ac:name="anchor" ac:schema-version="1" ac:macro-id="5d12d5aa-364c-4b9e-9a7c-1c91dfef721c"><ac:parameter ac:name="">CON03-EX1</ac:parameter></ac:structured-macro>
*CON03-EX1:* It is permissible to start a background thread during class initialization provided the thread does not access any fields. For example, the {{ObjectPreserver}} class (based on \[[Patterns 02|AA. Java References#Patterns 02]\]) shown below provides a mechanism for storing object references, which prevents an object from being garbage-collected, even if the object is not dereferenced in the future.

...