A RunLevelContoller controls the current state of services registered in the {@link RunLevel} scope. Allservices annotated with a {@link RunLevel} equal toor less than the current level of the system will be started. All services annotated with a {@link RunLevel}higher than the current level of the system will not be started. This service can be used to change the current level of the system.
Whether or not separate threads are used by the RunLevelController is a policy set by the caller. By default the RunLevelController will use as many threads as there are services to be started at a particular level. So if your system has possibly hundreds of services at some level, you will probably want to set your maximum number of threads to some reasonable number. You can also change your threading policy to USE_NO_THREADS, in which case the RunLevelController will not spawn any threads at all, but will instead use the thread of the caller to perform all work. In this mode the Async API will throw an exception.
The RunLevelController starts at level -2. The reasoning behind this is to allow two "immediate" levels. The first thing a system might do is proceed to level 0 (running all services at level -1 and 0). Thereafter the system may go up and down in levels, never going below zero. Note this is only a convention, and individual systems can choose other meanings for the levels -1 and 0.
@author jtrent, tbeerbower, jwells