diff --git a/Utils/azuretools-core/src/com/microsoft/azuretools/sdkmanage/AzureManagerBase.java b/Utils/azuretools-core/src/com/microsoft/azuretools/sdkmanage/AzureManagerBase.java index e42f71af39..0d4646167f 100644 --- a/Utils/azuretools-core/src/com/microsoft/azuretools/sdkmanage/AzureManagerBase.java +++ b/Utils/azuretools-core/src/com/microsoft/azuretools/sdkmanage/AzureManagerBase.java @@ -28,13 +28,12 @@ import com.microsoft.azure.management.resources.Subscription; import com.microsoft.azure.management.resources.Tenant; import com.microsoft.azuretools.authmanage.Environment; -import com.microsoft.azuretools.azurecommons.helpers.AzureCmdException; import com.microsoft.azuretools.utils.Pair; import org.apache.commons.lang3.StringUtils; import java.io.IOException; -import java.util.HashMap; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import static com.microsoft.azuretools.authmanage.Environment.*; @@ -48,8 +47,8 @@ public abstract class AzureManagerBase implements AzureManager { private static final String CHINA_SCM_SUFFIX = ".scm.chinacloudsites.cn"; private static final String GLOBAL_SCM_SUFFIX = ".scm.azurewebsites.net"; - protected Map sidToAzureMap = new HashMap<>(); - protected Map sidToAzureSpringCloudManagerMap = new HashMap<>(); + protected Map sidToAzureMap = new ConcurrentHashMap<>(); + protected Map sidToAzureSpringCloudManagerMap = new ConcurrentHashMap<>(); @Override public String getPortalUrl() { @@ -82,7 +81,7 @@ public String getScmSuffix() { @Override public String getTenantIdBySubscription(String subscriptionId) throws IOException { final Pair subscriptionTenantPair = getSubscriptionsWithTenant().stream() - .filter(pair -> pair!= null && pair.first() != null && pair.second() != null) + .filter(pair -> pair != null && pair.first() != null && pair.second() != null) .filter(pair -> StringUtils.equals(pair.first().subscriptionId(), subscriptionId)) .findFirst().orElseThrow(() -> new IOException("Failed to find storage subscription id")); return subscriptionTenantPair.second().tenantId();