mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
concurrency bug: cached value can be set to null while the other thread has already computed it in the meantime. This leads to multiple unnecessary re-computations.
This commit is contained in:
@@ -59,9 +59,12 @@ public class CachedValuesManagerImpl extends CachedValuesManager {
|
||||
if (dataHolder instanceof UserDataHolderEx) {
|
||||
UserDataHolderEx dh = (UserDataHolderEx)dataHolder;
|
||||
value = dh.getUserData(key);
|
||||
if (isOutdated(value)) {
|
||||
value = null;
|
||||
dh.putUserData(key, null);
|
||||
while (isOutdated(value)) {
|
||||
if (dh.replace(key, value, null)) {
|
||||
value = null;
|
||||
break;
|
||||
}
|
||||
value = dh.getUserData(key);
|
||||
}
|
||||
if (value == null) {
|
||||
value = createCachedValue(provider, trackValue);
|
||||
|
||||
Reference in New Issue
Block a user