public <T> Provider<T> scope(final Key<T> key, final Provider<T> creator) {
// lock is referenced from anonymous class instance
final Object rootInjectorLock = singletonCreationPerRootInjectorLock.get();
if (rootInjectorLock == null) {
throw new OutOfScopeException("Singleton scope should only be used from Injector");
}
return new Provider<T>() {
/*
* The lazily initialized singleton instance. Once set, this will either have type T or will
* be equal to NULL.