Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ConcurrentModificationException #4426

Merged
merged 1 commit into from
Jun 3, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;

Expand All @@ -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<String, Azure> sidToAzureMap = new HashMap<>();
protected Map<String, AppPlatformManager> sidToAzureSpringCloudManagerMap = new HashMap<>();
protected Map<String, Azure> sidToAzureMap = new ConcurrentHashMap<>();
protected Map<String, AppPlatformManager> sidToAzureSpringCloudManagerMap = new ConcurrentHashMap<>();

@Override
public String getPortalUrl() {
Expand Down Expand Up @@ -82,7 +81,7 @@ public String getScmSuffix() {
@Override
public String getTenantIdBySubscription(String subscriptionId) throws IOException {
final Pair<Subscription, Tenant> 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();
Expand Down