Your code only needs to construct a single URL for connecting to the Domain Runtime MBean Server on the Administration Server.
The code can look up values for all server instances and optionally filter the results.