private String getServiceUrl()

in src/main/java/org/apache/pulsar/manager/service/impl/EnvironmentCacheServiceImpl.java [123:143]


    private String getServiceUrl(String environment, String cluster, int numReloads) {
        // if there is a cluster specified, lookup the cluster.
        Map<String, ClusterData> clusters = environments.get(environment);
        ClusterData clusterData;
        if (null == clusters) {
            clusterData = reloadCluster(environment, cluster);
        } else {
            clusterData = clusters.get(cluster);
            if (clusterData == null) {
                clusterData = reloadCluster(environment, cluster);
            }
        }

        if (null == clusterData) {
            // no environment and no cluster
            throw new RuntimeException(
                    "No cluster '" + cluster + "' found in environment '" + environment + "'");
        }

        return StringUtils.isNotBlank(clusterData.getServiceUrlTls()) ? clusterData.getServiceUrlTls() : clusterData.getServiceUrl();
    }