constant; @ForceInline @Override public T get() { final T t = getAcquire(); return (t != null) ? t : getSlowPath(); } public final class LazyConstantImpl<T> implements LazyConstant<T> { @Stable private T constant; @ForceInline @Override public T get() { final T t = getAcquire(); return (t != null) ? t : getSlowPath(); }
= getAcquire(); if (t == null) { t = computingFunction.get(); Objects.requireNonNull(t); setRelease(t); // Allow the underlying supplier to be collected after successful use computingFunction = null; } return t; } } private T getSlowPath() { preventReentry(); synchronized (this) { T t = getAcquire(); if (t == null) { t = computingFunction.get(); Objects.requireNonNull(t); setRelease(t); // Allow the underlying supplier to be collected after successful use computingFunction = null; } return t; } }
= getAcquire(); if (t == null) { t = computingFunction.get(); Objects.requireNonNull(t); setRelease(t); // Allow the underlying supplier to be collected after successful use computingFunction = null; } return t; } } の実行