Is there a way to track the lifecycle of Immediate scope services such that I can block until all Immediate services are initialized?
I want to be able to do something like this:
ServiceLocator serviceLocator = ServiceLocationUtilities.createAndPopulateServiceLocator();
ServiceLocatorUtilities.enableImmediateScope(serviceLocator);
// 1. wait until Immediate scope services have loaded..
// 2. continue application logic
I could call serviceLocator.getService(..) on each of the Immediate scope services, but then they don't really need to be Immediate. And also for my use case I won't have access to the full list as it would be defined in a separate module.
I notice the comment on ServiceLocatorState says to "assume future states will be added" - could this include a PENDING state or equivalent prior to RUNNING where Immediate scoped services are being loaded?
This is more a question than an issue.
Is there a way to track the lifecycle of Immediate scope services such that I can block until all Immediate services are initialized?
I want to be able to do something like this:
I could call
serviceLocator.getService(..)
on each of the Immediate scope services, but then they don't really need to be Immediate. And also for my use case I won't have access to the full list as it would be defined in a separate module.I notice the comment on
ServiceLocatorState
says to "assume future states will be added" - could this include aPENDING
state or equivalent prior toRUNNING
where Immediate scoped services are being loaded?