mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[groovy] make guard static (follow-up IDEA-CR-10151)
This commit is contained in:
+3
-1
@@ -25,6 +25,8 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
public class NotNullCachedComputableWrapper<T> implements NotNullComputable<T> {
|
||||
|
||||
private static final RecursionGuard ourGuard = RecursionManager.createGuard(NotNullCachedComputableWrapper.class.getName());
|
||||
|
||||
private volatile NotNullComputable<T> myComputable;
|
||||
private final AtomicReference<T> myValueRef = new AtomicReference<>();
|
||||
|
||||
@@ -42,7 +44,7 @@ public class NotNullCachedComputableWrapper<T> implements NotNullComputable<T> {
|
||||
final NotNullComputable<T> computable = myComputable;
|
||||
if (computable == null) continue; // computable is null only after some thread succeeds CAS
|
||||
|
||||
RecursionGuard.StackStamp stamp = RecursionManager.createGuard(computable.getClass().getName()).markStack();
|
||||
RecursionGuard.StackStamp stamp = ourGuard.markStack();
|
||||
value = computable.compute();
|
||||
if (stamp.mayCacheNow()) {
|
||||
if (myValueRef.compareAndSet(null, value)) { // try to cache value
|
||||
|
||||
Reference in New Issue
Block a user