}
}
private void addTenantSubscriptionToLbContext(String serviceName, int tenantId) {
// Find cluster of tenant
Cluster cluster = findCluster(serviceName, tenantId);
if (cluster != null) {
for (String hostName : cluster.getHostNames()) {
// Add hostName, tenantId, cluster to multi-tenant map
Map<Integer, Cluster> clusterMap = LoadBalancerContext.getInstance().getMultiTenantClusterMap().getClusters(hostName);
if (clusterMap == null) {
clusterMap = new HashMap<Integer, Cluster>();
clusterMap.put(tenantId, cluster);
LoadBalancerContext.getInstance().getMultiTenantClusterMap().addClusters(hostName, clusterMap);
} else {
clusterMap.put(tenantId, cluster);
}
if (log.isDebugEnabled()) {
log.debug(String.format("Cluster added to multi-tenant cluster map: [host-name] %s [tenant-id] %d [cluster] %s",
hostName, tenantId, cluster.getClusterId()));
}
}
} else {
if (log.isErrorEnabled()) {
log.error(String.format("Could not find cluster of tenant: [service] %s [tenant-id] %d",