On Fri, 2007-10-05 at 21:30 -0400, MenTaLguY wrote: > // external volatile value initialization intended to obviate the need for > // readValueUnderLock technique used in ConcurrentHashMap. may be a little > // slower, but better to pay a price on first write rather than all reads. > e = new VariableTableEntry(hash, name.intern(), table[index]); > e.value = value; > table[index] = e; > variableTableSize = potentialNewSize; > variableTable = table; // write-volatile > > The fact that e.value is a volatile location means only that reads of > e.value will see all writes up to and including a write to it; it doesn't > enforce the non-visibility of subsequent writes.
Similarly, the synchronization on variableTable guarantees only that prior writes to table[index] will be visible to readers of variableTable -- not that subsequent writes to table[index] won't be. -mental
signature.asc
Description: This is a digitally signed message part
