Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lifecycle events for Immediate scope services #1016

Open
benfortuna opened this issue Apr 12, 2024 · 0 comments
Open

Lifecycle events for Immediate scope services #1016

benfortuna opened this issue Apr 12, 2024 · 0 comments
Labels
question Further information is requested

Comments

@benfortuna
Copy link

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:

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?

@pzygielo pzygielo added the question Further information is requested label Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants