|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.wideplay.warp.persist.internal.LazyReference<T>
@ThreadSafe public class LazyReference<T>
Utility to lazily load an object reference. It uses Double-Checked Locking under the covers and thus can safely be accessed from multiple threads concurrently.
Method Summary | ||
---|---|---|
T |
get()
Get the existing T instance, or lazily initialize T using instanceProvider . |
|
static
|
of(com.google.inject.Provider<T> instanceProvider)
Create a lazy reference with a provider of the eventual instance. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public T get()
instanceProvider
.
public static <T> LazyReference<T> of(com.google.inject.Provider<T> instanceProvider)
instanceProvider
- a Provider
that gives out the eventual instance,
usually an expensive operation
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |