In some cases, for instance when we want to backup solrcloud collections programmatically, we need to know what are the Shard Leaders. The example below shows how that can be achieved using SolrJ.