From 903ab9abe3054f1abf43a640a69cc599214ad4c4 Mon Sep 17 00:00:00 2001 From: Ace Date: Mon, 3 Apr 2017 17:29:25 +0530 Subject: [PATCH] Adding logic to acknowledge 404 response when tiers not available --- .../extension/APIManagementProviderServiceImpl.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java index 070a9f6402..5e4dda364b 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java @@ -76,18 +76,18 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext() .getTenantDomain(); String tiersLoadedForTenant = tiersMap.get(tenantDomain); + if (tiersLoadedForTenant == null) { - int tierStatus = 0; + boolean tierLoaded = false; int attempts = 0; do { try { storeClient.getIndividualTier() .tiersTierLevelTierNameGet(ApiApplicationConstants.DEFAULT_TIER, APP_TIER_TYPE, - tenantDomain, CONTENT_TYPE, null, null); + tenantDomain, CONTENT_TYPE, null, null); tiersMap.put(tenantDomain, "exist"); - tierStatus = 200; + tierLoaded = true; } catch (FeignException e) { - tierStatus = e.status(); attempts++; try { Thread.sleep(500); @@ -95,7 +95,7 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe log.warn("Interrupted the waiting for tier availability."); } } - } while (tierStatus == 500 && attempts < MAX_ATTEMPTS); + } while ((!tierLoaded) && attempts < MAX_ATTEMPTS); } ApplicationList applicationList = storeClient.getApplications()