Package org.apache.logging.log4j.util
Class LazyUtil.SafeLazy<T>
- java.lang.Object
-
- org.apache.logging.log4j.util.LazyUtil.SafeLazy<T>
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisInitialized()Indicates whether this lazy value has been initialized.voidreset()voidset(T newValue)Sets this lazy value to the provided value.java.lang.StringtoString()Tvalue()Returns the value held by this lazy.
-
-
-
Field Detail
-
lock
private final java.util.concurrent.locks.Lock lock
-
supplier
private final java.util.function.Supplier<T> supplier
-
value
private volatile java.lang.Object value
-
-
Constructor Detail
-
SafeLazy
SafeLazy(java.util.function.Supplier<T> supplier)
-
-
Method Detail
-
value
public T value()
Description copied from interface:LazyReturns the value held by this lazy. This may cause the value to initialize if it hasn't been already.
-
set
public void set(T newValue)
Description copied from interface:LazySets this lazy value to the provided value.
-
reset
public void reset()
-
isInitialized
public boolean isInitialized()
Description copied from interface:LazyIndicates whether this lazy value has been initialized.- Specified by:
isInitializedin interfaceLazy<T>
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-