Clean using thread local in all threads (KT-28940)
This commit is contained in:
@@ -418,10 +418,14 @@ public class LockBasedStorageManager implements StorageManager {
|
|||||||
public T invoke() {
|
public T invoke() {
|
||||||
ThreadLocal<Object> postComputeCache = valuePostCompute;
|
ThreadLocal<Object> postComputeCache = valuePostCompute;
|
||||||
if (postComputeCache != null) {
|
if (postComputeCache != null) {
|
||||||
Object _value = postComputeCache.get();
|
try {
|
||||||
if (!(_value instanceof NotValue)) {
|
Object _value = postComputeCache.get();
|
||||||
// This thread is counting the value so allow an early publication
|
if (!(_value instanceof NotValue)) {
|
||||||
return WrappedValues.unescapeThrowable(_value);
|
// This thread is counting the value so allow an early publication
|
||||||
|
return WrappedValues.unescapeThrowable(_value);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
postComputeCache.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -444,8 +448,8 @@ public class LockBasedStorageManager implements StorageManager {
|
|||||||
valuePostCompute = postComputeCache;
|
valuePostCompute = postComputeCache;
|
||||||
doPostCompute(value);
|
doPostCompute(value);
|
||||||
} finally {
|
} finally {
|
||||||
postComputeCache.remove();
|
|
||||||
valuePostCompute = null;
|
valuePostCompute = null;
|
||||||
|
postComputeCache.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user