Fix member stat context removal on member maintenance event
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/af6ade45 Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/af6ade45 Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/af6ade45 Branch: refs/heads/master Commit: af6ade4501f3d8272704a617376e0c218baa0d23 Parents: 2515de5 Author: Lahiru Sandaruwan <[email protected]> Authored: Thu Jun 11 15:40:31 2015 +0530 Committer: Lahiru Sandaruwan <[email protected]> Committed: Thu Jun 11 15:40:31 2015 +0530 ---------------------------------------------------------------------- .../autoscaler/monitor/cluster/ClusterMonitor.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/af6ade45/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java index bea8c90..d314215 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java @@ -1157,12 +1157,16 @@ public class ClusterMonitor extends Monitor { clusterInstanceId); ClusterLevelPartitionContext clusterMonitorPartitionContext = networkPartitionCtxt. getPartitionCtxt(partitionId); - clusterMonitorPartitionContext.addMemberStatsContext(new MemberStatsContext(memberId)); + + clusterMonitorPartitionContext.moveActiveMemberToTerminationPendingMembers(memberId); + if (clusterMonitorPartitionContext.getMemberStatsContext(memberId) != null) { + clusterMonitorPartitionContext.removeMemberStatsContext(memberId); + } if (log.isDebugEnabled()) { - log.debug(String.format("Member has been moved as pending termination: " + log.debug(String.format("Member has been moved as pending termination, and member stat context is removed: " + "[member] %s", memberId)); } - clusterMonitorPartitionContext.moveActiveMemberToTerminationPendingMembers(memberId); + } public void handleMemberReadyToShutdownEvent(MemberReadyToShutdownEvent memberReadyToShutdownEvent) { @@ -1467,7 +1471,7 @@ public class ClusterMonitor extends Monitor { } else { createClusterInstance(cluster.getServiceName(), cluster.getClusterId(), null, parentInstanceId, partitionId, parentMonitorInstance.getNetworkPartitionId()); - if(log.isDebugEnabled()) { + if (log.isDebugEnabled()) { log.debug(String.format("Cluster instance created: [application-id] %s [service-name] %s " + "[cluster-id] %s", appId, cluster.getServiceName(), cluster.getClusterId())); }
