Updated Branches: refs/heads/master 6d65c70a3 -> 7c2f7b6b6
Adding a abstract moniter to solve cluster moniter problem Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/0cabd4f8 Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/0cabd4f8 Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/0cabd4f8 Branch: refs/heads/master Commit: 0cabd4f866d0f2757f272531dc781b28015f2879 Parents: 3ce1815 Author: Udara Liyanage <[email protected]> Authored: Wed Dec 18 13:39:21 2013 -0500 Committer: Udara Liyanage <[email protected]> Committed: Wed Dec 18 13:39:21 2013 -0500 ---------------------------------------------------------------------- .../src/conf/cartridge-config.properties | 64 ----- .../stratos/autoscaler/AutoscalerContext.java | 8 + .../stratos/autoscaler/ClusterMonitor.java | 251 ----------------- .../stratos/autoscaler/LbClusterMonitor.java | 226 ---------------- .../health/HealthEventMessageDelegator.java | 25 +- .../autoscaler/monitor/AbstractMonitor.java | 44 +++ .../autoscaler/monitor/ClusterMonitor.java | 270 +++++++++++++++++++ .../autoscaler/monitor/LbClusterMonitor.java | 245 +++++++++++++++++ .../autoscaler/policy/PolicyManager.java | 2 +- .../topology/AutoscalerTopologyReceiver.java | 2 + .../stratos/autoscaler/util/AutoscalerUtil.java | 3 + 11 files changed, 590 insertions(+), 550 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/0cabd4f8/components/org.apache.stratos.adc.mgt/src/conf/cartridge-config.properties ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.adc.mgt/src/conf/cartridge-config.properties b/components/org.apache.stratos.adc.mgt/src/conf/cartridge-config.properties deleted file mode 100644 index 2f7c7f9..0000000 --- a/components/org.apache.stratos.adc.mgt/src/conf/cartridge-config.properties +++ /dev/null @@ -1,64 +0,0 @@ -# -# -# 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. -# -# - -# Configuration properties - -sc.ip=stratos_ip -autoscalerService.url=https://cc.wso2.com:9444/services/CloudControllerService/ -autoscaler.time.out=190000 -cartridge.agent.epr=https://stratos_ip:9447/services/CartridgeAgentService -git.host.name=s2_hostname -git.host.ip=stratos_ip -git.repo.notification.url=https://sc.wso2.com:9445/services/RepoNotificationService/ -identity.server.url=https://sc.wso2.com:9447/services/RepoNotificationService/ - -adc.jdbc.url=jdbc:h2:repository/database/WSO2S2_DB -adc.jdbc.username=wso2carbon -adc.jdbc.password=wso2carbon -adc.jdbc.driver=org.h2.Driver - -mb.ip=mb.stratos.apache.org -mb.port=5677 -cep.ip=cep.stratos.apache.org -cep.port=7615 - -feature.externalrepo.validation.enabled=true -feature.internalrepo.enabled=false -feature.multitenant.multiplesubscription.enabled=false - -internal.repo.username=admin -internal.repo.password=admin - -append.script=SCRIPT_PATH/add_entry_zone_file.sh -remove.script=SCRIPT_PATH/remove_entry_zone_file.sh -bind.file.path=/etc/bind/db.STRATOS_DOMAIN -elb.ip=stratos_ip - -bam.ip=stratos_ip -bam.port=7714 - -max.attempts=1000 - -cartridge.key=KEYPATH - -repository.info.epr=https://stratos_ip:9445/services/RepositoryInformationService - -puppet.ip=127.0.0.1 http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/0cabd4f8/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/AutoscalerContext.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/AutoscalerContext.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/AutoscalerContext.java index f574275..fffc8c3 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/AutoscalerContext.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/AutoscalerContext.java @@ -2,6 +2,8 @@ package org.apache.stratos.autoscaler; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.stratos.autoscaler.monitor.ClusterMonitor; +import org.apache.stratos.autoscaler.monitor.LbClusterMonitor; import java.util.HashMap; import java.util.Map; @@ -37,6 +39,7 @@ public class AutoscalerContext { } public void addMonitor(ClusterMonitor monitor) { + log.info("Adding moniter clusterid" + monitor.getClusterId()); monitors.put(monitor.getClusterId(), monitor); } @@ -44,11 +47,16 @@ public class AutoscalerContext { return monitors.get(clusterId); } + public boolean moniterExist(String clusterId) { + return monitors.containsKey(clusterId); + } + public LbClusterMonitor getLBMonitor(String clusterId) { return lbMonitors.get(clusterId); } public ClusterMonitor removeMonitor(String clusterId) { + log.info("Remove moniter clusterid" + clusterId); return monitors.remove(clusterId); } http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/0cabd4f8/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/ClusterMonitor.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/ClusterMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/ClusterMonitor.java deleted file mode 100644 index 1d65c53..0000000 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/ClusterMonitor.java +++ /dev/null @@ -1,251 +0,0 @@ -/* - * 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 org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.stratos.autoscaler.deployment.policy.DeploymentPolicy; -import org.apache.stratos.autoscaler.policy.model.AutoscalePolicy; -import org.apache.stratos.autoscaler.rule.AutoscalerRuleEvaluator; -import org.drools.runtime.StatefulKnowledgeSession; -import org.drools.runtime.rule.FactHandle; - -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -/** - * 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 ClusterMonitor implements Runnable{ - - private static final Log log = LogFactory.getLog(ClusterMonitor.class); - private String clusterId; - - private String serviceId; - - //key: network partition id, value: Network partition context - private Map<String, NetworkPartitionContext> networkPartitionCtxts; - - - private StatefulKnowledgeSession minCheckKnowledgeSession; - private StatefulKnowledgeSession scaleCheckKnowledgeSession; - private boolean isDestroyed; - - private DeploymentPolicy deploymentPolicy; - private AutoscalePolicy autoscalePolicy; - - // Key- MemberId Value- partitionId - private Map<String, String> memberPartitionMap; - - private FactHandle minCheckFactHandle; - private FactHandle scaleCheckFactHandle; - - private AutoscalerRuleEvaluator autoscalerRuleEvaluator; - - private String lbReferenceType; - - public ClusterMonitor(String clusterId, String serviceId, DeploymentPolicy deploymentPolicy, - AutoscalePolicy autoscalePolicy) { - this.clusterId = clusterId; - this.serviceId = serviceId; - - this.autoscalerRuleEvaluator = new AutoscalerRuleEvaluator(); - this.scaleCheckKnowledgeSession = autoscalerRuleEvaluator.getScaleCheckStatefulSession(); - this.minCheckKnowledgeSession = autoscalerRuleEvaluator.getMinCheckStatefulSession(); - - this.deploymentPolicy = deploymentPolicy; - this.autoscalePolicy = autoscalePolicy; - networkPartitionCtxts = new ConcurrentHashMap<String, NetworkPartitionContext>(); - } - - public String getClusterId() { - return clusterId; - } - - public void setClusterId(String clusterId) { - this.clusterId = clusterId; - } - - public Map<String, NetworkPartitionContext> getNetworkPartitionCtxts() { - return networkPartitionCtxts; - } - - public NetworkPartitionContext getNetworkPartitionCtxt(String networkPartitionId) { - return networkPartitionCtxts.get(networkPartitionId); - } - - public void setPartitionCtxt(Map<String, NetworkPartitionContext> partitionCtxt) { - this.networkPartitionCtxts = partitionCtxt; - } - - public boolean partitionCtxtAvailable(String partitionId) { - return networkPartitionCtxts.containsKey(partitionId); - } - - public void addNetworkPartitionCtxt(NetworkPartitionContext ctxt) { - this.networkPartitionCtxts.put(ctxt.getId(), ctxt); - } - - public NetworkPartitionContext getPartitionCtxt(String id) { - return this.networkPartitionCtxts.get(id); - } - - public StatefulKnowledgeSession getMinCheckKnowledgeSession() { - return minCheckKnowledgeSession; - } - - public void setMinCheckKnowledgeSession(StatefulKnowledgeSession minCheckKnowledgeSession) { - this.minCheckKnowledgeSession = minCheckKnowledgeSession; - } - - public FactHandle getMinCheckFactHandle() { - return minCheckFactHandle; - } - - public void setMinCheckFactHandle(FactHandle minCheckFactHandle) { - this.minCheckFactHandle = minCheckFactHandle; - } - - @Override - public void run() { - - while (!isDestroyed()) { - if (log.isDebugEnabled()) { - log.debug("Cluster monitor is running.. "+this.toString()); - } - try { - monitor(); - } catch (Exception e) { - log.error("Cluster monitor: Monitor failed."+this.toString(), e); - } - try { - // TODO make this configurable - Thread.sleep(30000); - } catch (InterruptedException ignore) { - } - } - } - - private void monitor() { -// if(clusterCtxt != null ) { - //TODO make this concurrent - for (NetworkPartitionContext networkPartitionContext : networkPartitionCtxts.values()) { - - //minimum check per partition - for(PartitionContext partitionContext: networkPartitionContext.getPartitionCtxts().values()){ - - minCheckKnowledgeSession.setGlobal("clusterId", clusterId); - minCheckKnowledgeSession.setGlobal("lbRef", lbReferenceType); - - if (log.isDebugEnabled()) { - log.debug(String.format("Running minimum check for partition %s ", partitionContext.getPartitionId())); - } - - minCheckFactHandle = AutoscalerRuleEvaluator.evaluateMinCheck(minCheckKnowledgeSession - , minCheckFactHandle, partitionContext); - - } - - if(networkPartitionContext.isRifReset()){ - scaleCheckKnowledgeSession.setGlobal("clusterId", clusterId); - scaleCheckKnowledgeSession.setGlobal("deploymentPolicy", deploymentPolicy); - scaleCheckKnowledgeSession.setGlobal("autoscalePolicy", autoscalePolicy); - - if (log.isDebugEnabled()) { - log.debug(String.format("Running scale check for network partition %s ", networkPartitionContext.getId())); - } - - scaleCheckFactHandle = AutoscalerRuleEvaluator.evaluateScaleCheck(scaleCheckKnowledgeSession - , scaleCheckFactHandle, networkPartitionContext); - networkPartitionContext.setRifReset(false); - } else if(log.isDebugEnabled()){ - log.debug(String.format("Scale will not run since the LB statistics have not received before this " + - "cycle for network partition %s", networkPartitionContext.getId()) ); - } - } - } - - - public void destroy() { - minCheckKnowledgeSession.dispose(); - scaleCheckKnowledgeSession.dispose(); - setDestroyed(true); - if(log.isDebugEnabled()) { - log.debug("Cluster Monitor Drools session has been disposed. "+this.toString()); - } - } - - public boolean isDestroyed() { - return isDestroyed; - } - - public void setDestroyed(boolean isDestroyed) { - this.isDestroyed = isDestroyed; - } - - public String getServiceId() { - return serviceId; - } - - public void setServiceId(String serviceId) { - this.serviceId = serviceId; - } - - public DeploymentPolicy getDeploymentPolicy() { - return deploymentPolicy; - } - - public void setDeploymentPolicy(DeploymentPolicy deploymentPolicy) { - this.deploymentPolicy = deploymentPolicy; - } - - public AutoscalePolicy getAutoscalePolicy() { - return autoscalePolicy; - } - - @Override - public String toString() { - return "ClusterMonitor [clusterId=" + clusterId + ", serviceId=" + serviceId + - ", deploymentPolicy=" + deploymentPolicy + ", autoscalePolicy=" + autoscalePolicy + - ", lbReferenceType=" + lbReferenceType + "]"; - } - - public void setAutoscalePolicy(AutoscalePolicy autoscalePolicy) { - this.autoscalePolicy = autoscalePolicy; - } - - public String getPartitonOfMember(String memberId){ - return this.memberPartitionMap.get(memberId); - } - - public boolean memberExist(String memberId){ - return this.memberPartitionMap.containsKey(memberId); - } - - public String getLbReferenceType() { - return lbReferenceType; - } - - public void setLbReferenceType(String lbReferenceType) { - this.lbReferenceType = lbReferenceType; - } -} http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/0cabd4f8/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/LbClusterMonitor.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/LbClusterMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/LbClusterMonitor.java deleted file mode 100644 index 020cec3..0000000 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/LbClusterMonitor.java +++ /dev/null @@ -1,226 +0,0 @@ -/* - * 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 org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.stratos.autoscaler.deployment.policy.DeploymentPolicy; -import org.apache.stratos.autoscaler.policy.model.AutoscalePolicy; -import org.apache.stratos.autoscaler.rule.AutoscalerRuleEvaluator; -import org.drools.runtime.StatefulKnowledgeSession; -import org.drools.runtime.rule.FactHandle; - -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -/** - * 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 LbClusterMonitor implements Runnable{ - - private static final Log log = LogFactory.getLog(LbClusterMonitor.class); - private String clusterId; - private String serviceId; - - private Map<String, NetworkPartitionContext> networkPartitionCtxts; - - private StatefulKnowledgeSession minCheckKnowledgeSession; - private StatefulKnowledgeSession scaleCheckKnowledgeSession; - private boolean isDestroyed; - - private DeploymentPolicy deploymentPolicy; - private AutoscalePolicy autoscalePolicy; - - // Key- MemberId Value- partitionId - private Map<String, String> memberPartitionMap; - - private FactHandle minCheckFactHandle; - private FactHandle scaleCheckFactHandle; - - private AutoscalerRuleEvaluator autoscalerRuleEvaluator; - - public LbClusterMonitor(String clusterId, String serviceId, DeploymentPolicy deploymentPolicy, - AutoscalePolicy autoscalePolicy) { - this.clusterId = clusterId; - this.serviceId = serviceId; - - this.autoscalerRuleEvaluator = new AutoscalerRuleEvaluator(); - this.scaleCheckKnowledgeSession = autoscalerRuleEvaluator.getScaleCheckStatefulSession(); - this.minCheckKnowledgeSession = autoscalerRuleEvaluator.getMinCheckStatefulSession(); - - this.deploymentPolicy = deploymentPolicy; - this.deploymentPolicy = deploymentPolicy; - networkPartitionCtxts = new ConcurrentHashMap<String, NetworkPartitionContext>(); - } - - public String getClusterId() { - return clusterId; - } - - public void setClusterId(String clusterId) { - this.clusterId = clusterId; - } - - public Map<String, NetworkPartitionContext> getNetworkPartitionCtxts() { - return networkPartitionCtxts; - } - - public NetworkPartitionContext getNetworkPartitionCtxt(String networkPartitionId) { - return networkPartitionCtxts.get(networkPartitionId); - } - - public void setPartitionCtxt(Map<String, NetworkPartitionContext> partitionCtxt) { - this.networkPartitionCtxts = partitionCtxt; - } - - public boolean partitionCtxtAvailable(String partitionId) { - return networkPartitionCtxts.containsKey(partitionId); - } - - public void addNetworkPartitionCtxt(NetworkPartitionContext ctxt) { - this.networkPartitionCtxts.put(ctxt.getId(), ctxt); - } - - public NetworkPartitionContext getPartitionCtxt(String id) { - return this.networkPartitionCtxts.get(id); - } - - public StatefulKnowledgeSession getMinCheckKnowledgeSession() { - return minCheckKnowledgeSession; - } - - public void setMinCheckKnowledgeSession(StatefulKnowledgeSession minCheckKnowledgeSession) { - this.minCheckKnowledgeSession = minCheckKnowledgeSession; - } - - public FactHandle getMinCheckFactHandle() { - return minCheckFactHandle; - } - - public void setMinCheckFactHandle(FactHandle minCheckFactHandle) { - this.minCheckFactHandle = minCheckFactHandle; - } - - @Override - public void run() { - - while (!isDestroyed()) { - if (log.isDebugEnabled()) { - log.debug("Cluster monitor is running.. "+this.toString()); - } - try { - monitor(); - } catch (Exception e) { - log.error("Cluster monitor: Monitor failed. "+this.toString(), e); - } - try { - // TODO make this configurable - Thread.sleep(30000); - } catch (InterruptedException ignore) { - } - } - } - - private void monitor() { - // TODO make this concurrent - for (NetworkPartitionContext networkPartitionContext : networkPartitionCtxts.values()) { - - // minimum check per partition - for (PartitionContext partitionContext : networkPartitionContext.getPartitionCtxts() - .values()) { - - if (partitionContext != null) { - minCheckKnowledgeSession.setGlobal("clusterId", clusterId); - - if (log.isDebugEnabled()) { - log.debug(String.format("Running minimum check for partition %s ", - partitionContext.getPartitionId())); - } - - minCheckFactHandle = - AutoscalerRuleEvaluator.evaluateMinCheck(minCheckKnowledgeSession, - minCheckFactHandle, - partitionContext); - // start only in the first partition context - break; - } - - } - - } - } - - - public void destroy() { - minCheckKnowledgeSession.dispose(); - scaleCheckKnowledgeSession.dispose(); - setDestroyed(true); - if(log.isDebugEnabled()) { - log.debug("Cluster Monitor Drools session has been disposed. "+this.toString()); - } - } - - public boolean isDestroyed() { - return isDestroyed; - } - - public void setDestroyed(boolean isDestroyed) { - this.isDestroyed = isDestroyed; - } - - public String getServiceId() { - return serviceId; - } - - public void setServiceId(String serviceId) { - this.serviceId = serviceId; - } - - public DeploymentPolicy getDeploymentPolicy() { - return deploymentPolicy; - } - - public void setDeploymentPolicy(DeploymentPolicy deploymentPolicy) { - this.deploymentPolicy = deploymentPolicy; - } - - public AutoscalePolicy getAutoscalePolicy() { - return autoscalePolicy; - } - - public void setAutoscalePolicy(AutoscalePolicy autoscalePolicy) { - this.autoscalePolicy = autoscalePolicy; - } - - public String getPartitonOfMember(String memberId){ - return this.memberPartitionMap.get(memberId); - } - - public boolean memberExist(String memberId){ - return this.memberPartitionMap.containsKey(memberId); - } - - @Override - public String toString() { - return "LbClusterMonitor [clusterId=" + clusterId + ", serviceId=" + serviceId + "]"; - } -} http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/0cabd4f8/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/health/HealthEventMessageDelegator.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/health/HealthEventMessageDelegator.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/health/HealthEventMessageDelegator.java index 120defc..d206590 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/health/HealthEventMessageDelegator.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/health/HealthEventMessageDelegator.java @@ -23,13 +23,14 @@ import com.google.gson.stream.JsonReader; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.stratos.autoscaler.AutoscalerContext; -import org.apache.stratos.autoscaler.ClusterMonitor; import org.apache.stratos.autoscaler.Constants; import org.apache.stratos.autoscaler.NetworkPartitionContext; import org.apache.stratos.autoscaler.PartitionContext; import org.apache.stratos.autoscaler.client.cloud.controller.CloudControllerClient; import org.apache.stratos.autoscaler.exception.SpawningException; import org.apache.stratos.autoscaler.exception.TerminationException; +import org.apache.stratos.autoscaler.monitor.AbstractMonitor; +import org.apache.stratos.autoscaler.monitor.ClusterMonitor; import org.apache.stratos.autoscaler.partition.PartitionManager; import org.apache.stratos.autoscaler.policy.model.LoadAverage; import org.apache.stratos.autoscaler.policy.model.MemoryConsumption; @@ -273,17 +274,19 @@ public class HealthEventMessageDelegator implements Runnable { } return null; } - + /* private NetworkPartitionContext findNetworkPartition(String memberId) { for(Service service: TopologyManager.getTopology().getServices()){ for(Cluster cluster: service.getClusters()){ - return AutoscalerContext.getInstance().getMonitor(cluster.getClusterId()) + NetworkPartitionContext netCtx = AutoscalerContext.getInstance().getMonitor(cluster.getClusterId()) .getNetworkPartitionCtxt(cluster.getMember(memberId).getNetworkPartitionId()); + if(null !=netCtx) + return netCtx; } } return null; } - + */ private String findNetworkPartitionId(String memberId) { for(Service service: TopologyManager.getTopology().getServices()){ @@ -315,8 +318,14 @@ public class HealthEventMessageDelegator implements Runnable { private void handleMemberFaultEvent(String clusterId, String memberId) { try { - - ClusterMonitor monitor = AutoscalerContext.getInstance().getMonitor(clusterId); + AutoscalerContext asCtx = AutoscalerContext.getInstance(); + AbstractMonitor monitor = null; + + if(asCtx.moniterExist(clusterId)){ + monitor = AutoscalerContext.getInstance().getMonitor(clusterId); + } + + if (!monitor.memberExist(memberId)) { // member has already terminated. So no action required return; @@ -329,7 +338,7 @@ public class HealthEventMessageDelegator implements Runnable { // start a new member in the same Partition String partitionId = monitor.getPartitonOfMember(memberId); Partition partition = monitor.getDeploymentPolicy().getPartitionById(partitionId); - NetworkPartitionContext nwPartitionCtxt = findNetworkPartition(memberId); + NetworkPartitionContext nwPartitionCtxt = monitor.findNetworkPartition(memberId); PartitionContext partitionCtxt = nwPartitionCtxt.getPartitionCtxt(partitionId); String lbClusterId = AutoscalerRuleEvaluator.getLbClusterId(partitionCtxt, nwPartitionCtxt); @@ -337,7 +346,7 @@ public class HealthEventMessageDelegator implements Runnable { if (log.isInfoEnabled()) { log.info(String.format("Instance spawned for fault member: [partition] %s [cluster] %s [lb cluster] %s ", partitionId, clusterId, lbClusterId)); - } + } } catch (TerminationException e) { log.error(e); http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/0cabd4f8/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/AbstractMonitor.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/AbstractMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/AbstractMonitor.java new file mode 100644 index 0000000..b0ac576 --- /dev/null +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/AbstractMonitor.java @@ -0,0 +1,44 @@ +/* + * 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; + +import org.apache.stratos.autoscaler.NetworkPartitionContext; +import org.apache.stratos.autoscaler.deployment.policy.DeploymentPolicy; +import org.apache.stratos.cloud.controller.deployment.partition.Partition; + +/** + * Is responsible for monitoring a service cluster. This runs periodically + * and perform minimum instance check and scaling check using the underlying + * rules engine. + * + */ + abstract public class AbstractMonitor implements Runnable{ + + @Override + public void run() { + // TODO Auto-generated method stub + + } + + public abstract String getPartitonOfMember(String memberId); + public abstract DeploymentPolicy getDeploymentPolicy(); + public abstract boolean memberExist(String memberId); + public abstract NetworkPartitionContext findNetworkPartition(String memberId); + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/0cabd4f8/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/ClusterMonitor.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/ClusterMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/ClusterMonitor.java new file mode 100644 index 0000000..7afdba7 --- /dev/null +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/ClusterMonitor.java @@ -0,0 +1,270 @@ +/* + * 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; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.stratos.autoscaler.AutoscalerContext; +import org.apache.stratos.autoscaler.NetworkPartitionContext; +import org.apache.stratos.autoscaler.PartitionContext; +import org.apache.stratos.autoscaler.deployment.policy.DeploymentPolicy; +import org.apache.stratos.autoscaler.policy.model.AutoscalePolicy; +import org.apache.stratos.autoscaler.rule.AutoscalerRuleEvaluator; +import org.apache.stratos.messaging.domain.topology.Cluster; +import org.apache.stratos.messaging.domain.topology.Service; +import org.apache.stratos.messaging.message.receiver.topology.TopologyManager; +import org.drools.runtime.StatefulKnowledgeSession; +import org.drools.runtime.rule.FactHandle; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +/** + * 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 ClusterMonitor extends AbstractMonitor{ + + private static final Log log = LogFactory.getLog(ClusterMonitor.class); + private String clusterId; + + private String serviceId; + + //key: network partition id, value: Network partition context + private Map<String, NetworkPartitionContext> networkPartitionCtxts; + + + private StatefulKnowledgeSession minCheckKnowledgeSession; + private StatefulKnowledgeSession scaleCheckKnowledgeSession; + private boolean isDestroyed; + + private DeploymentPolicy deploymentPolicy; + private AutoscalePolicy autoscalePolicy; + + // Key- MemberId Value- partitionId + private Map<String, String> memberPartitionMap; + + private FactHandle minCheckFactHandle; + private FactHandle scaleCheckFactHandle; + + private AutoscalerRuleEvaluator autoscalerRuleEvaluator; + + private String lbReferenceType; + + public ClusterMonitor(String clusterId, String serviceId, DeploymentPolicy deploymentPolicy, + AutoscalePolicy autoscalePolicy) { + this.clusterId = clusterId; + this.serviceId = serviceId; + + this.autoscalerRuleEvaluator = new AutoscalerRuleEvaluator(); + this.scaleCheckKnowledgeSession = autoscalerRuleEvaluator.getScaleCheckStatefulSession(); + this.minCheckKnowledgeSession = autoscalerRuleEvaluator.getMinCheckStatefulSession(); + + this.deploymentPolicy = deploymentPolicy; + this.autoscalePolicy = autoscalePolicy; + networkPartitionCtxts = new ConcurrentHashMap<String, NetworkPartitionContext>(); + } + + public String getClusterId() { + return clusterId; + } + + public void setClusterId(String clusterId) { + this.clusterId = clusterId; + } + + public Map<String, NetworkPartitionContext> getNetworkPartitionCtxts() { + return networkPartitionCtxts; + } + + public NetworkPartitionContext getNetworkPartitionCtxt(String networkPartitionId) { + return networkPartitionCtxts.get(networkPartitionId); + } + + public void setPartitionCtxt(Map<String, NetworkPartitionContext> partitionCtxt) { + this.networkPartitionCtxts = partitionCtxt; + } + + public boolean partitionCtxtAvailable(String partitionId) { + return networkPartitionCtxts.containsKey(partitionId); + } + + public void addNetworkPartitionCtxt(NetworkPartitionContext ctxt) { + this.networkPartitionCtxts.put(ctxt.getId(), ctxt); + } + + public NetworkPartitionContext getPartitionCtxt(String id) { + return this.networkPartitionCtxts.get(id); + } + + public StatefulKnowledgeSession getMinCheckKnowledgeSession() { + return minCheckKnowledgeSession; + } + + public void setMinCheckKnowledgeSession(StatefulKnowledgeSession minCheckKnowledgeSession) { + this.minCheckKnowledgeSession = minCheckKnowledgeSession; + } + + public FactHandle getMinCheckFactHandle() { + return minCheckFactHandle; + } + + public void setMinCheckFactHandle(FactHandle minCheckFactHandle) { + this.minCheckFactHandle = minCheckFactHandle; + } + + @Override + public void run() { + + while (!isDestroyed()) { + if (log.isDebugEnabled()) { + log.debug("Cluster monitor is running.. "+this.toString()); + } + try { + monitor(); + } catch (Exception e) { + log.error("Cluster monitor: Monitor failed."+this.toString(), e); + } + try { + // TODO make this configurable + Thread.sleep(30000); + } catch (InterruptedException ignore) { + } + } + } + + private void monitor() { +// if(clusterCtxt != null ) { + //TODO make this concurrent + for (NetworkPartitionContext networkPartitionContext : networkPartitionCtxts.values()) { + + //minimum check per partition + for(PartitionContext partitionContext: networkPartitionContext.getPartitionCtxts().values()){ + + minCheckKnowledgeSession.setGlobal("clusterId", clusterId); + minCheckKnowledgeSession.setGlobal("lbRef", lbReferenceType); + + if (log.isDebugEnabled()) { + log.debug(String.format("Running minimum check for partition %s ", partitionContext.getPartitionId())); + } + + minCheckFactHandle = AutoscalerRuleEvaluator.evaluateMinCheck(minCheckKnowledgeSession + , minCheckFactHandle, partitionContext); + + } + + if(networkPartitionContext.isRifReset()){ + scaleCheckKnowledgeSession.setGlobal("clusterId", clusterId); + scaleCheckKnowledgeSession.setGlobal("deploymentPolicy", deploymentPolicy); + scaleCheckKnowledgeSession.setGlobal("autoscalePolicy", autoscalePolicy); + + if (log.isDebugEnabled()) { + log.debug(String.format("Running scale check for network partition %s ", networkPartitionContext.getId())); + } + + scaleCheckFactHandle = AutoscalerRuleEvaluator.evaluateScaleCheck(scaleCheckKnowledgeSession + , scaleCheckFactHandle, networkPartitionContext); + networkPartitionContext.setRifReset(false); + } else if(log.isDebugEnabled()){ + log.debug(String.format("Scale will not run since the LB statistics have not received before this " + + "cycle for network partition %s", networkPartitionContext.getId()) ); + } + } + } + + + public void destroy() { + minCheckKnowledgeSession.dispose(); + scaleCheckKnowledgeSession.dispose(); + setDestroyed(true); + if(log.isDebugEnabled()) { + log.debug("Cluster Monitor Drools session has been disposed. "+this.toString()); + } + } + + public boolean isDestroyed() { + return isDestroyed; + } + + public void setDestroyed(boolean isDestroyed) { + this.isDestroyed = isDestroyed; + } + + public String getServiceId() { + return serviceId; + } + + public void setServiceId(String serviceId) { + this.serviceId = serviceId; + } + + public DeploymentPolicy getDeploymentPolicy() { + return deploymentPolicy; + } + + public void setDeploymentPolicy(DeploymentPolicy deploymentPolicy) { + this.deploymentPolicy = deploymentPolicy; + } + + public AutoscalePolicy getAutoscalePolicy() { + return autoscalePolicy; + } + + @Override + public String toString() { + return "ClusterMonitor [clusterId=" + clusterId + ", serviceId=" + serviceId + + ", deploymentPolicy=" + deploymentPolicy + ", autoscalePolicy=" + autoscalePolicy + + ", lbReferenceType=" + lbReferenceType + "]"; + } + + public void setAutoscalePolicy(AutoscalePolicy autoscalePolicy) { + this.autoscalePolicy = autoscalePolicy; + } + + public String getPartitonOfMember(String memberId){ + return this.memberPartitionMap.get(memberId); + } + + public boolean memberExist(String memberId){ + return this.memberPartitionMap.containsKey(memberId); + } + + public String getLbReferenceType() { + return lbReferenceType; + } + + public void setLbReferenceType(String lbReferenceType) { + this.lbReferenceType = lbReferenceType; + } + + @Override + public NetworkPartitionContext findNetworkPartition(String memberId) { + for(Service service: TopologyManager.getTopology().getServices()){ + for(Cluster cluster: service.getClusters()){ + NetworkPartitionContext netCtx = AutoscalerContext.getInstance().getMonitor(cluster.getClusterId()) + .getNetworkPartitionCtxt(cluster.getMember(memberId).getNetworkPartitionId()); + if(null !=netCtx) + return netCtx; + } + } + return null; + } +} http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/0cabd4f8/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/LbClusterMonitor.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/LbClusterMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/LbClusterMonitor.java new file mode 100644 index 0000000..1b24a42 --- /dev/null +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/LbClusterMonitor.java @@ -0,0 +1,245 @@ +/* + * 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; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.stratos.autoscaler.AutoscalerContext; +import org.apache.stratos.autoscaler.NetworkPartitionContext; +import org.apache.stratos.autoscaler.PartitionContext; +import org.apache.stratos.autoscaler.deployment.policy.DeploymentPolicy; +import org.apache.stratos.autoscaler.policy.model.AutoscalePolicy; +import org.apache.stratos.autoscaler.rule.AutoscalerRuleEvaluator; +import org.apache.stratos.messaging.domain.topology.Cluster; +import org.apache.stratos.messaging.domain.topology.Service; +import org.apache.stratos.messaging.message.receiver.topology.TopologyManager; +import org.drools.runtime.StatefulKnowledgeSession; +import org.drools.runtime.rule.FactHandle; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +/** + * 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 LbClusterMonitor extends AbstractMonitor{ + + private static final Log log = LogFactory.getLog(LbClusterMonitor.class); + private String clusterId; + private String serviceId; + + private Map<String, NetworkPartitionContext> networkPartitionCtxts; + + private StatefulKnowledgeSession minCheckKnowledgeSession; + private StatefulKnowledgeSession scaleCheckKnowledgeSession; + private boolean isDestroyed; + + private DeploymentPolicy deploymentPolicy; + private AutoscalePolicy autoscalePolicy; + + // Key- MemberId Value- partitionId + private Map<String, String> memberPartitionMap; + + private FactHandle minCheckFactHandle; + private FactHandle scaleCheckFactHandle; + + private AutoscalerRuleEvaluator autoscalerRuleEvaluator; + + public LbClusterMonitor(String clusterId, String serviceId, DeploymentPolicy deploymentPolicy, + AutoscalePolicy autoscalePolicy) { + this.clusterId = clusterId; + this.serviceId = serviceId; + + this.autoscalerRuleEvaluator = new AutoscalerRuleEvaluator(); + this.scaleCheckKnowledgeSession = autoscalerRuleEvaluator.getScaleCheckStatefulSession(); + this.minCheckKnowledgeSession = autoscalerRuleEvaluator.getMinCheckStatefulSession(); + + this.deploymentPolicy = deploymentPolicy; + this.deploymentPolicy = deploymentPolicy; + networkPartitionCtxts = new ConcurrentHashMap<String, NetworkPartitionContext>(); + } + + public String getClusterId() { + return clusterId; + } + + public void setClusterId(String clusterId) { + this.clusterId = clusterId; + } + + public Map<String, NetworkPartitionContext> getNetworkPartitionCtxts() { + return networkPartitionCtxts; + } + + public NetworkPartitionContext getNetworkPartitionCtxt(String networkPartitionId) { + return networkPartitionCtxts.get(networkPartitionId); + } + + public void setPartitionCtxt(Map<String, NetworkPartitionContext> partitionCtxt) { + this.networkPartitionCtxts = partitionCtxt; + } + + public boolean partitionCtxtAvailable(String partitionId) { + return networkPartitionCtxts.containsKey(partitionId); + } + + public void addNetworkPartitionCtxt(NetworkPartitionContext ctxt) { + this.networkPartitionCtxts.put(ctxt.getId(), ctxt); + } + + public NetworkPartitionContext getPartitionCtxt(String id) { + return this.networkPartitionCtxts.get(id); + } + + public StatefulKnowledgeSession getMinCheckKnowledgeSession() { + return minCheckKnowledgeSession; + } + + public void setMinCheckKnowledgeSession(StatefulKnowledgeSession minCheckKnowledgeSession) { + this.minCheckKnowledgeSession = minCheckKnowledgeSession; + } + + public FactHandle getMinCheckFactHandle() { + return minCheckFactHandle; + } + + public void setMinCheckFactHandle(FactHandle minCheckFactHandle) { + this.minCheckFactHandle = minCheckFactHandle; + } + + @Override + public void run() { + + while (!isDestroyed()) { + if (log.isDebugEnabled()) { + log.debug("Cluster monitor is running.. "+this.toString()); + } + try { + monitor(); + } catch (Exception e) { + log.error("Cluster monitor: Monitor failed. "+this.toString(), e); + } + try { + // TODO make this configurable + Thread.sleep(30000); + } catch (InterruptedException ignore) { + } + } + } + + private void monitor() { + // TODO make this concurrent + for (NetworkPartitionContext networkPartitionContext : networkPartitionCtxts.values()) { + + // minimum check per partition + for (PartitionContext partitionContext : networkPartitionContext.getPartitionCtxts() + .values()) { + + if (partitionContext != null) { + minCheckKnowledgeSession.setGlobal("clusterId", clusterId); + + if (log.isDebugEnabled()) { + log.debug(String.format("Running minimum check for partition %s ", + partitionContext.getPartitionId())); + } + + minCheckFactHandle = + AutoscalerRuleEvaluator.evaluateMinCheck(minCheckKnowledgeSession, + minCheckFactHandle, + partitionContext); + // start only in the first partition context + break; + } + + } + + } + } + + + public void destroy() { + minCheckKnowledgeSession.dispose(); + scaleCheckKnowledgeSession.dispose(); + setDestroyed(true); + if(log.isDebugEnabled()) { + log.debug("Cluster Monitor Drools session has been disposed. "+this.toString()); + } + } + + public boolean isDestroyed() { + return isDestroyed; + } + + public void setDestroyed(boolean isDestroyed) { + this.isDestroyed = isDestroyed; + } + + public String getServiceId() { + return serviceId; + } + + public void setServiceId(String serviceId) { + this.serviceId = serviceId; + } + + public DeploymentPolicy getDeploymentPolicy() { + return deploymentPolicy; + } + + public void setDeploymentPolicy(DeploymentPolicy deploymentPolicy) { + this.deploymentPolicy = deploymentPolicy; + } + + public AutoscalePolicy getAutoscalePolicy() { + return autoscalePolicy; + } + + public void setAutoscalePolicy(AutoscalePolicy autoscalePolicy) { + this.autoscalePolicy = autoscalePolicy; + } + + public String getPartitonOfMember(String memberId){ + return this.memberPartitionMap.get(memberId); + } + + public boolean memberExist(String memberId){ + return this.memberPartitionMap.containsKey(memberId); + } + + @Override + public String toString() { + return "LbClusterMonitor [clusterId=" + clusterId + ", serviceId=" + serviceId + "]"; + } + + @Override + public NetworkPartitionContext findNetworkPartition(String memberId) { + for(Service service: TopologyManager.getTopology().getServices()){ + for(Cluster cluster: service.getClusters()){ + NetworkPartitionContext netCtx = AutoscalerContext.getInstance().getLBMonitor(cluster.getClusterId()) + .getNetworkPartitionCtxt(cluster.getMember(memberId).getNetworkPartitionId()); + if(null != netCtx) + return netCtx; + } + } + return null; + } +} http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/0cabd4f8/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 49e7a2c..c939974 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 @@ -111,7 +111,7 @@ public class PolicyManager { } private static void fillPartition(Partition destPartition, Partition srcPartition) { - if(srcPartition.getProvider() == null) + if(srcPartition.getProvider() == null) throw new RuntimeException("Provider is not set in the deployed partition"); if (log.isDebugEnabled()) { http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/0cabd4f8/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/topology/AutoscalerTopologyReceiver.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/topology/AutoscalerTopologyReceiver.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/topology/AutoscalerTopologyReceiver.java index f70e0ac..9372fe0 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/topology/AutoscalerTopologyReceiver.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/topology/AutoscalerTopologyReceiver.java @@ -24,6 +24,8 @@ import org.apache.commons.logging.LogFactory; import org.apache.stratos.autoscaler.*; import org.apache.stratos.autoscaler.exception.PartitionValidationException; import org.apache.stratos.autoscaler.exception.PolicyValidationException; +import org.apache.stratos.autoscaler.monitor.ClusterMonitor; +import org.apache.stratos.autoscaler.monitor.LbClusterMonitor; import org.apache.stratos.autoscaler.util.AutoscalerUtil; import org.apache.stratos.messaging.domain.topology.Cluster; import org.apache.stratos.messaging.domain.topology.Service; http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/0cabd4f8/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java index ed221e0..85aa783 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java @@ -27,6 +27,8 @@ import org.apache.stratos.autoscaler.client.cloud.controller.CloudControllerClie import org.apache.stratos.autoscaler.deployment.policy.DeploymentPolicy; import org.apache.stratos.autoscaler.exception.PartitionValidationException; import org.apache.stratos.autoscaler.exception.PolicyValidationException; +import org.apache.stratos.autoscaler.monitor.ClusterMonitor; +import org.apache.stratos.autoscaler.monitor.LbClusterMonitor; import org.apache.stratos.autoscaler.partition.PartitionGroup; import org.apache.stratos.autoscaler.partition.PartitionManager; import org.apache.stratos.autoscaler.policy.PolicyManager; @@ -41,6 +43,7 @@ import org.apache.stratos.messaging.domain.topology.MemberStatus; import org.apache.stratos.messaging.util.Constants; import javax.xml.namespace.QName; + import java.util.ArrayList; import java.util.Iterator; import java.util.Random;
