Package manifold.util.concurrent
Class LocklessLazyVar<T>
- java.lang.Object
-
- manifold.util.concurrent.LocklessLazyVar<T>
-
public abstract class LocklessLazyVar<T> extends Object
Implements the lazy initialization pattern. No locking of any kind is used.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceLocklessLazyVar.LazyVarInit<Q>
-
Constructor Summary
Constructors Constructor Description LocklessLazyVar()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Tclear()Clears the variable, forcing the next call toget()to re-init the value.Tget()protected abstract Tinit()booleanisLoaded()static <Q> LocklessLazyVar<Q>make(LocklessLazyVar.LazyVarInit<Q> closure)Creates a new LockingLazyVar based on the type of the LazyVarInit passed in.Tset(T value)
-
-
-
Field Detail
-
NULL
protected static final Object NULL
-
-
Method Detail
-
get
public T get()
- Returns:
- the value of this lazy var, created if necessary
-
init
protected abstract T init()
-
clear
public final T clear()
Clears the variable, forcing the next call toget()to re-init the value.
-
isLoaded
public boolean isLoaded()
-
make
public static <Q> LocklessLazyVar<Q> make(LocklessLazyVar.LazyVarInit<Q> closure)
Creates a new LockingLazyVar based on the type of the LazyVarInit passed in.
-
-