...
Code Block | ||
---|---|---|
| ||
class Foo {
private volatile Helper helper;
public Helper getHelper() {
return helper;
}
public void initialize() {
helper = new Helper(42);
}
}
// Mutable but thread-safe Helper
public class Helper {
private volatile int n;
private final Object lock = new Object();
public Helper(int n) {
this.n = n;
}
public void setN(int value) {
synchronized (lock) {
n = value;
}
}
}
|
...
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="6bd70b40e7da118c-b5e10b6e-40f8415e-a7eab82c-4132b2d3d580f8d21c000c07"><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="80451f48b90ac0ce-8397450d-43544c86-b50d8200-5124ce6eb98424bb953d6856"><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="768160e334c6c5f5-7674d233-469447d0-98b59401-9e28b1bfe0acc46ce5e42b54"><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="ac1e219cf064fcc3-f12612f2-44d040a3-8eafaf84-7930b2304dfcdcda77b16269"><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="ac0cedf45b01f1fe-93c76934-43a14eef-b334a67d-62cd0a1922fc66d7ddbb13c0"><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="d8b0876c8ceba1f8-e64fb080-4c724d7d-bfa9bf72-43d5e060278c17398b80eb7a"><ac:plain-text-body><![CDATA[ | [[Pugh 2004 | AA. Bibliography#Pugh 04]] |
| ]]></ac:plain-text-body></ac:structured-macro> |
...
11. Thread-Safety Miscellaneous (TSM) TSM04-J. Document thread-safety and use annotations where applicable12. Input Output (FIO)