Commenting out LB related classes
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/18745a09 Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/18745a09 Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/18745a09 Branch: refs/heads/master Commit: 18745a09b3ecce9999f84e9a47548867c8fe02e2 Parents: 302c58b Author: Lahiru Sandaruwan <[email protected]> Authored: Fri Nov 28 18:40:49 2014 +0530 Committer: Lahiru Sandaruwan <[email protected]> Committed: Fri Nov 28 19:12:25 2014 +0530 ---------------------------------------------------------------------- .../autoscaler/NetworkPartitionLbHolder.java | 396 +++++++++---------- .../autoscaler/api/AutoScalerServiceImpl.java | 268 ++++++------- .../client/CloudControllerClient.java | 8 +- .../context/cluster/ClusterContextFactory.java | 98 +++-- .../interfaces/AutoScalerServiceInterface.java | 84 ++-- .../internal/AutoscalerServerComponent.java | 14 +- .../monitor/cluster/ClusterMonitorFactory.java | 34 +- .../monitor/cluster/VMLbClusterMonitor.java | 388 +++++++++--------- .../autoscaler/partition/PartitionManager.java | 112 +++--- .../autoscaler/policy/PolicyManager.java | 4 +- .../autoscaler/registry/RegistryManager.java | 82 ++-- .../autoscaler/rule/RuleTasksDelegator.java | 85 ++-- 12 files changed, 816 insertions(+), 757 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/18745a09/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/NetworkPartitionLbHolder.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/NetworkPartitionLbHolder.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/NetworkPartitionLbHolder.java index 9788cd6..f773a5e 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/NetworkPartitionLbHolder.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/NetworkPartitionLbHolder.java @@ -1,198 +1,198 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.stratos.autoscaler; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -/** - * Holds LB data of a network partition. - * - */ -public class NetworkPartitionLbHolder implements Serializable{ - - private static final long serialVersionUID = -7181166769691018046L; - private final String networkPartitionId; - - private String defaultLbClusterId; - - private Map<String, String> serviceNameToLBClusterIdMap; - - private Map<String, String> clusterIdToLBClusterIdMap; - - public NetworkPartitionLbHolder(String networkPartitionId) { - - super(); - this.networkPartitionId = networkPartitionId; - this.setServiceToLBClusterId(new HashMap<String, String>()); - this.setClusterIdToLBClusterIdMap(new HashMap<String, String>()); - } - - public String getDefaultLbClusterId() { - - return this.defaultLbClusterId; - - } - - public void setDefaultLbClusterId(final String defaultLbClusterId) { - - this.defaultLbClusterId = defaultLbClusterId; - - } - - public String getLBClusterIdOfService(final String serviceName) { - - return this.serviceNameToLBClusterIdMap.get(serviceName); - - } - - public Map<String, String> getServiceToLBClusterId() { - - return this.serviceNameToLBClusterIdMap; - - } - - public void setServiceToLBClusterId(final Map<String, String> serviceToLBClusterId) { - - this.serviceNameToLBClusterIdMap = serviceToLBClusterId; - - } - - public void addServiceLB(final String serviceName, final String lbClusterId) { - this.serviceNameToLBClusterIdMap.put(serviceName, lbClusterId); - } - - public String getLBClusterIdOfCluster(final String clusterId) { - - return this.clusterIdToLBClusterIdMap.get(clusterId); - - } - - public Map<String, String> getClusterIdToLBClusterIdMap() { - - return this.clusterIdToLBClusterIdMap; - - } - - public void setClusterIdToLBClusterIdMap(final Map<String, String> clusterIdToLBClusterIdMap) { - - this.clusterIdToLBClusterIdMap = clusterIdToLBClusterIdMap; - - } - - public boolean removeLbClusterId(String clusterId) { - if (isLBExist(clusterId)) { - if(isDefaultLBExist() && defaultLbClusterId.equals(clusterId)) { - defaultLbClusterId = null; - return true; - - } else if (serviceNameToLBClusterIdMap.containsValue(clusterId)){ - for (String service : serviceNameToLBClusterIdMap.keySet()) { - if(clusterId.equals(serviceNameToLBClusterIdMap.get(service))) { - serviceNameToLBClusterIdMap.remove(service); - return true; - } - } - } else if (clusterIdToLBClusterIdMap.containsValue(clusterId)){ - for (String cluster : clusterIdToLBClusterIdMap.keySet()) { - if(clusterId.equals(clusterIdToLBClusterIdMap.get(cluster))) { - clusterIdToLBClusterIdMap.remove(cluster); - return true; - } - } - } - } - return false; - } - - public boolean isLBExist(final String clusterId) { - - return clusterId != null && - (clusterId.equals(this.defaultLbClusterId) || - this.serviceNameToLBClusterIdMap.containsValue(clusterId) || this.clusterIdToLBClusterIdMap.containsValue(clusterId)); - - } - - public boolean isDefaultLBExist() { - - return defaultLbClusterId != null; - - } - - public boolean isServiceLBExist(String serviceName) { - - return this.serviceNameToLBClusterIdMap.containsKey(serviceName) && - this.serviceNameToLBClusterIdMap.get(serviceName) != null; - - } - - public boolean isClusterLBExist(String clusterId) { - - return this.clusterIdToLBClusterIdMap.containsKey(clusterId) && - this.clusterIdToLBClusterIdMap.get(clusterId) != null; - - } - - public int hashCode() { - - final int prime = 31; - int result = 1; - result = prime * result + ((this.networkPartitionId == null) ? 0 : this.networkPartitionId.hashCode()); - return result; - - } - - public boolean equals(final Object obj) { - - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (!(obj instanceof NetworkPartitionLbHolder)) { - return false; - } - final NetworkPartitionLbHolder other = (NetworkPartitionLbHolder) obj; - if (this.networkPartitionId == null) { - if (other.networkPartitionId != null) { - return false; - } - } - else if (!this.networkPartitionId.equals(other.networkPartitionId)) { - return false; - } - return true; - } - - @Override - public String toString() { - return "NetworkPartitionLbHolder [networkPartitionId=" - + networkPartitionId + ", defaultLbClusterId=" - + defaultLbClusterId + ", serviceNameToLBClusterIdMap=" - + serviceNameToLBClusterIdMap + ", clusterIdToLBClusterIdMap=" - + clusterIdToLBClusterIdMap + "]"; - } - - public String getNetworkPartitionId() { - return networkPartitionId; - } - -} \ No newline at end of file +///* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +//package org.apache.stratos.autoscaler; +// +//import java.io.Serializable; +//import java.util.HashMap; +//import java.util.Map; +// +///** +// * Holds LB data of a network partition. +// * +// */ +//public class NetworkPartitionLbHolder implements Serializable{ +// +// private static final long serialVersionUID = -7181166769691018046L; +// private final String networkPartitionId; +// +// private String defaultLbClusterId; +// +// private Map<String, String> serviceNameToLBClusterIdMap; +// +// private Map<String, String> clusterIdToLBClusterIdMap; +// +// public NetworkPartitionLbHolder(String networkPartitionId) { +// +// super(); +// this.networkPartitionId = networkPartitionId; +// this.setServiceToLBClusterId(new HashMap<String, String>()); +// this.setClusterIdToLBClusterIdMap(new HashMap<String, String>()); +// } +// +// public String getDefaultLbClusterId() { +// +// return this.defaultLbClusterId; +// +// } +// +// public void setDefaultLbClusterId(final String defaultLbClusterId) { +// +// this.defaultLbClusterId = defaultLbClusterId; +// +// } +// +// public String getLBClusterIdOfService(final String serviceName) { +// +// return this.serviceNameToLBClusterIdMap.get(serviceName); +// +// } +// +// public Map<String, String> getServiceToLBClusterId() { +// +// return this.serviceNameToLBClusterIdMap; +// +// } +// +// public void setServiceToLBClusterId(final Map<String, String> serviceToLBClusterId) { +// +// this.serviceNameToLBClusterIdMap = serviceToLBClusterId; +// +// } +// +// public void addServiceLB(final String serviceName, final String lbClusterId) { +// this.serviceNameToLBClusterIdMap.put(serviceName, lbClusterId); +// } +// +// public String getLBClusterIdOfCluster(final String clusterId) { +// +// return this.clusterIdToLBClusterIdMap.get(clusterId); +// +// } +// +// public Map<String, String> getClusterIdToLBClusterIdMap() { +// +// return this.clusterIdToLBClusterIdMap; +// +// } +// +// public void setClusterIdToLBClusterIdMap(final Map<String, String> clusterIdToLBClusterIdMap) { +// +// this.clusterIdToLBClusterIdMap = clusterIdToLBClusterIdMap; +// +// } +// +// public boolean removeLbClusterId(String clusterId) { +// if (isLBExist(clusterId)) { +// if(isDefaultLBExist() && defaultLbClusterId.equals(clusterId)) { +// defaultLbClusterId = null; +// return true; +// +// } else if (serviceNameToLBClusterIdMap.containsValue(clusterId)){ +// for (String service : serviceNameToLBClusterIdMap.keySet()) { +// if(clusterId.equals(serviceNameToLBClusterIdMap.get(service))) { +// serviceNameToLBClusterIdMap.remove(service); +// return true; +// } +// } +// } else if (clusterIdToLBClusterIdMap.containsValue(clusterId)){ +// for (String cluster : clusterIdToLBClusterIdMap.keySet()) { +// if(clusterId.equals(clusterIdToLBClusterIdMap.get(cluster))) { +// clusterIdToLBClusterIdMap.remove(cluster); +// return true; +// } +// } +// } +// } +// return false; +// } +// +// public boolean isLBExist(final String clusterId) { +// +// return clusterId != null && +// (clusterId.equals(this.defaultLbClusterId) || +// this.serviceNameToLBClusterIdMap.containsValue(clusterId) || this.clusterIdToLBClusterIdMap.containsValue(clusterId)); +// +// } +// +// public boolean isDefaultLBExist() { +// +// return defaultLbClusterId != null; +// +// } +// +// public boolean isServiceLBExist(String serviceName) { +// +// return this.serviceNameToLBClusterIdMap.containsKey(serviceName) && +// this.serviceNameToLBClusterIdMap.get(serviceName) != null; +// +// } +// +// public boolean isClusterLBExist(String clusterId) { +// +// return this.clusterIdToLBClusterIdMap.containsKey(clusterId) && +// this.clusterIdToLBClusterIdMap.get(clusterId) != null; +// +// } +// +// public int hashCode() { +// +// final int prime = 31; +// int result = 1; +// result = prime * result + ((this.networkPartitionId == null) ? 0 : this.networkPartitionId.hashCode()); +// return result; +// +// } +// +// public boolean equals(final Object obj) { +// +// if (this == obj) { +// return true; +// } +// if (obj == null) { +// return false; +// } +// if (!(obj instanceof NetworkPartitionLbHolder)) { +// return false; +// } +// final NetworkPartitionLbHolder other = (NetworkPartitionLbHolder) obj; +// if (this.networkPartitionId == null) { +// if (other.networkPartitionId != null) { +// return false; +// } +// } +// else if (!this.networkPartitionId.equals(other.networkPartitionId)) { +// return false; +// } +// return true; +// } +// +// @Override +// public String toString() { +// return "NetworkPartitionLbHolder [networkPartitionId=" +// + networkPartitionId + ", defaultLbClusterId=" +// + defaultLbClusterId + ", serviceNameToLBClusterIdMap=" +// + serviceNameToLBClusterIdMap + ", clusterIdToLBClusterIdMap=" +// + clusterIdToLBClusterIdMap + "]"; +// } +// +// public String getNetworkPartitionId() { +// return networkPartitionId; +// } +// +//} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/18745a09/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/api/AutoScalerServiceImpl.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/api/AutoScalerServiceImpl.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/api/AutoScalerServiceImpl.java index cd4a435..219fe08 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/api/AutoScalerServiceImpl.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/api/AutoScalerServiceImpl.java @@ -22,7 +22,7 @@ import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.stratos.autoscaler.context.AutoscalerContext; -import org.apache.stratos.autoscaler.NetworkPartitionLbHolder; +//import org.apache.stratos.autoscaler.NetworkPartitionLbHolder; import org.apache.stratos.autoscaler.applications.parser.ApplicationParser; import org.apache.stratos.autoscaler.applications.parser.DefaultApplicationParser; import org.apache.stratos.autoscaler.applications.pojo.ApplicationContext; @@ -70,10 +70,10 @@ public class AutoScalerServiceImpl implements AutoScalerServiceInterface { private static final Log log = LogFactory.getLog(AutoScalerServiceImpl.class); PartitionManager partitionManager = PartitionManager.getInstance(); KubernetesManager kubernetesManager = KubernetesManager.getInstance(); - - public Partition[] getAllAvailablePartitions() { - return partitionManager.getAllPartitions(); - } +// +// public Partition[] getAllAvailablePartitions() { +// return partitionManager.getAllPartitions(); +// } public DeploymentPolicy[] getAllDeploymentPolicies() { return PolicyManager.getInstance().getDeploymentPolicyList(); @@ -228,71 +228,71 @@ public class AutoScalerServiceImpl implements AutoScalerServiceInterface { return group.getPartitions(); } - public void checkLBExistenceAgainstPolicy(String lbClusterId, String deploymentPolicyId) throws NonExistingLBException { - - boolean exist = false; - for (NetworkPartition networkPartition : PolicyManager.getInstance().getDeploymentPolicy(deploymentPolicyId).getNetworkPartitions()) { - - NetworkPartitionLbHolder nwPartitionLbHolder = partitionManager.getNetworkPartitionLbHolder(networkPartition.getId()); - - if (nwPartitionLbHolder.isLBExist(lbClusterId)) { - exist = true; - break; - } - } - - if (!exist) { - String msg = "LB with [cluster id] " + lbClusterId + - " does not exist in any network partition of [Deployment Policy] " + deploymentPolicyId; - log.error(msg); - throw new NonExistingLBException(msg); - } - } - - public boolean checkDefaultLBExistenceAgainstPolicy(String deploymentPolicyId) { - - for (NetworkPartition networkPartition : PolicyManager.getInstance().getDeploymentPolicy(deploymentPolicyId).getNetworkPartitions()) { - - NetworkPartitionLbHolder nwPartitionLbHolder = partitionManager.getNetworkPartitionLbHolder(networkPartition.getId()); - - if (!nwPartitionLbHolder.isDefaultLBExist()) { - if (log.isDebugEnabled()) { - log.debug("Default LB does not exist in [network partition] " + - nwPartitionLbHolder.getNetworkPartitionId() + " of [Deployment Policy] " + - deploymentPolicyId); - - } - return false; - } - - } - - return true; - - } - - public String getDefaultLBClusterId(String deploymentPolicyName) { - if (log.isDebugEnabled()) { - log.debug("Default LB Cluster Id for Deployment Policy [" + deploymentPolicyName + "] "); - } - for (NetworkPartition networkPartition : PolicyManager.getInstance().getDeploymentPolicy(deploymentPolicyName).getNetworkPartitions()) { - - NetworkPartitionLbHolder nwPartitionLbHolder = partitionManager.getNetworkPartitionLbHolder(networkPartition.getId()); - - if (nwPartitionLbHolder.isDefaultLBExist()) { - if (log.isDebugEnabled()) { - log.debug("Default LB does not exist in [network partition] " + - nwPartitionLbHolder.getNetworkPartitionId() + " of [Deployment Policy] " + - deploymentPolicyName); - - } - return nwPartitionLbHolder.getDefaultLbClusterId(); - } - - } - - return null; - } +// public void checkLBExistenceAgainstPolicy(String lbClusterId, String deploymentPolicyId) throws NonExistingLBException { +// +// boolean exist = false; +// for (NetworkPartition networkPartition : PolicyManager.getInstance().getDeploymentPolicy(deploymentPolicyId).getNetworkPartitions()) { +// +// NetworkPartitionLbHolder nwPartitionLbHolder = partitionManager.getNetworkPartitionLbHolder(networkPartition.getId()); +// +// if (nwPartitionLbHolder.isLBExist(lbClusterId)) { +// exist = true; +// break; +// } +// } +// +// if (!exist) { +// String msg = "LB with [cluster id] " + lbClusterId + +// " does not exist in any network partition of [Deployment Policy] " + deploymentPolicyId; +// log.error(msg); +// throw new NonExistingLBException(msg); +// } +// } + +// public boolean checkDefaultLBExistenceAgainstPolicy(String deploymentPolicyId) { +// +// for (NetworkPartition networkPartition : PolicyManager.getInstance().getDeploymentPolicy(deploymentPolicyId).getNetworkPartitions()) { +// +// NetworkPartitionLbHolder nwPartitionLbHolder = partitionManager.getNetworkPartitionLbHolder(networkPartition.getId()); +// +// if (!nwPartitionLbHolder.isDefaultLBExist()) { +// if (log.isDebugEnabled()) { +// log.debug("Default LB does not exist in [network partition] " + +// nwPartitionLbHolder.getNetworkPartitionId() + " of [Deployment Policy] " + +// deploymentPolicyId); +// +// } +// return false; +// } +// +// } +// +// return true; +// +// } + +// public String getDefaultLBClusterId(String deploymentPolicyName) { +// if (log.isDebugEnabled()) { +// log.debug("Default LB Cluster Id for Deployment Policy [" + deploymentPolicyName + "] "); +// } +// for (NetworkPartition networkPartition : PolicyManager.getInstance().getDeploymentPolicy(deploymentPolicyName).getNetworkPartitions()) { +// +// NetworkPartitionLbHolder nwPartitionLbHolder = partitionManager.getNetworkPartitionLbHolder(networkPartition.getId()); +// +// if (nwPartitionLbHolder.isDefaultLBExist()) { +// if (log.isDebugEnabled()) { +// log.debug("Default LB does not exist in [network partition] " + +// nwPartitionLbHolder.getNetworkPartitionId() + " of [Deployment Policy] " + +// deploymentPolicyName); +// +// } +// return nwPartitionLbHolder.getDefaultLbClusterId(); +// } +// +// } +// +// return null; +// } @Override public void deployApplicationDefinition(ApplicationContext applicationContext) @@ -312,70 +312,70 @@ public class AutoScalerServiceImpl implements AutoScalerServiceInterface { ApplicationBuilder.handleApplicationUndeployed(applicationId); } - public boolean checkServiceLBExistenceAgainstPolicy(String serviceName, String deploymentPolicyId) { - - for (NetworkPartition networkPartition : PolicyManager.getInstance().getDeploymentPolicy(deploymentPolicyId).getNetworkPartitions()) { - - NetworkPartitionLbHolder nwPartitionLbHolder = partitionManager.getNetworkPartitionLbHolder(networkPartition.getId()); - - if (!nwPartitionLbHolder.isServiceLBExist(serviceName)) { - if (log.isDebugEnabled()) { - log.debug("Service LB [service name] " + serviceName + " does not exist in [network partition] " + - nwPartitionLbHolder.getNetworkPartitionId() + " of [Deployment Policy] " + - deploymentPolicyId); - - } - return false; - } - - } - - return true; - - } - - public String getServiceLBClusterId(String serviceType, String deploymentPolicyName) { - - for (NetworkPartition networkPartition : PolicyManager.getInstance().getDeploymentPolicy(deploymentPolicyName).getNetworkPartitions()) { - - NetworkPartitionLbHolder nwPartitionLbHolder = partitionManager.getNetworkPartitionLbHolder(networkPartition.getId()); - - if (nwPartitionLbHolder.isServiceLBExist(serviceType)) { - if (log.isDebugEnabled()) { - log.debug("Service LB [service name] " + serviceType + " does not exist in [network partition] " + - nwPartitionLbHolder.getNetworkPartitionId() + " of [Deployment Policy] " + - deploymentPolicyName); - - } - return nwPartitionLbHolder.getLBClusterIdOfService(serviceType); - } - - } - - return null; - } - - public boolean checkClusterLBExistenceAgainstPolicy(String clusterId, String deploymentPolicyId) { - - for (NetworkPartition networkPartition : PolicyManager.getInstance().getDeploymentPolicy(deploymentPolicyId).getNetworkPartitions()) { - - NetworkPartitionLbHolder nwPartitionLbHolder = partitionManager.getNetworkPartitionLbHolder(networkPartition.getId()); - - if (!nwPartitionLbHolder.isClusterLBExist(clusterId)) { - if (log.isDebugEnabled()) { - log.debug("Cluster LB [cluster id] " + clusterId + " does not exist in [network partition] " + - nwPartitionLbHolder.getNetworkPartitionId() + " of [Deployment Policy] " + - deploymentPolicyId); - - } - return false; - } - - } - - return true; - - } +// public boolean checkServiceLBExistenceAgainstPolicy(String serviceName, String deploymentPolicyId) { +// +// for (NetworkPartition networkPartition : PolicyManager.getInstance().getDeploymentPolicy(deploymentPolicyId).getNetworkPartitions()) { +// +// NetworkPartitionLbHolder nwPartitionLbHolder = partitionManager.getNetworkPartitionLbHolder(networkPartition.getId()); +// +// if (!nwPartitionLbHolder.isServiceLBExist(serviceName)) { +// if (log.isDebugEnabled()) { +// log.debug("Service LB [service name] " + serviceName + " does not exist in [network partition] " + +// nwPartitionLbHolder.getNetworkPartitionId() + " of [Deployment Policy] " + +// deploymentPolicyId); +// +// } +// return false; +// } +// +// } +// +// return true; +// +// } +// +// public String getServiceLBClusterId(String serviceType, String deploymentPolicyName) { +// +// for (NetworkPartition networkPartition : PolicyManager.getInstance().getDeploymentPolicy(deploymentPolicyName).getNetworkPartitions()) { +// +// NetworkPartitionLbHolder nwPartitionLbHolder = partitionManager.getNetworkPartitionLbHolder(networkPartition.getId()); +// +// if (nwPartitionLbHolder.isServiceLBExist(serviceType)) { +// if (log.isDebugEnabled()) { +// log.debug("Service LB [service name] " + serviceType + " does not exist in [network partition] " + +// nwPartitionLbHolder.getNetworkPartitionId() + " of [Deployment Policy] " + +// deploymentPolicyName); +// +// } +// return nwPartitionLbHolder.getLBClusterIdOfService(serviceType); +// } +// +// } +// +// return null; +// } + +// public boolean checkClusterLBExistenceAgainstPolicy(String clusterId, String deploymentPolicyId) { +// +// for (NetworkPartition networkPartition : PolicyManager.getInstance().getDeploymentPolicy(deploymentPolicyId).getNetworkPartitions()) { +// +// NetworkPartitionLbHolder nwPartitionLbHolder = partitionManager.getNetworkPartitionLbHolder(networkPartition.getId()); +// +// if (!nwPartitionLbHolder.isClusterLBExist(clusterId)) { +// if (log.isDebugEnabled()) { +// log.debug("Cluster LB [cluster id] " + clusterId + " does not exist in [network partition] " + +// nwPartitionLbHolder.getNetworkPartitionId() + " of [Deployment Policy] " + +// deploymentPolicyId); +// +// } +// return false; +// } +// +// } +// +// return true; +// +// } public void updateClusterMonitor(String clusterId, Properties properties) throws InvalidArgumentException { if (log.isDebugEnabled()) { http://git-wip-us.apache.org/repos/asf/stratos/blob/18745a09/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/CloudControllerClient.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/CloudControllerClient.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/CloudControllerClient.java index 03a32d0..ee68c64 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/CloudControllerClient.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/CloudControllerClient.java @@ -138,11 +138,13 @@ public class CloudControllerClient { } public synchronized MemberContext spawnAnInstance(Partition partition, - String clusterId, String lbClusterId, String networkPartitionId, boolean isPrimary, int minMemberCount) throws SpawningException { + String clusterId, + String networkPartitionId, boolean isPrimary, + int minMemberCount) throws SpawningException { try { if (log.isInfoEnabled()) { log.info(String.format("Trying to spawn an instance via cloud controller: [cluster] %s [partition] %s [lb-cluster] %s [network-partition-id] %s", - clusterId, partition.getId(), lbClusterId, networkPartitionId)); + clusterId, partition.getId(), networkPartitionId)); } XMLConfiguration conf = ConfUtil.getInstance(null).getConfiguration(); @@ -154,7 +156,7 @@ public class CloudControllerClient { MemberContext member = new MemberContext(); member.setClusterId(clusterId); member.setPartition(partition); - member.setLbClusterId(lbClusterId); +// member.setLbClusterId(lbClusterId); member.setObsoleteExpiryTime(expiryTime); member.setInitTime(System.currentTimeMillis()); member.setNetworkPartitionId(networkPartitionId); http://git-wip-us.apache.org/repos/asf/stratos/blob/18745a09/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContextFactory.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContextFactory.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContextFactory.java index 67cf413..a4c5e28 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContextFactory.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContextFactory.java @@ -29,7 +29,7 @@ import org.apache.stratos.autoscaler.context.partition.ClusterLevelPartitionCont import org.apache.stratos.autoscaler.exception.partition.PartitionValidationException; import org.apache.stratos.autoscaler.exception.policy.PolicyValidationException; import org.apache.stratos.autoscaler.partition.NetworkPartition; -import org.apache.stratos.autoscaler.partition.PartitionManager; +//import org.apache.stratos.autoscaler.partition.PartitionManager; import org.apache.stratos.autoscaler.policy.PolicyManager; import org.apache.stratos.autoscaler.policy.model.AutoscalePolicy; import org.apache.stratos.autoscaler.policy.model.DeploymentPolicy; @@ -196,9 +196,9 @@ public class ClusterContextFactory { for (NetworkPartition networkPartition : deploymentPolicy.getNetworkPartitions()) { String networkPartitionId = networkPartition.getId(); - NetworkPartitionLbHolder networkPartitionLbHolder = - PartitionManager.getInstance() - .getNetworkPartitionLbHolder(networkPartitionId); +// NetworkPartitionLbHolder networkPartitionLbHolder = +// PartitionManager.getInstance() +// .getNetworkPartitionLbHolder(networkPartitionId); // PartitionManager.getInstance() // .getNetworkPartitionLbHolder(partitionGroup.getPartitionId()); // FIXME pick a random partition @@ -251,31 +251,59 @@ public class ClusterContextFactory { } clusterLevelNetworkPartitionContext.addPartitionContext(clusterMonitorPartitionContext); - // populate lb cluster id in network partition context. - java.util.Properties props = cluster.getProperties(); - // get service type of load balanced cluster - String loadBalancedServiceType = props.getProperty(StratosConstants.LOAD_BALANCED_SERVICE_TYPE); +// // populate lb cluster id in network partition context. +// java.util.Properties props = cluster.getProperties(); +// +// // get service type of load balanced cluster +// String loadBalancedServiceType = props.getProperty(StratosConstants.LOAD_BALANCED_SERVICE_TYPE); +// +// if (props.containsKey(StratosConstants.LOAD_BALANCER_REF)) { +// String value = props.getProperty(StratosConstants.LOAD_BALANCER_REF); +// +// if (value.equals(StratosConstants.DEFAULT_LOAD_BALANCER)) { +// networkPartitionLbHolder.setDefaultLbClusterId(clusterId); +// +// } else if (value.equals(StratosConstants.SERVICE_AWARE_LOAD_BALANCER)) { +// String serviceName = cluster.getServiceName(); +// // TODO: check if this is correct +// networkPartitionLbHolder.addServiceLB(serviceName, clusterId); +// +// if (loadBalancedServiceType != null && !loadBalancedServiceType.isEmpty()) { +// networkPartitionLbHolder.addServiceLB(loadBalancedServiceType, clusterId); +// if (log.isDebugEnabled()) { +// log.debug("Added cluster id " + clusterId + " as the LB cluster id for service type " + loadBalancedServiceType); +// } +// } +// } +// } + +// // populate lb cluster id in network partition context. +// java.util.Properties props = cluster.getProperties(); +// +// // get service type of load balanced cluster +// String loadBalancedServiceType = props.getProperty(org.apache.stratos.messaging.util.Constants.LOAD_BALANCED_SERVICE_TYPE); +// +// if (props.containsKey(org.apache.stratos.messaging.util.Constants.LOAD_BALANCER_REF)) { +// String value = props.getProperty(org.apache.stratos.messaging.util.Constants.LOAD_BALANCER_REF); +// +// if (value.equals(org.apache.stratos.messaging.util.Constants.DEFAULT_LOAD_BALANCER)) { +// networkPartitionLbHolder.setDefaultLbClusterId(clusterId); +// +// } else if (value.equals(org.apache.stratos.messaging.util.Constants.SERVICE_AWARE_LOAD_BALANCER)) { +// String serviceName = cluster.getServiceName(); +// // TODO: check if this is correct +// networkPartitionLbHolder.addServiceLB(serviceName, clusterId); +// +// if (loadBalancedServiceType != null && !loadBalancedServiceType.isEmpty()) { +// networkPartitionLbHolder.addServiceLB(loadBalancedServiceType, clusterId); +// if (log.isDebugEnabled()) { +// log.debug("Added cluster id " + clusterId + " as the LB cluster id for service type " + loadBalancedServiceType); +// } +// } +// } +// } - if (props.containsKey(StratosConstants.LOAD_BALANCER_REF)) { - String value = props.getProperty(StratosConstants.LOAD_BALANCER_REF); - - if (value.equals(StratosConstants.DEFAULT_LOAD_BALANCER)) { - networkPartitionLbHolder.setDefaultLbClusterId(clusterId); - - } else if (value.equals(StratosConstants.SERVICE_AWARE_LOAD_BALANCER)) { - String serviceName = cluster.getServiceName(); - // TODO: check if this is correct - networkPartitionLbHolder.addServiceLB(serviceName, clusterId); - - if (loadBalancedServiceType != null && !loadBalancedServiceType.isEmpty()) { - networkPartitionLbHolder.addServiceLB(loadBalancedServiceType, clusterId); - if (log.isDebugEnabled()) { - log.debug("Added cluster id " + clusterId + " as the LB cluster id for service type " + loadBalancedServiceType); - } - } - } - } networkPartitionContextMap.put(networkPartitionId, clusterLevelNetworkPartitionContext); } @@ -365,13 +393,15 @@ public class ClusterContextFactory { } // find lb reference type - if (properties.containsKey(StratosConstants.LOAD_BALANCER_REF)) { - String value = properties.getProperty(StratosConstants.LOAD_BALANCER_REF); - //dockerClusterMonitor.setLbReferenceType(value); - if (log.isDebugEnabled()) { - log.debug("Set the lb reference type: " + value); - } - } + +// if (properties.containsKey(org.apache.stratos.messaging.util.Constants.LOAD_BALANCER_REF)) { +// String value = properties.getProperty(Constants.LOAD_BALANCER_REF); +// //dockerClusterMonitor.setLbReferenceType(value); +// if (log.isDebugEnabled()) { +// log.debug("Set the lb reference type: " + value); +// } +// } + return kubernetesClusterCtxt; } http://git-wip-us.apache.org/repos/asf/stratos/blob/18745a09/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/interfaces/AutoScalerServiceInterface.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/interfaces/AutoScalerServiceInterface.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/interfaces/AutoScalerServiceInterface.java index 88b9e29..749d6d0 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/interfaces/AutoScalerServiceInterface.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/interfaces/AutoScalerServiceInterface.java @@ -40,7 +40,7 @@ import org.apache.stratos.common.kubernetes.KubernetesMaster; public interface AutoScalerServiceInterface { - public Partition[] getAllAvailablePartitions(); +// public Partition[] getAllAvailablePartitions(); public boolean addPartition(Partition partition) throws InvalidPartitionException; @@ -148,47 +148,47 @@ public interface AutoScalerServiceInterface { public boolean updateKubernetesMaster(KubernetesMaster kubernetesMaster) throws InvalidKubernetesMasterException, NonExistingKubernetesMasterException; - /** - * Check existence of a lb cluster in network partitions of a given policy. - * - * @param lbClusterId - * @param deploymentPolicyId - * @throws NonExistingLBException if the lb cluster id cannot be found in any of the network partitions. - */ - public void checkLBExistenceAgainstPolicy(String lbClusterId, String deploymentPolicyId) throws NonExistingLBException; - - /** - * Check the existence of default lb in network partitions of a given policy. - * - * @param deploymentPolicyId - * @return true if the LB exists in all the network partitions of this policy, - * false if a LB couldn't find even in one network partition. - */ - public boolean checkDefaultLBExistenceAgainstPolicy(String deploymentPolicyId); - - /** - * Check the existence of per cluster lb in network partitions of a given policy. - * - * @param clusterId cluster id of the service cluster which requires a dedicated LB. - * @param deploymentPolicyId - * @return true if the cluster based LB exists in all the network partitions of this policy, - * false if a LB couldn't find even in one network partition. - */ - public boolean checkClusterLBExistenceAgainstPolicy(String clusterId, String deploymentPolicyId); - - /** - * Check the existence of per service lb in network partitions of a given policy. - * - * @param serviceName service name of the service cluster which requires a dedicated LB. - * @param deploymentPolicyId - * @return true if the service based LB exists in all the network partitions of this policy, - * false if a LB couldn't find even in one network partition. - */ - public boolean checkServiceLBExistenceAgainstPolicy(String serviceName, String deploymentPolicyId); - - public String getDefaultLBClusterId(String deploymentPolicyName); - - public String getServiceLBClusterId (String serviceType, String deploymentPolicyName); +// /** +// * Check existence of a lb cluster in network partitions of a given policy. +// * +// * @param lbClusterId +// * @param deploymentPolicyId +// * @throws NonExistingLBException if the lb cluster id cannot be found in any of the network partitions. +// */ +// public void checkLBExistenceAgainstPolicy(String lbClusterId, String deploymentPolicyId) throws NonExistingLBException; +// +// /** +// * Check the existence of default lb in network partitions of a given policy. +// * +// * @param deploymentPolicyId +// * @return true if the LB exists in all the network partitions of this policy, +// * false if a LB couldn't find even in one network partition. +// */ +// public boolean checkDefaultLBExistenceAgainstPolicy(String deploymentPolicyId); +// +// /** +// * Check the existence of per cluster lb in network partitions of a given policy. +// * +// * @param clusterId cluster id of the service cluster which requires a dedicated LB. +// * @param deploymentPolicyId +// * @return true if the cluster based LB exists in all the network partitions of this policy, +// * false if a LB couldn't find even in one network partition. +// */ +// public boolean checkClusterLBExistenceAgainstPolicy(String clusterId, String deploymentPolicyId); +// +// /** +// * Check the existence of per service lb in network partitions of a given policy. +// * +// * @param serviceName service name of the service cluster which requires a dedicated LB. +// * @param deploymentPolicyId +// * @return true if the service based LB exists in all the network partitions of this policy, +// * false if a LB couldn't find even in one network partition. +// */ +// public boolean checkServiceLBExistenceAgainstPolicy(String serviceName, String deploymentPolicyId); +// +// public String getDefaultLBClusterId(String deploymentPolicyName); +// +// public String getServiceLBClusterId (String serviceType, String deploymentPolicyName); /** * Dynamically update the properties of an Autoscaling Cluster Monitor http://git-wip-us.apache.org/repos/asf/stratos/blob/18745a09/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/internal/AutoscalerServerComponent.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/internal/AutoscalerServerComponent.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/internal/AutoscalerServerComponent.java index f37efdc..030d945 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/internal/AutoscalerServerComponent.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/internal/AutoscalerServerComponent.java @@ -20,7 +20,7 @@ package org.apache.stratos.autoscaler.internal; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.stratos.autoscaler.NetworkPartitionLbHolder; +//import org.apache.stratos.autoscaler.NetworkPartitionLbHolder; import org.apache.stratos.autoscaler.applications.ApplicationSynchronizerTaskScheduler; import org.apache.stratos.autoscaler.policy.model.DeploymentPolicy; import org.apache.stratos.autoscaler.exception.AutoScalerException; @@ -91,12 +91,12 @@ public class AutoscalerServerComponent { } // Adding the network partitions stored in registry to the information model - List<NetworkPartitionLbHolder> nwPartitionHolders = RegistryManager.getInstance().retrieveNetworkPartitionLbHolders(); - Iterator<NetworkPartitionLbHolder> nwPartitionIterator = nwPartitionHolders.iterator(); - while (nwPartitionIterator.hasNext()) { - NetworkPartitionLbHolder nwPartition = nwPartitionIterator.next(); - PartitionManager.getInstance().addNetworkPartitionLbHolder(nwPartition); - } +// List<NetworkPartitionLbHolder> nwPartitionHolders = RegistryManager.getInstance().retrieveNetworkPartitionLbHolders(); +// Iterator<NetworkPartitionLbHolder> nwPartitionIterator = nwPartitionHolders.iterator(); +// while (nwPartitionIterator.hasNext()) { +// NetworkPartitionLbHolder nwPartition = nwPartitionIterator.next(); +// PartitionManager.getInstance().addNetworkPartitionLbHolder(nwPartition); +// } List<AutoscalePolicy> asPolicies = RegistryManager.getInstance().retrieveASPolicies(); Iterator<AutoscalePolicy> asPolicyIterator = asPolicies.iterator(); http://git-wip-us.apache.org/repos/asf/stratos/blob/18745a09/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitorFactory.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitorFactory.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitorFactory.java index 2d1cd7d..204b8b0 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitorFactory.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitorFactory.java @@ -49,8 +49,8 @@ public class ClusterMonitorFactory { AbstractClusterMonitor clusterMonitor; if (cluster.isKubernetesCluster()) { clusterMonitor = getDockerServiceClusterMonitor(cluster); - } else if (cluster.isLbCluster()) { - clusterMonitor = getVMLbClusterMonitor(cluster); +// } else if (cluster.isLbCluster()) { +// clusterMonitor = getVMLbClusterMonitor(cluster); } else { clusterMonitor = getVMServiceClusterMonitor(cluster); } @@ -88,21 +88,21 @@ public class ClusterMonitorFactory { log.info("VMServiceClusterMonitor created: " + clusterMonitor.toString()); return clusterMonitor; } - - private static VMLbClusterMonitor getVMLbClusterMonitor(Cluster cluster) - throws PolicyValidationException, PartitionValidationException { - - if (null == cluster) { - return null; - } - - VMLbClusterMonitor clusterMonitor = - new VMLbClusterMonitor(cluster.getServiceName(), cluster.getClusterId()); - clusterMonitor.setStatus(ClusterStatus.Created); - - log.info("VMLbClusterMonitor created: " + clusterMonitor.toString()); - return clusterMonitor; - } +// +// private static VMLbClusterMonitor getVMLbClusterMonitor(Cluster cluster) +// throws PolicyValidationException, PartitionValidationException { +// +// if (null == cluster) { +// return null; +// } +// +// VMLbClusterMonitor clusterMonitor = +// new VMLbClusterMonitor(cluster.getServiceName(), cluster.getClusterId()); +// clusterMonitor.setStatus(ClusterStatus.Created); +// +// log.info("VMLbClusterMonitor created: " + clusterMonitor.toString()); +// return clusterMonitor; +// } /** * @param cluster - the cluster which needs to be monitored http://git-wip-us.apache.org/repos/asf/stratos/blob/18745a09/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/VMLbClusterMonitor.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/VMLbClusterMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/VMLbClusterMonitor.java index 9d1805f..fe639ed 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/VMLbClusterMonitor.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/VMLbClusterMonitor.java @@ -1,194 +1,194 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.stratos.autoscaler.monitor.cluster; - -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.commons.configuration.XMLConfiguration; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.stratos.autoscaler.*; -import org.apache.stratos.autoscaler.context.cluster.AbstractClusterContext; -import org.apache.stratos.autoscaler.context.partition.network.ClusterLevelNetworkPartitionContext; -import org.apache.stratos.autoscaler.context.partition.ClusterLevelPartitionContext; -import org.apache.stratos.autoscaler.monitor.events.MonitorScalingEvent; -import org.apache.stratos.autoscaler.partition.PartitionManager; -import org.apache.stratos.autoscaler.policy.PolicyManager; -import org.apache.stratos.autoscaler.policy.model.DeploymentPolicy; -import org.apache.stratos.autoscaler.rule.AutoscalerRuleEvaluator; -import org.apache.stratos.autoscaler.util.AutoScalerConstants; -import org.apache.stratos.autoscaler.util.ConfUtil; -import org.apache.stratos.common.constants.StratosConstants; -import org.apache.stratos.messaging.event.topology.ClusterRemovedEvent; - -/** - * Is responsible for monitoring a service cluster. This runs periodically - * and perform minimum instance check and scaling check using the underlying - * rules engine. - */ -public class VMLbClusterMonitor extends VMClusterMonitor { - - private static final Log log = LogFactory.getLog(VMLbClusterMonitor.class); - - public VMLbClusterMonitor(String serviceType, String clusterId) { - super(serviceType, clusterId, new AutoscalerRuleEvaluator( StratosConstants.VM_MIN_CHECK_DROOL_FILE, - StratosConstants.VM_OBSOLETE_CHECK_DROOL_FILE, StratosConstants.VM_SCALE_CHECK_DROOL_FILE)); - readConfigurations(); - } - - @Override - public void run() { - - while (!isDestroyed()) { - if (log.isDebugEnabled()) { - log.debug("Cluster monitor is running.. " + this.toString()); - } - try { - //TODO ******** if (!ClusterStatus.Inactive.equals(getStatus())) { - monitor(); - /*} else { - if (log.isDebugEnabled()) { - log.debug("LB Cluster monitor is suspended as the cluster is in " + - ClusterStatus.Inactive + " mode......"); - } - }*/ - } catch (Exception e) { - log.error("Cluster monitor: Monitor failed. " + this.toString(), e); - } - try { - Thread.sleep(getMonitorIntervalMilliseconds()); - } catch (InterruptedException ignore) { - } - } - } - - @Override - protected void monitor() { - - Set<Map.Entry<String, AbstractClusterContext>> instanceIdToClusterCtxtEntries = instanceIdToClusterContextMap.entrySet(); - for (final Map.Entry<String, AbstractClusterContext> instanceIdToClusterCtxtEntry : instanceIdToClusterCtxtEntries) { - Runnable monitoringRunnable = new Runnable() { - - @Override - public void run() { - for (ClusterLevelNetworkPartitionContext networkPartitionContext : getNetworkPartitionCtxts(instanceIdToClusterCtxtEntry.getKey()).values()) { - - // minimum check per partition - for (ClusterLevelPartitionContext partitionContext : networkPartitionContext.getPartitionCtxts() - .values()) { - - if (partitionContext != null) { - getMinCheckKnowledgeSession().setGlobal("clusterId", getClusterId()); - getMinCheckKnowledgeSession().setGlobal("isPrimary", false); - - if (log.isDebugEnabled()) { - log.debug(String.format("Running minimum check for partition %s ", - partitionContext.getPartitionId())); - } - - minCheckFactHandle = - AutoscalerRuleEvaluator.evaluateMinCheck(getMinCheckKnowledgeSession(), - minCheckFactHandle, - partitionContext); - obsoleteCheckFactHandle = - AutoscalerRuleEvaluator.evaluateObsoleteCheck(getObsoleteCheckKnowledgeSession(), - obsoleteCheckFactHandle, partitionContext); - // start only in the first partition context - break; - } - - } - - } - } - }; - - monitoringRunnable.run(); - } - } - - @Override - public void destroy() { - getMinCheckKnowledgeSession().dispose(); - getObsoleteCheckKnowledgeSession().dispose(); - getMinCheckKnowledgeSession().dispose(); - setDestroyed(true); - stopScheduler(); - if (log.isDebugEnabled()) { - log.debug("VMLbClusterMonitor Drools session has been disposed. " + this.toString()); - } - } - - @Override - protected void readConfigurations() { - XMLConfiguration conf = ConfUtil.getInstance(null).getConfiguration(); - int monitorInterval = conf.getInt(AutoScalerConstants.VMLb_Cluster_MONITOR_INTERVAL, 90000); - setMonitorIntervalMilliseconds(monitorInterval); - if (log.isDebugEnabled()) { - log.debug("VMLbClusterMonitor task interval set to : " + getMonitorIntervalMilliseconds()); - } - } - - @Override - public void handleClusterRemovedEvent( - ClusterRemovedEvent clusterRemovedEvent) { - - String deploymentPolicy = clusterRemovedEvent.getDeploymentPolicy(); - String clusterId = clusterRemovedEvent.getClusterId(); - DeploymentPolicy depPolicy = PolicyManager.getInstance().getDeploymentPolicy(deploymentPolicy); - if (depPolicy != null) { - List<NetworkPartitionLbHolder> lbHolders = PartitionManager.getInstance() - .getNetworkPartitionLbHolders(depPolicy); - - for (NetworkPartitionLbHolder networkPartitionLbHolder : lbHolders) { - // removes lb cluster ids - boolean isRemoved = networkPartitionLbHolder.removeLbClusterId(clusterId); - if (isRemoved) { - log.info("Removed the lb cluster [id]:" - + clusterId - + " reference from Network Partition [id]: " - + networkPartitionLbHolder - .getNetworkPartitionId()); - - } - if (log.isDebugEnabled()) { - log.debug(networkPartitionLbHolder); - } - - } - } - } - - @Override - public String toString() { - return "VMLbClusterMonitor [clusterId=" + getClusterId() + "]"; - } - - @Override - public void onChildScalingEvent(MonitorScalingEvent scalingEvent) { - - } - - @Override - public void onParentScalingEvent(MonitorScalingEvent scalingEvent) { - - } -} +///* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +//package org.apache.stratos.autoscaler.monitor.cluster; +// +//import java.util.List; +//import java.util.Map; +//import java.util.Set; +// +//import org.apache.commons.configuration.XMLConfiguration; +//import org.apache.commons.logging.Log; +//import org.apache.commons.logging.LogFactory; +//import org.apache.stratos.autoscaler.*; +//import org.apache.stratos.autoscaler.context.cluster.AbstractClusterContext; +//import org.apache.stratos.autoscaler.context.partition.network.ClusterLevelNetworkPartitionContext; +//import org.apache.stratos.autoscaler.context.partition.ClusterLevelPartitionContext; +//import org.apache.stratos.autoscaler.monitor.events.MonitorScalingEvent; +//import org.apache.stratos.autoscaler.partition.PartitionManager; +//import org.apache.stratos.autoscaler.policy.PolicyManager; +//import org.apache.stratos.autoscaler.policy.model.DeploymentPolicy; +//import org.apache.stratos.autoscaler.rule.AutoscalerRuleEvaluator; +//import org.apache.stratos.autoscaler.util.AutoScalerConstants; +//import org.apache.stratos.autoscaler.util.ConfUtil; +//import org.apache.stratos.common.constants.StratosConstants; +//import org.apache.stratos.messaging.event.topology.ClusterRemovedEvent; +// +///** +// * Is responsible for monitoring a service cluster. This runs periodically +// * and perform minimum instance check and scaling check using the underlying +// * rules engine. +// */ +//public class VMLbClusterMonitor extends VMClusterMonitor { +// +// private static final Log log = LogFactory.getLog(VMLbClusterMonitor.class); +// +// public VMLbClusterMonitor(String serviceType, String clusterId) { +// super(serviceType, clusterId, new AutoscalerRuleEvaluator( StratosConstants.VM_MIN_CHECK_DROOL_FILE, +// StratosConstants.VM_OBSOLETE_CHECK_DROOL_FILE, StratosConstants.VM_SCALE_CHECK_DROOL_FILE)); +// readConfigurations(); +// } +// +// @Override +// public void run() { +// +// while (!isDestroyed()) { +// if (log.isDebugEnabled()) { +// log.debug("Cluster monitor is running.. " + this.toString()); +// } +// try { +// //TODO ******** if (!ClusterStatus.Inactive.equals(getStatus())) { +// monitor(); +// /*} else { +// if (log.isDebugEnabled()) { +// log.debug("LB Cluster monitor is suspended as the cluster is in " + +// ClusterStatus.Inactive + " mode......"); +// } +// }*/ +// } catch (Exception e) { +// log.error("Cluster monitor: Monitor failed. " + this.toString(), e); +// } +// try { +// Thread.sleep(getMonitorIntervalMilliseconds()); +// } catch (InterruptedException ignore) { +// } +// } +// } +// +// @Override +// protected void monitor() { +// +// Set<Map.Entry<String, AbstractClusterContext>> instanceIdToClusterCtxtEntries = instanceIdToClusterContextMap.entrySet(); +// for (final Map.Entry<String, AbstractClusterContext> instanceIdToClusterCtxtEntry : instanceIdToClusterCtxtEntries) { +// Runnable monitoringRunnable = new Runnable() { +// +// @Override +// public void run() { +// for (ClusterLevelNetworkPartitionContext networkPartitionContext : getNetworkPartitionCtxts(instanceIdToClusterCtxtEntry.getKey()).values()) { +// +// // minimum check per partition +// for (ClusterLevelPartitionContext partitionContext : networkPartitionContext.getPartitionCtxts() +// .values()) { +// +// if (partitionContext != null) { +// getMinCheckKnowledgeSession().setGlobal("clusterId", getClusterId()); +// getMinCheckKnowledgeSession().setGlobal("isPrimary", false); +// +// if (log.isDebugEnabled()) { +// log.debug(String.format("Running minimum check for partition %s ", +// partitionContext.getPartitionId())); +// } +// +// minCheckFactHandle = +// AutoscalerRuleEvaluator.evaluateMinCheck(getMinCheckKnowledgeSession(), +// minCheckFactHandle, +// partitionContext); +// obsoleteCheckFactHandle = +// AutoscalerRuleEvaluator.evaluateObsoleteCheck(getObsoleteCheckKnowledgeSession(), +// obsoleteCheckFactHandle, partitionContext); +// // start only in the first partition context +// break; +// } +// +// } +// +// } +// } +// }; +// +// monitoringRunnable.run(); +// } +// } +// +// @Override +// public void destroy() { +// getMinCheckKnowledgeSession().dispose(); +// getObsoleteCheckKnowledgeSession().dispose(); +// getMinCheckKnowledgeSession().dispose(); +// setDestroyed(true); +// stopScheduler(); +// if (log.isDebugEnabled()) { +// log.debug("VMLbClusterMonitor Drools session has been disposed. " + this.toString()); +// } +// } +// +// @Override +// protected void readConfigurations() { +// XMLConfiguration conf = ConfUtil.getInstance(null).getConfiguration(); +// int monitorInterval = conf.getInt(AutoScalerConstants.VMLb_Cluster_MONITOR_INTERVAL, 90000); +// setMonitorIntervalMilliseconds(monitorInterval); +// if (log.isDebugEnabled()) { +// log.debug("VMLbClusterMonitor task interval set to : " + getMonitorIntervalMilliseconds()); +// } +// } +// +// @Override +// public void handleClusterRemovedEvent( +// ClusterRemovedEvent clusterRemovedEvent) { +// +// String deploymentPolicy = clusterRemovedEvent.getDeploymentPolicy(); +// String clusterId = clusterRemovedEvent.getClusterId(); +// DeploymentPolicy depPolicy = PolicyManager.getInstance().getDeploymentPolicy(deploymentPolicy); +// if (depPolicy != null) { +// List<NetworkPartitionLbHolder> lbHolders = PartitionManager.getInstance() +// .getNetworkPartitionLbHolders(depPolicy); +// +// for (NetworkPartitionLbHolder networkPartitionLbHolder : lbHolders) { +// // removes lb cluster ids +// boolean isRemoved = networkPartitionLbHolder.removeLbClusterId(clusterId); +// if (isRemoved) { +// log.info("Removed the lb cluster [id]:" +// + clusterId +// + " reference from Network Partition [id]: " +// + networkPartitionLbHolder +// .getNetworkPartitionId()); +// +// } +// if (log.isDebugEnabled()) { +// log.debug(networkPartitionLbHolder); +// } +// +// } +// } +// } +// +// @Override +// public String toString() { +// return "VMLbClusterMonitor [clusterId=" + getClusterId() + "]"; +// } +// +// @Override +// public void onChildScalingEvent(MonitorScalingEvent scalingEvent) { +// +// } +// +// @Override +// public void onParentScalingEvent(MonitorScalingEvent scalingEvent) { +// +// } +//} http://git-wip-us.apache.org/repos/asf/stratos/blob/18745a09/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/partition/PartitionManager.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/partition/PartitionManager.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/partition/PartitionManager.java index 13d85e2..c5cf18d 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/partition/PartitionManager.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/partition/PartitionManager.java @@ -22,7 +22,7 @@ package org.apache.stratos.autoscaler.partition; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.stratos.autoscaler.NetworkPartitionLbHolder; +//import org.apache.stratos.autoscaler.NetworkPartitionLbHolder; import org.apache.stratos.autoscaler.client.CloudControllerClient; import org.apache.stratos.autoscaler.policy.model.DeploymentPolicy; import org.apache.stratos.autoscaler.exception.AutoScalerException; @@ -50,7 +50,7 @@ public class PartitionManager { * Key - network partition id * Value - reference to NetworkPartition */ - private Map<String, NetworkPartitionLbHolder> networkPartitionLbHolders; +// private Map<String, NetworkPartitionLbHolder> networkPartitionLbHolders; private static class Holder { static final PartitionManager INSTANCE = new PartitionManager(); @@ -61,7 +61,7 @@ public class PartitionManager { } private PartitionManager() { - networkPartitionLbHolders = new HashMap<String, NetworkPartitionLbHolder>(); +// networkPartitionLbHolders = new HashMap<String, NetworkPartitionLbHolder>(); } @@ -100,9 +100,9 @@ public class PartitionManager { partitions.put(partition.getId(), partition); } - public NetworkPartitionLbHolder getNetworkPartitionLbHolder(String networkPartitionId) { - return this.networkPartitionLbHolders.get(networkPartitionId); - } +// public NetworkPartitionLbHolder getNetworkPartitionLbHolder(String networkPartitionId) { +// return this.networkPartitionLbHolders.get(networkPartitionId); +// } public Partition getPartitionById(String partitionId) { if (partitionExist(partitionId)) @@ -123,55 +123,55 @@ public class PartitionManager { return CloudControllerClient.getInstance().validatePartition(partition); } - public List<NetworkPartitionLbHolder> getNetworkPartitionLbHolders(DeploymentPolicy depPolicy) { - List<NetworkPartitionLbHolder> lbHolders = new ArrayList<NetworkPartitionLbHolder>(); - for (NetworkPartition networkPartition : depPolicy.getNetworkPartitions()) { - String id = networkPartition.getId(); - NetworkPartitionLbHolder entry = networkPartitionLbHolders.get(id); - if (entry != null) { - lbHolders.add(entry); - } - } - return lbHolders; - } - - public void deployNewNetworkPartitions(DeploymentPolicy depPolicy) { - for (NetworkPartition networkPartition : depPolicy.getNetworkPartitions()) { - String id = networkPartition.getId(); - if (!networkPartitionLbHolders.containsKey(id)) { - NetworkPartitionLbHolder networkPartitionLbHolder = - new NetworkPartitionLbHolder(id); - addNetworkPartitionLbHolder(networkPartitionLbHolder); - RegistryManager.getInstance().persistNetworkPartitionIbHolder(networkPartitionLbHolder); - } - - } - } - - public void undeployNetworkPartitions(DeploymentPolicy depPolicy) { - for (NetworkPartition networkPartition : depPolicy.getNetworkPartitions()) { - String id = networkPartition.getId(); - if (networkPartitionLbHolders.containsKey(id)) { - NetworkPartitionLbHolder netPartCtx = this.getNetworkPartitionLbHolder(id); - // remove from information model - this.removeNetworkPartitionLbHolder(netPartCtx); - //remove from the registry - RegistryManager.getInstance().removeNetworkPartition(this.getNetworkPartitionLbHolder(id).getNetworkPartitionId()); - } else { - String errMsg = "Network partition context not found for policy " + depPolicy; - log.error(errMsg); - throw new AutoScalerException(errMsg); - } - - } - } - - private void removeNetworkPartitionLbHolder(NetworkPartitionLbHolder nwPartLbHolder) { - networkPartitionLbHolders.remove(nwPartLbHolder.getNetworkPartitionId()); - } - - public void addNetworkPartitionLbHolder(NetworkPartitionLbHolder nwPartLbHolder) { - networkPartitionLbHolders.put(nwPartLbHolder.getNetworkPartitionId(), nwPartLbHolder); - } +// public List<NetworkPartitionLbHolder> getNetworkPartitionLbHolders(DeploymentPolicy depPolicy) { +// List<NetworkPartitionLbHolder> lbHolders = new ArrayList<NetworkPartitionLbHolder>(); +// for (NetworkPartition networkPartition : depPolicy.getNetworkPartitions()) { +// String id = networkPartition.getId(); +// NetworkPartitionLbHolder entry = networkPartitionLbHolders.get(id); +// if (entry != null) { +// lbHolders.add(entry); +// } +// } +// return lbHolders; +// } + +// public void deployNewNetworkPartitions(DeploymentPolicy depPolicy) { +// for (NetworkPartition networkPartition : depPolicy.getNetworkPartitions()) { +// String id = networkPartition.getId(); +// if (!networkPartitionLbHolders.containsKey(id)) { +// NetworkPartitionLbHolder networkPartitionLbHolder = +// new NetworkPartitionLbHolder(id); +// addNetworkPartitionLbHolder(networkPartitionLbHolder); +// RegistryManager.getInstance().persistNetworkPartitionIbHolder(networkPartitionLbHolder); +// } + +// } +// } + +// public void undeployNetworkPartitions(DeploymentPolicy depPolicy) { +// for (NetworkPartition networkPartition : depPolicy.getNetworkPartitions()) { +// String id = networkPartition.getId(); +// if (networkPartitionLbHolders.containsKey(id)) { +// NetworkPartitionLbHolder netPartCtx = this.getNetworkPartitionLbHolder(id); +// // remove from information model +// this.removeNetworkPartitionLbHolder(netPartCtx); +// //remove from the registry +// RegistryManager.getInstance().removeNetworkPartition(this.getNetworkPartitionLbHolder(id).getNetworkPartitionId()); +// } else { +// String errMsg = "Network partition context not found for policy " + depPolicy; +// log.error(errMsg); +// throw new AutoScalerException(errMsg); +// } +// +// } +// } +// +// private void removeNetworkPartitionLbHolder(NetworkPartitionLbHolder nwPartLbHolder) { +// networkPartitionLbHolders.remove(nwPartLbHolder.getNetworkPartitionId()); +// } +// +// public void addNetworkPartitionLbHolder(NetworkPartitionLbHolder nwPartLbHolder) { +// networkPartitionLbHolders.put(nwPartLbHolder.getNetworkPartitionId(), nwPartLbHolder); +// } } http://git-wip-us.apache.org/repos/asf/stratos/blob/18745a09/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/PolicyManager.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/PolicyManager.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/PolicyManager.java index 783c02e..4795617 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/PolicyManager.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/PolicyManager.java @@ -227,7 +227,7 @@ public class PolicyManager { if (log.isDebugEnabled()) { log.debug("Adding deployment policy: " + policy.getId()); } - PartitionManager.getInstance().deployNewNetworkPartitions(policy); +// PartitionManager.getInstance().deployNewNetworkPartitions(policy); deploymentPolicyListMap.put(policy.getId(), policy); } else { String errMsg = "Specified deployment policy [" + policy.getId()+ "] already exists"; @@ -256,7 +256,7 @@ public class PolicyManager { } DeploymentPolicy depPolicy = this.getDeploymentPolicy(policy); // undeploy network partitions this deployment policy. - PartitionManager.getInstance().undeployNetworkPartitions(depPolicy); +// PartitionManager.getInstance().undeployNetworkPartitions(depPolicy); // undeploy the deployment policy. RegistryManager.getInstance().removeDeploymentPolicy(depPolicy); // remove from the infromation model. http://git-wip-us.apache.org/repos/asf/stratos/blob/18745a09/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java index 03ab3e3..9dd7e85 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java @@ -24,7 +24,7 @@ package org.apache.stratos.autoscaler.registry; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.stratos.autoscaler.NetworkPartitionLbHolder; +//import org.apache.stratos.autoscaler.NetworkPartitionLbHolder; import org.apache.stratos.autoscaler.exception.AutoScalerException; import org.apache.stratos.autoscaler.pojo.ServiceGroup; import org.apache.stratos.autoscaler.policy.model.AutoscalePolicy; @@ -126,14 +126,14 @@ public class RegistryManager { } } - public void persistNetworkPartitionIbHolder(NetworkPartitionLbHolder nwPartitionLbHolder) { - String resourcePath = AutoScalerConstants.AUTOSCALER_RESOURCE + AutoScalerConstants - .NETWORK_PARTITION_LB_HOLDER_RESOURCE + "/" + nwPartitionLbHolder.getNetworkPartitionId(); - persist(nwPartitionLbHolder, resourcePath); - if (log.isDebugEnabled()) { - log.debug("NetworkPartitionContext written to registry: " + nwPartitionLbHolder.toString()); - } - } +// public void persistNetworkPartitionIbHolder(NetworkPartitionLbHolder nwPartitionLbHolder) { +// String resourcePath = AutoScalerConstants.AUTOSCALER_RESOURCE + AutoScalerConstants +// .NETWORK_PARTITION_LB_HOLDER_RESOURCE + "/" + nwPartitionLbHolder.getNetworkPartitionId(); +// persist(nwPartitionLbHolder, resourcePath); +// if (log.isDebugEnabled()) { +// log.debug("NetworkPartitionContext written to registry: " + nwPartitionLbHolder.toString()); +// } +// } public void persistAutoscalerPolicy(AutoscalePolicy autoscalePolicy) { String resourcePath = AutoScalerConstants.AUTOSCALER_RESOURCE + AutoScalerConstants.AS_POLICY_RESOURCE + "/" + autoscalePolicy.getId(); @@ -324,38 +324,38 @@ public class RegistryManager { return partitionList; } - public List<NetworkPartitionLbHolder> retrieveNetworkPartitionLbHolders() { - List<NetworkPartitionLbHolder> nwPartitionLbHolderList = new ArrayList<NetworkPartitionLbHolder>(); - RegistryManager registryManager = RegistryManager.getInstance(); - String[] partitionsResourceList = (String[]) registryManager.retrieve(AutoScalerConstants.AUTOSCALER_RESOURCE + - AutoScalerConstants.NETWORK_PARTITION_LB_HOLDER_RESOURCE); - - if (partitionsResourceList != null) { - NetworkPartitionLbHolder nwPartitionLbHolder; - for (String resourcePath : partitionsResourceList) { - Object serializedObj = registryManager.retrieve(resourcePath); - if (serializedObj != null) { - try { - - Object dataObj = Deserializer.deserializeFromByteArray((byte[]) serializedObj); - if (dataObj instanceof NetworkPartitionLbHolder) { - nwPartitionLbHolder = (NetworkPartitionLbHolder) dataObj; - if (log.isDebugEnabled()) { - log.debug(String.format("NetworkPartitionLbHolder read from registry: " + nwPartitionLbHolder.toString())); - } - nwPartitionLbHolderList.add(nwPartitionLbHolder); - } else { - return null; - } - } catch (Exception e) { - String msg = "Unable to retrieve data from Registry. Hence, any historical NetworkPartitionLbHolder will not get reflected."; - log.warn(msg, e); - } - } - } - } - return nwPartitionLbHolderList; - } +// public List<NetworkPartitionLbHolder> retrieveNetworkPartitionLbHolders() { +// List<NetworkPartitionLbHolder> nwPartitionLbHolderList = new ArrayList<NetworkPartitionLbHolder>(); +// RegistryManager registryManager = RegistryManager.getInstance(); +// String[] partitionsResourceList = (String[]) registryManager.retrieve(AutoScalerConstants.AUTOSCALER_RESOURCE + +// AutoScalerConstants.NETWORK_PARTITION_LB_HOLDER_RESOURCE); +// +// if (partitionsResourceList != null) { +// NetworkPartitionLbHolder nwPartitionLbHolder; +// for (String resourcePath : partitionsResourceList) { +// Object serializedObj = registryManager.retrieve(resourcePath); +// if (serializedObj != null) { +// try { +// +// Object dataObj = Deserializer.deserializeFromByteArray((byte[]) serializedObj); +// if (dataObj instanceof NetworkPartitionLbHolder) { +// nwPartitionLbHolder = (NetworkPartitionLbHolder) dataObj; +// if (log.isDebugEnabled()) { +// log.debug(String.format("NetworkPartitionLbHolder read from registry: " + nwPartitionLbHolder.toString())); +// } +// nwPartitionLbHolderList.add(nwPartitionLbHolder); +// } else { +// return null; +// } +// } catch (Exception e) { +// String msg = "Unable to retrieve data from Registry. Hence, any historical NetworkPartitionLbHolder will not get reflected."; +// log.warn(msg, e); +// } +// } +// } +// } +// return nwPartitionLbHolderList; +// } public List<AutoscalePolicy> retrieveASPolicies() { List<AutoscalePolicy> asPolicyList = new ArrayList<AutoscalePolicy>();
