stratos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From im...@apache.org
Subject [21/50] [abbrv] git commit: fixing STRATOS-918
Date Thu, 30 Oct 2014 04:13:45 GMT
fixing STRATOS-918


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/097e884b
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/097e884b
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/097e884b

Branch: refs/heads/docker-grouping-merge
Commit: 097e884bd2e5c5942c3023eb5b5cbbf6d82331bf
Parents: dd210b5
Author: Isuru Haththotuwa <isuruh@apache.org>
Authored: Tue Oct 28 12:13:04 2014 +0530
Committer: Isuru Haththotuwa <isuruh@apache.org>
Committed: Tue Oct 28 12:13:04 2014 +0530

----------------------------------------------------------------------
 .../topology/AutoscalerTopologyEventReceiver.java      | 13 +++++++++++++
 1 file changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/097e884b/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 9109d50..e5bbd55 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
@@ -27,6 +27,7 @@ import org.apache.stratos.autoscaler.deployment.policy.DeploymentPolicy;
 import org.apache.stratos.autoscaler.exception.DependencyBuilderException;
 import org.apache.stratos.autoscaler.exception.TerminationException;
 import org.apache.stratos.autoscaler.exception.TopologyInConsistentException;
+import org.apache.stratos.autoscaler.grouping.topic.StatusEventPublisher;
 import org.apache.stratos.autoscaler.monitor.AbstractClusterMonitor;
 import org.apache.stratos.autoscaler.monitor.ApplicationMonitorFactory;
 import org.apache.stratos.autoscaler.monitor.application.ApplicationMonitor;
@@ -364,11 +365,13 @@ public class AutoscalerTopologyEventReceiver implements Runnable {
 //                        List<String> clusters = appMonitor.
 //                                findClustersOfApplication(applicationUndeployedEvent.getApplicationId());
 
+                        boolean clusterMonitorsFound = false;
                         for (ClusterDataHolder clusterData : clusterDataHolders) {
                             //stopping the cluster monitor and remove it from the AS
                             ClusterMonitor clusterMonitor =
                                     ((ClusterMonitor) AutoscalerContext.getInstance().getMonitor(clusterData.getClusterId()));
                             if (clusterMonitor != null) {
+                                clusterMonitorsFound = true;
                                 clusterMonitor.setDestroyed(true);
                                 clusterMonitor.terminateAllMembers();
                                 clusterMonitor.setStatus(ClusterStatus.Terminating);
@@ -377,9 +380,19 @@ public class AutoscalerTopologyEventReceiver implements Runnable {
                             }
                         }
 
+                        // if by any chance, the cluster monitors have failed, we still need
to undeploy this application
+                        // hence, check if the Cluster Monitors are not found and send the
Application Terminated event
+                        if (!clusterMonitorsFound) {
+                            StatusEventPublisher.sendApplicationTerminatedEvent(
+                                    applicationUndeployedEvent.getApplicationId(), clusterDataHolders);
+                        }
+
                     } else {
                         log.warn("Application Monitor cannot be found for the undeployed
[application] "
                                 + applicationUndeployedEvent.getApplicationId());
+                        // send the App Terminated event to cleanup
+                        StatusEventPublisher.sendApplicationTerminatedEvent(
+                                applicationUndeployedEvent.getApplicationId(), clusterDataHolders);
                     }
 
                 } finally {


Mime
View raw message