Implementations of this contract are responsible for orchestration lifecycle events (i.e., start levels) in Hk2.
Each resident run level service is responsible for a particular class of RunLevel
that is identified by an environment value.
Implementations of this service are responsible for orchestrating lifecycle events for services annotated with RunLevel
. This consists of inhabitant activations (i.e., get) and deactivations (i.e., release).
The default RunLevelService uses T==Void.class, and is registered in the habitat with the name "default" and is the primary service instance responsible for the "platform".
Third parties (or otherwise any sub-component) may choose to define other implementation variations of this contract for other specific needs.
RunLevelServices are special in that they are constructed early on in habitat creation lifecycle. As a result, they should not rely on the Habitat being fully initialized in any PostConstruct
call. Alternatively, they should implement HabitatListener, and wait for a habitat initialization event before doing any initialization work.
Each implementation of the RunLevelService may vary, but in general it is encouraged that the implementation use habitat resident {@link RunLevelListener}(s) for event notification, habitat resident {@link InhabitantSorter}(s) for arranging the order of inhabitants to be activated at a given {@link RunLevel}, and finally habitat resident {@link InhabitantActivator}(s) for the activation (i.e. get) and deactivation (i.e., release) of the sorted inhabitants.
@see DefaultRunLevelService
@see RunLevelListener
@see InhabitantSorter
@see InhabitantActivator
@author Jeff Trent
@since 3.1