Repository: stratos Updated Branches: refs/heads/4.0.0-grouping f7bd78805 -> 8047060a5
stopping the Cluster Monitor before terminating instances Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/8047060a Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/8047060a Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/8047060a Branch: refs/heads/4.0.0-grouping Commit: 8047060a58f8963303a1aa5756255d5be4d1a215 Parents: f7bd788 Author: Isuru Haththotuwa <[email protected]> Authored: Wed Oct 29 23:10:00 2014 +0530 Committer: Isuru Haththotuwa <[email protected]> Committed: Wed Oct 29 23:10:09 2014 +0530 ---------------------------------------------------------------------- .../receiver/topology/AutoscalerTopologyEventReceiver.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/8047060a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/topology/AutoscalerTopologyEventReceiver.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/topology/AutoscalerTopologyEventReceiver.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/topology/AutoscalerTopologyEventReceiver.java index 5f6e503..b02b2c9 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/topology/AutoscalerTopologyEventReceiver.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/topology/AutoscalerTopologyEventReceiver.java @@ -362,12 +362,18 @@ public class AutoscalerTopologyEventReceiver implements Runnable { Set<ClusterDataHolder> clusterDataHolders = applicationUndeployedEvent.getClusterData(); if (clusterDataHolders != null) { for (ClusterDataHolder clusterDataHolder : clusterDataHolders) { - if (AutoscalerContext.getInstance().getMonitor(clusterDataHolder.getClusterId()) == null) { + ClusterMonitor clusterMonitor = + ((ClusterMonitor) AutoscalerContext.getInstance().getMonitor(clusterDataHolder.getClusterId())); + if (clusterMonitor == null) { // Cluster Monitor not found; send Cluster Terminated event to cleanup StatusEventPublisher.sendClusterTerminatedEvent( applicationUndeployedEvent.getApplicationId(), clusterDataHolder.getServiceType(), clusterDataHolder.getClusterId()); + } else { + // if the Cluster Monitor exists, mark it as destroyed to stop it from spawning + // more instances + clusterMonitor.setDestroyed(true); } } }
