Package gw.util.concurrent
Class LockingLazyVar<T>
java.lang.Object
gw.util.concurrent.LockingLazyVar<T>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
A simple init interface to make LockingLazyVar's easier to construct from gosu. -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionConstructs a LockingLazyVar that will use itself as the object of synchronization.protected
LockingLazyVar
(Lock lock) Constructs a LockingLazyVar that will synchronize on the given object. -
Method Summary
Modifier and TypeMethodDescriptionfinal T
clear()
Clears the variable, forcing the next call toget()
to re-calculate the value.final void
final T
get()
protected abstract T
init()
protected void
initDirectly
(T val) boolean
isLoaded()
static <Q> LockingLazyVar<Q>
make
(LockingLazyVar.LazyVarInit<Q> init) Creates a new LockingLazyVar based on the type of the LazyVarInit passed in.static <Q> LockingLazyVar<Q>
make
(Lock lock, LockingLazyVar.LazyVarInit<Q> init)
-
Field Details
-
NULL
-
_val
-
_lock
-
-
Constructor Details
-
LockingLazyVar
public LockingLazyVar()Constructs a LockingLazyVar that will use itself as the object of synchronization. -
LockingLazyVar
Constructs a LockingLazyVar that will synchronize on the given object.
-
-
Method Details
-
get
- Returns:
- the value of this lazy var, created if necessary
-
init
-
clear
Clears the variable, forcing the next call toget()
to re-calculate the value. -
clearNoLock
public final void clearNoLock() -
initDirectly
-
isLoaded
public boolean isLoaded() -
make
Creates a new LockingLazyVar based on the type of the LazyVarInit passed in. This method is intended to be called with blocks from Gosu. -
make
-