@Provides
	@Singleton
	synchronized ServiceGraph serviceGraph(Injector injector,
			OptionalInitializer<ServiceGraphModule> serviceGraphModuleOptionalInitializer,
			OptionalInitializer<ServiceGraph> serviceGraphOptionalInitializer) {
		serviceGraphModuleOptionalInitializer.accept(this);
		if (serviceGraph == null) {
			serviceGraph = ServiceGraph.create()
					.withStartCallback(() -> {
						createGuiceGraph(injector, serviceGraph);
						serviceGraph.removeIntermediateNodes();
					})
					.withNodeSuffixes(key -> {
						List<?> list = injector.getInstance(WorkerPools.class).getAllObjects(key);
						return list.isEmpty() ? null : list.size();
					})
					.initialize(initializer)
					.initialize(serviceGraphOptionalInitializer);
		}
		return serviceGraph;
	}
@ Provides @ Singleton synchronized ServiceGraph serviceGraph ( Injector injector , OptionalInitializer < ServiceGraphModule > serviceGraphModuleOptionalInitializer , OptionalInitializer < ServiceGraph > serviceGraphOptionalInitializer ) { serviceGraphModuleOptionalInitializer . accept ( this ) ; if ( serviceGraph == null ) { serviceGraph = ServiceGraph . create ( ) . withStartCallback ( ( ) -> { createGuiceGraph ( injector , serviceGraph ) ; serviceGraph . removeIntermediateNodes ( ) ; } ) . withNodeSuffixes ( key -> { List < ? > list = injector . getInstance ( WorkerPools . class ) . getAllObjects ( key ) ; return list . isEmpty ( ) ? null : list . size ( ) ; } ) . initialize ( initializer ) . initialize ( serviceGraphOptionalInitializer ) ; } return serviceGraph ; }
Creates the new {@code ServiceGraph} without circular dependencies and
intermediary nodes

@param injector injector for building the graphs of objects
@return created ServiceGraph