Updated Branches: refs/heads/master 0ca62397e -> f56e254b4
fixing STRATOS-356 Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/39355ad9 Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/39355ad9 Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/39355ad9 Branch: refs/heads/master Commit: 39355ad99ee4ab00d3237fbf0e2ff2b4ac706f06 Parents: 4a143c5 Author: Isuru <[email protected]> Authored: Tue Jan 14 12:34:23 2014 +0530 Committer: Isuru <[email protected]> Committed: Tue Jan 14 12:34:23 2014 +0530 ---------------------------------------------------------------------- .../rest/endpoint/services/ServiceUtils.java | 83 ++++++++++---------- 1 file changed, 42 insertions(+), 41 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/39355ad9/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java index 7f80551..c82ddf1 100644 --- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java +++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java @@ -762,52 +762,53 @@ public class ServiceUtils { lbRefProp.add(property); break; - } else if (Constants.SERVICE_AWARE_LOAD_BALANCER.equals(name)) { - if ("true".equals(value)) { - property.setValue(name); - if (log.isDebugEnabled()) { - log.debug("This cartridge uses a service aware load balancer. " + - "[Type] " + cartridgeType); - } - if (autoscalerServiceClient != null) { - try { - - // get the valid policies for lb cartridge - DeploymentPolicy[] lbCartridgeDepPolicies = - autoscalerServiceClient.getDeploymentPolicies(lbCartridgeType); - // traverse deployment policies of lb cartridge - for (DeploymentPolicy policy : lbCartridgeDepPolicies) { - // check existence of the subscribed policy - if (deploymentPolicy.equals(policy.getId())) { - - if (!autoscalerServiceClient.checkServiceLBExistenceAgainstPolicy(cartridgeType, - deploymentPolicy)) { - - // if lb cluster doesn't exist - String lbAlias = - "lb" + cartridgeType + - new Random().nextInt(); - lbCartridgeInfo.addProperties(property); - subscribeToLb(lbCartridgeType, - lbAlias, - lbCartridgeInfo.getDefaultAutoscalingPolicy(), - deploymentPolicy, - configurationContext, userName, - tenantDomain, - lbCartridgeInfo.getProperties()); - } + } + + } else if (Constants.SERVICE_AWARE_LOAD_BALANCER.equals(name)) { + if ("true".equals(value)) { + property.setValue(name); + if (log.isDebugEnabled()) { + log.debug("This cartridge uses a service aware load balancer. " + + "[Type] " + cartridgeType); + } + if (autoscalerServiceClient != null) { + try { + + // get the valid policies for lb cartridge + DeploymentPolicy[] lbCartridgeDepPolicies = + autoscalerServiceClient.getDeploymentPolicies(lbCartridgeType); + // traverse deployment policies of lb cartridge + for (DeploymentPolicy policy : lbCartridgeDepPolicies) { + // check existence of the subscribed policy + if (deploymentPolicy.equals(policy.getId())) { + + if (!autoscalerServiceClient.checkServiceLBExistenceAgainstPolicy(cartridgeType, + deploymentPolicy)) { + + // if lb cluster doesn't exist + String lbAlias = + "lb" + cartridgeType + + new Random().nextInt(); + lbCartridgeInfo.addProperties(property); + subscribeToLb(lbCartridgeType, + lbAlias, + lbCartridgeInfo.getDefaultAutoscalingPolicy(), + deploymentPolicy, + configurationContext, userName, + tenantDomain, + lbCartridgeInfo.getProperties()); } } - - } catch (Exception ex) { - // we don't need to throw the error here. - log.error(ex.getMessage(), ex); } - } - lbRefProp.add(property); - break; + } catch (Exception ex) { + // we don't need to throw the error here. + log.error(ex.getMessage(), ex); + } } + + lbRefProp.add(property); + break; } } }
