Repository: stratos Updated Branches: refs/heads/docker-grouping-merge e46350501 -> fbe1137b0
removing un-used listener Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/fbe1137b Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/fbe1137b Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/fbe1137b Branch: refs/heads/docker-grouping-merge Commit: fbe1137b06433d8cdab80caeb01c790a051ec648 Parents: e463505 Author: reka <[email protected]> Authored: Tue Nov 4 13:55:42 2014 +0530 Committer: reka <[email protected]> Committed: Tue Nov 4 13:55:42 2014 +0530 ---------------------------------------------------------------------- .../AutoscalerTopologyEventReceiver.java | 128 ------------------- 1 file changed, 128 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/fbe1137b/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 0e2a4f9..6a6a48e 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 @@ -314,134 +314,6 @@ public class AutoscalerTopologyEventReceiver implements Runnable { } }); - topologyEventReceiver.addEventListener(new ApplicationUndeployedEventListener() { - @Override - protected void onEvent(Event event) { - - log.info("[ApplicationUndeployedEvent] Received: " + event.getClass()); - - ApplicationUndeployedEvent applicationUndeployedEvent = (ApplicationUndeployedEvent) event; - - ApplicationMonitor appMonitor = AutoscalerContext.getInstance(). - getAppMonitor(applicationUndeployedEvent.getApplicationId()); - - // if any of Cluster Monitors are not added yet, should send the - // Cluster Terminated event for those clusters - Set<ClusterDataHolder> clusterDataHolders = applicationUndeployedEvent.getClusterData(); - if (clusterDataHolders != null) { - for (ClusterDataHolder clusterDataHolder : clusterDataHolders) { - VMClusterMonitor clusterMonitor = - ((VMClusterMonitor) AutoscalerContext.getInstance().getClusterMonitor(clusterDataHolder.getClusterId())); - if (clusterMonitor == null) { - // Cluster Monitor not found; send Cluster Terminated event to cleanup - ClusterStatusEventPublisher.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); - } - } - } - - if (appMonitor != null) { - // set Application Monitor state to 'Terminating' - appMonitor.setStatus(ApplicationStatus.Terminating); - - } else { - // ApplicationMonitor is not found, send Terminating event to clean up - ApplicationsEventPublisher.sendApplicationTerminatedEvent( - applicationUndeployedEvent.getApplicationId(), applicationUndeployedEvent.getClusterData()); - } - -// ApplicationUndeployedEvent applicationUndeployedEvent = (ApplicationUndeployedEvent) event; -// -// // acquire reead locks for application and relevant clusters -// TopologyManager.acquireReadLockForApplication(applicationUndeployedEvent.getApplicationId()); -// Set<ClusterDataHolder> clusterDataHolders = applicationUndeployedEvent.getClusterData(); -// if (clusterDataHolders != null) { -// for (ClusterDataHolder clusterData : clusterDataHolders) { -// TopologyManager.acquireReadLockForCluster(clusterData.getServiceType(), -// clusterData.getClusterId()); -// } -// } -// -// try { -// ApplicationMonitor appMonitor = AutoscalerContext.getInstance(). -// getAppMonitor(applicationUndeployedEvent.getApplicationId()); -// -// if (appMonitor != null) { -// // update the status as Terminating -// appMonitor.setStatus(ApplicationStatus.Terminating); -// -//// 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(); -// if (clusterMonitor.getStatus() == ClusterStatus.Active) { -// // terminated gracefully -// clusterMonitor.setStatus(ClusterStatus.Terminating); -// InstanceNotificationPublisher.sendInstanceCleanupEventForCluster(clusterData.getClusterId()); -// } else { -// // if not active, forcefully terminate -// clusterMonitor.setStatus(ClusterStatus.Terminating); -// clusterMonitor.terminateAllMembers(); -//// try { -//// // TODO: introduce a task to do this cleanup -//// CloudControllerClient.getInstance().terminateAllInstances(clusterData.getClusterId()); -//// } catch (TerminationException e) { -//// log.error("Unable to terminate instances for [ cluster id ] " + -//// clusterData.getClusterId(), e); -//// } -// } -// } else { -// log.warn("No Cluster Monitor found for cluster id " + clusterData.getClusterId()); -// // if Cluster Monitor is not found, still the Cluster Terminated -// // should be sent to update the parent Monitor -// StatusEventPublisher.sendClusterTerminatedEvent( -// applicationUndeployedEvent.getApplicationId(), -// clusterData.getServiceType(), clusterData.getClusterId()); -// } -// } -// -// // 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 { -// if (clusterDataHolders != null) { -// for (ClusterDataHolder clusterData : clusterDataHolders) { -// TopologyManager.releaseReadLockForCluster(clusterData.getServiceType(), -// clusterData.getClusterId()); -// } -// } -// TopologyManager. -// releaseReadLockForApplication(applicationUndeployedEvent.getApplicationId()); -// } - } - }); - topologyEventReceiver.addEventListener(new MemberReadyToShutdownEventListener() { @Override protected void onEvent(Event event) {
