Versions Compared

Key

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

...

Wiki Markup
<ac:structured-macro ac:name="anchor" ac:schema-version="1" ac:macro-id="24b4fcd2eda3a74d-b40ef88c-49754cab-9e32b602-194ad0bd44ca6b4639d29d35"><ac:parameter ac:name="">CON20-EX1</ac:parameter></ac:structured-macro>
*TSM02-EX0:* Programs are permitted to start a background thread (or threads) during class initialization, provided the thread cannot access any fields. For example, the {{ObjectPreserver}} class (based on \[[Grand 2002|AA. Bibliography#Grand 02]\]) shown below provides a mechanism for storing object references, which prevents an object from being garbage-collected, even when the object is never again de-referenced.

...

This is a singleton class (see rule MSC11 MSC07-J. Prevent multiple instantiations of singleton objects for more information on how to defensively code singleton classes). The initialization involves creating a background thread using the current instance of the class. The thread waits indefinitely by invoking Object.wait(). Consequently, this object persists for the remainder of the JVM's lifetime. Because the object is managed by a daemon thread, the thread cannot interfere with normal shutdown of the JVM.

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="45d86b3d95c42759-dfbf8742-4ebd49de-9ccb9138-2fe5fcae0aab52460b75b563"><ac:plain-text-body><![CDATA[

[[Bloch 2005b

AA. Bibliography#Bloch 05b]]

8. "Lazy Initialization"

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="4c0c9a5a4ac99c62-f9459f9e-4df446dd-a224ac89-00a2ca9596734941d200b6e4"><ac:plain-text-body><![CDATA[

[[Grand 2002

AA. Bibliography#Grand 02]]

Chapter 5, Creational Patterns, Singleton

]]></ac:plain-text-body></ac:structured-macro>

...