Double-checked locking fixed in LockBasedStorageManager

There were two problems here:
 * a volatile field was read and then a local variable used, i.e. the field might have been changed in between the check and the return;
 * this volatile read was unnecessary, because the whole purpose of `_value` local variable is to avoid it.
This commit is contained in:
Andrey Breslav
2014-03-12 13:55:24 +04:00
parent 667afc565e
commit aa00862425
@@ -277,7 +277,7 @@ public class LockBasedStorageManager implements StorageManager {
@Override
public T invoke() {
Object _value = value;
if (!(value instanceof NotValue)) return WrappedValues.unescapeThrowable(_value);
if (!(_value instanceof NotValue)) return WrappedValues.unescapeThrowable(_value);
lock.lock();
try {