T () { T curValue = myValue; if (curValue != null) { return curValue; } return ProgressIndicatorUtils.computeWithLockAndCheckingCanceled(myLock, TIMEOUT, TimeUnit.MILLISECONDS, () -> { T value = myValue; if (value == null) { RecursionGuard.StackStamp stamp = RecursionManager.markStack(); value = compute(); if (stamp.mayCacheNow()) { myValue = value; } } return value; }); }