Package jetbrains.buildServer.util.impl
Class LazyAtomicReference<V>
- java.lang.Object
-
- java.util.concurrent.atomic.AtomicReference<V>
-
- jetbrains.buildServer.util.impl.LazyAtomicReference<V>
-
- Type Parameters:
V-
- All Implemented Interfaces:
Serializable
public class LazyAtomicReference<V> extends AtomicReference<V>
This class is a simple alternative toLazy. It can be better in cases when memory footprint is important, because Lazy requires creation of an anonymous class which can capture "this" of the outer instance. It is also a bit simpler to use than Lazy because under the hood this is still an AtomicReference with all its convenient atomic methods.- Since:
- 2020.1
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description LazyAtomicReference()LazyAtomicReference(V initialValue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description VcomputeIfAbsent(Supplier<V> initializer)voidconsumeIfPresent(Consumer<V> consumer)-
Methods inherited from class java.util.concurrent.atomic.AtomicReference
accumulateAndGet, compareAndSet, get, getAndAccumulate, getAndSet, getAndUpdate, lazySet, set, toString, updateAndGet, weakCompareAndSet
-
-
-
-
Constructor Detail
-
LazyAtomicReference
public LazyAtomicReference(@Nullable V initialValue)
-
LazyAtomicReference
public LazyAtomicReference()
-
-