org.jvnet.hk2.component
Interface RunLevelService<T>

All Known Implementing Classes:
DefaultRunLevelService

@Contract
public interface RunLevelService<T>

The run level service for a particular class of RunLevel, identified by environment.

Implementations of this service are responsible for orchestrating lifecycle events for services annotated with RunLevel.

The default RunLevelService uses T==Void.class, and is registered in the habitat with the name "default".

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.

Since:
3.1
Author:
Jeff Trent

Method Summary
 RunLevelState<T> getState()
          Returns the current state of this RunLevelService instance.
 void proceedTo(int runLevel)
          Causes this RunLevelService to move to the specified run level for all RunLevel instances (identified by environment), orchestrating the appropriate lifecycle events based on the given implementation strategy.
 

Method Detail

getState

RunLevelState<T> getState()
Returns the current state of this RunLevelService instance.


proceedTo

void proceedTo(int runLevel)
Causes this RunLevelService to move to the specified run level for all RunLevel instances (identified by environment), orchestrating the appropriate lifecycle events based on the given implementation strategy. See the javadoc for each implementation for details.

If the RunLevel specified is the same as the current RunLevel then the RunLevelService will 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.

Parameters:
runLevel - the run level to move to.


Copyright © 2010 Sun Microsystems, Inc.. All Rights Reserved.