You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ni...@apache.org on 2014/02/14 11:28:01 UTC

git commit: fixing https://issues.apache.org/jira/browse/STRATOS-449

Updated Branches:
  refs/heads/master 30245882f -> b2ba8234c


fixing https://issues.apache.org/jira/browse/STRATOS-449


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

Branch: refs/heads/master
Commit: b2ba8234ccfa64429bdb8526ba0f674229ec6d10
Parents: 3024588
Author: Nirmal Fernando <ni...@apache.org>
Authored: Fri Feb 14 15:57:17 2014 +0530
Committer: Nirmal Fernando <ni...@apache.org>
Committed: Fri Feb 14 15:57:17 2014 +0530

----------------------------------------------------------------------
 .../stratos/autoscaler/PartitionContext.java    | 17 +++++++++++++++++
 .../topology/AutoscalerTopologyReceiver.java    | 20 +++++++++++++++-----
 2 files changed, 32 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b2ba8234/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/PartitionContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/PartitionContext.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/PartitionContext.java
index 63bdeaa..7fcfa93 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/PartitionContext.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/PartitionContext.java
@@ -166,6 +166,23 @@ public class PartitionContext implements Serializable{
         this.pendingMembers.add(ctxt);
     }
     
+    public boolean removePendingMember(String id) {
+    	if (id == null) {
+            return false;
+        }
+
+    	for (Iterator<MemberContext> iterator = pendingMembers.iterator(); iterator.hasNext();) {
+    		MemberContext pendingMember = (MemberContext) iterator.next();
+    		if(id.equals(pendingMember.getMemberId())){
+    			iterator.remove();
+    			return true;
+    		}
+			
+		}
+    	
+    	return false;
+    }
+    
     public void movePendingMemberToActiveMembers(String memberId) {
         if (memberId == null) {
             return;

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b2ba8234/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/topology/AutoscalerTopologyReceiver.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/topology/AutoscalerTopologyReceiver.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/topology/AutoscalerTopologyReceiver.java
index be22bc7..0efa6e1 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/topology/AutoscalerTopologyReceiver.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/topology/AutoscalerTopologyReceiver.java
@@ -236,14 +236,24 @@ public class AutoscalerTopologyReceiver implements Runnable {
                 NetworkPartitionContext networkPartitionContext = monitor.getNetworkPartitionCtxt(networkPartitionId);
 
                 PartitionContext partitionContext = networkPartitionContext.getPartitionCtxt(partitionId);
-                partitionContext.removeMemberStatsContext(e.getMemberId());
-                if(!partitionContext.removeTerminationPendingMember(e.getMemberId())){
+                String memberId = e.getMemberId();
+				partitionContext.removeMemberStatsContext(memberId);
+                
+                if(partitionContext.removePendingMember(memberId)) {
+                	if(log.isDebugEnabled()){
+                        log.debug(String.format("Member is removed from pending list: [member] %s", memberId));
+                    }
+                }
+                
+                if(!partitionContext.removeTerminationPendingMember(memberId)){
 
                     if(log.isDebugEnabled()){
-                        log.debug(String.format("Member is not available in termination pending list: [member] %s", e.getMemberId()));
+                        log.debug(String.format("Member is not available in termination pending list: [member] %s", memberId));
                     }
-                } else if(log.isInfoEnabled()){
-                    log.info(String.format("Member stat context has been removed successfully: [member] %s", e.getMemberId()));
+                } 
+                
+                if(log.isInfoEnabled()){
+                    log.info(String.format("Member stat context has been removed successfully: [member] %s", memberId));
                 }
 //                partitionContext.decrementCurrentActiveMemberCount(1);