@Service
@Singleton
public class ServerServiceDependencyAnalyzer
extends java.lang.Object
Analyzes dependencies among server services, primarily to order them as HK2 will instantiate
them. The orderedServerServices() method returns a list of server services classes in
an order that respects their run levels and injections among them.
This services uses the DiGraph class to create a directed graph. The graph contains a vertex for each
run level, with an edge from each run level vertex to the next run level's vertex.
We also create an edge from a run level's vertex to any service with that declared run level and from each
such service to the next run level. We add an edge from the root to any service without a declared run level.
For any service P injected into another service Q we create an edge from P's vertex to Q's.
A breadth-first traversal of such a graph visits the server services by run level respecting inter-service injection.