Skip to content

Lifecycle events for Immediate scope services #1016

Open
@benfortuna

Description

@benfortuna

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions