Versions Compared

Key

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

During initialization of a shared object, the object must be accessible only to the thread constructing it. However, the object can be published safely (that is, made visible to other threads) once its initialization is complete. The Java Memory Model (JMM) allows multiple threads to observe the object after its initialization has begun, but before it has concluded. Consequently, allowing programs must not allow publication of a partially initialized object is forbidden.

This rule prohibits publishing a reference to a partially initialized member object instance before initialization has concluded. Rule TSM01-J. Do not let the (this) reference escape during object construction prohibits the this reference of the current object from escaping.

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="3aed1c3b8d285b1a-522ad4e1-40ca47ee-b5478c86-65cd2978b9b0eebb746721c3"><ac:plain-text-body><![CDATA[

[[API 2006

AA. Bibliography#API 06]]

 

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="c557c2b984ac0772-a8078ef7-48414571-ba88867e-4213eeb037abf5cee6fa18b5"><ac:plain-text-body><![CDATA[

[[Bloch 2001

AA. Bibliography#Bloch 01]]

Item 48: "Synchronize access to shared mutable data"

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="4ac684200692533f-3774ceec-43cc4aee-a4ba8308-aa0de42d58796dab71dbe7e4"><ac:plain-text-body><![CDATA[

[[Goetz 2006

AA. Bibliography#Goetz 06]]

Section 3.5.3 "Safe Publication Idioms"

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="d2166f2ebd0bfae6-d13a9499-4d3b430a-93f28dfe-e2decd8f3b99f6c6a1532c6a"><ac:plain-text-body><![CDATA[

[[Goetz 2007

AA. Bibliography#Goetz 07]]

Pattern #2: "one-time safe publication"

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="c790261646fcb707-46bcd150-40c34f1d-a6d1bb8b-490d3b9417ca5980d5bd867b"><ac:plain-text-body><![CDATA[

[[JPL 2006

AA. Bibliography#JPL 06]]

14.10.2. "Final Fields and Security"

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="ffd77785514749e5-ef2dc7d9-4e514983-bcd394bc-ab373abc5d180c7910f85230"><ac:plain-text-body><![CDATA[

[[Pugh 2004

AA. Bibliography#Pugh 04]]

 

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

...