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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user