|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
@Contract public interface RunLevelService<T>
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 a scope 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==RunLevelDefaultScope, 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 RunLevelListener(s)
for event notification, habitat resident InhabitantSorter(s) for arranging
the order of inhabitants to be activated at a given RunLevel, and finally
habitat resident InhabitantActivator(s) for the activation (i.e. get) and
deactivation (i.e., release) of the sorted inhabitants.
AbstractRunLevelService,
RunLevelListener,
InhabitantSorter,
InhabitantActivator| Method Summary | |
|---|---|
RunLevelState<T> |
getState()
Returns the current state of this RunLevelService instance. |
void |
interrupt()
Causes this RunLevelService to attempt to stop any in-flight proceedTo() operation. |
void |
interrupt(int runLevel)
Same as interrupt(), with the option to immediately perform
a proceedTo(int) following the interrupt. |
void |
proceedTo(int runLevel)
Causes this RunLevelService to move to the specified run level for all RunLevel instances (identified by scope), orchestrating the appropriate lifecycle events based on the given implementation strategy. |
| Method Detail |
|---|
RunLevelState<T> getState()
void proceedTo(int runLevel)
If the RunLevel specified is the same as the current RunLevel then the RunLevelService may return immediately.
Note that the underlying implementation may perform this operation asynchronously. Implementors who choose the asynchronous approach are expected to treat a subsequent proceedTo(newRunLevel) call as an implicit cancellation of any currently running proceedTo() that is running on one or more managed threads. Again, see the javadoc for each implementation for details.
runLevel - the run level to move to.void interrupt()
See the javadoc for each implementation for specific details
void interrupt(int runLevel)
interrupt(), with the option to immediately perform
a proceedTo(int) following the interrupt.
runLevel - the run level to move to following the interrupt
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||