Safeguard to avoid nested creation of KapuaLocator singletons.
Without this patch, if a class instantiated within Guice's startup (part of a Module of being automatically instantiated by virtue of having a parameterless public constructor, or one annotated via @Inject) AND it referenced KapuaLocator.getInstance() in the constructor code (or in STATIC assignments), this resulted in a nested creation of a KapuaLocator instance, with duplicate objects in memory, and potential for race conditions (in case, for example, a queue consumer was instantiated).
Description of the solution adopted
This patch makes sure no nested instantiations are possible, failing at startup time instead of creating nested contexts.
Safeguard to avoid nested creation of KapuaLocator singletons. Without this patch, if a class instantiated within Guice's startup (part of a Module of being automatically instantiated by virtue of having a parameterless public constructor, or one annotated via @Inject) AND it referenced KapuaLocator.getInstance() in the constructor code (or in STATIC assignments), this resulted in a nested creation of a KapuaLocator instance, with duplicate objects in memory, and potential for race conditions (in case, for example, a queue consumer was instantiated).
Description of the solution adopted This patch makes sure no nested instantiations are possible, failing at startup time instead of creating nested contexts.