ISPN-4561 CacheManager.stop with indexing to Infinispan fails

https://issues.jboss.org/browse/ISPN-4561

As discussed, introduced a graph to store cache dependencies and enforce it at stop time, plus an API to interact with that. Query will register cache dependencies accordingly. Backporting should be straighforward.
Yes, your solution didn't block, so it had a different problem with chain dependencies like C1 -> C2 -> C3. 
Assuming cacheManager.stop() processes them in reverse order, after the first pass C1 would be stopped, and C2 and C3 would both have 0 references. Then in the second pass, C3 could be stopped before C2.