-
Notifications
You must be signed in to change notification settings - Fork 179
Concurrent Singleton
Randgalt edited this page Jan 4, 2013
·
7 revisions
Guice’s default Singleton scope synchronizes all object creation on a single lock (see here). It does this to avoid deadlocks with circular dependencies. Governator adds the FineGrainedLazySingleton
annotation that locks on the Guice Key so that multiple singletons can be created concurrently. Circular dependencies are rare so FineGrainedLazySingleton risks deadlocks in those situations for the benefit of better concurrency.
A class annotated with FineGrainedLazySingleton
will be…
- …lazily created (like Lazy Singleton)
- …created by the FineGrainedLazySingletonScope which synchronizes on the Guice Key instead of
InternalInjectorCreator.class
) - …able to be created alongside other FineGrainedLazySingleton in different threads
- Home
- Getting Started
- Bootstrapping
- Lifecycle Management
- Auto Binding
- Module-Dependencies
- Warm Up
- Configuration Mapping
- Field Validation
- Lazy Singleton
- Concurrent Singleton
- Generic Binding Annotations
- LifecycleListener
- Governator Phases
- Grapher Integration
- JUnit Testing
- FAQ
- Best Practices
- Spring, PicoContainer, Etc.
- Javadoc
- End-to-End Examples