this has no error handling when there is no collection with that name available
The exception for non-existent collection comes from CloudSolrClient when using ZkClientClusterStateProvider, and it came from HttpClusterStateProvider as per the patch. However, I've updated the patch now where I've caught the RemoteSolrException, checked for the exception message (as returned from the CLUSTERSTATUS api) and returned null when collection doesn't exist so that CloudSolrClient can return the same exception as it does when ZkClientClusterStateProvider. Added a test for this (CloudSolrClientTest#testCollectionDoesntExist).
code like below is bad
Removed the spurious null check.
what kind of exception are you trying to catch and why? what is the point in hitting another server after you get a SolrException?
I imagine a server that is struggling for some reason, throwing things like OOMs or timeouts or 404s. This server could possibly be not live at the moment. The point of hitting another server is that hopefully another live server would respond with the proper clusterstate/live_nodes.
NamedList#asMap() does a deep copy . why do you even do it here?
Ah, I didn't realize there exists a NamedList#asShallowMap() method. Switched to use that.