Package org.proxy4j.core.init
Class LazyProvider<T>
- java.lang.Object
-
- org.proxy4j.core.init.LazyProvider<T>
-
- All Implemented Interfaces:
javax.inject.Provider<T>
public abstract class LazyProvider<T> extends Object implements javax.inject.Provider<T>
- Author:
- Brennan Spies
Encapsulates the use of the double-checked lock idiom for lazily initializing an instance in a thread-safe way. Subclasses override the
init()method to provide the lazily initialized instance.
-
-
Constructor Summary
Constructors Constructor Description LazyProvider()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Tget()Gets the instance ofTlazily.protected abstract Tinit()Must be overriden to initialize the variable reference.
-