You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by la...@apache.org on 2014/01/16 05:49:36 UTC

[1/3] git commit: Fixing iterator exception while removing active member

Updated Branches:
  refs/heads/master f6c45151f -> 3a5f074af


Fixing iterator exception while removing active member


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

Branch: refs/heads/master
Commit: 86ec1ff01e03b64c7f5dd6c5f51c2f3a5ca9630d
Parents: efbc7af
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Thu Jan 16 09:31:36 2014 +0530
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Thu Jan 16 09:31:36 2014 +0530

----------------------------------------------------------------------
 .../stratos/autoscaler/PartitionContext.java    | 25 ++++++++++----------
 .../autoscaler/algorithm/OneAfterAnother.java   |  6 ++---
 2 files changed, 16 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/86ec1ff0/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 5e0024d..24119ce 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
@@ -157,9 +157,9 @@ public class PartitionContext implements Serializable{
         if (memberId == null) {
             return;
         }
-        for (Iterator<MemberContext> iterator = pendingMembers.listIterator(); 
-                iterator.hasNext();) {
-            MemberContext pendingMember = (MemberContext) iterator.next();
+        Iterator<MemberContext> iterator = pendingMembers.listIterator();
+        while (iterator.hasNext()) {
+            MemberContext pendingMember = iterator.next();
             if(pendingMember == null) {
                 iterator.remove();
                 continue;
@@ -184,9 +184,9 @@ public class PartitionContext implements Serializable{
         if (memberId == null) {
             return;
         }
-        for (Iterator<MemberContext> iterator = activeMembers.listIterator();
-                iterator.hasNext();) {
-            MemberContext activeMember = (MemberContext) iterator.next();
+        Iterator<MemberContext> iterator = activeMembers.listIterator();
+        while ( iterator.hasNext()) {
+            MemberContext activeMember = iterator.next();
             if(activeMember == null) {
                 iterator.remove();
                 continue;
@@ -332,10 +332,11 @@ public class PartitionContext implements Serializable{
     public void removeActiveMemberById(String memberId) {
 
         synchronized (activeMembers) {
+            Iterator<MemberContext> iterator = activeMembers.listIterator();
+            while (iterator.hasNext()) {
+                MemberContext memberContext = iterator.next();
 
-            for (Iterator<MemberContext> iterator = activeMembers.listIterator(); iterator.hasNext();) {
-                String currentMemberId = ((MemberContext) iterator).getMemberId();
-                if(memberId.equals(currentMemberId)){
+                if(memberId.equals(memberContext.getMemberId())){
 
                     iterator.remove();
                     break;
@@ -360,9 +361,9 @@ public class PartitionContext implements Serializable{
                 List<MemberContext> pendingMembers = ctxt.getPendingMembers();
                 
                 synchronized (pendingMembers) {
-
-                    for (Iterator<MemberContext> iterator = pendingMembers.listIterator(); iterator.hasNext();) {
-                        MemberContext pendingMember = (MemberContext) iterator.next();
+                    Iterator<MemberContext> iterator = pendingMembers.listIterator();
+                    while ( iterator.hasNext()) {
+                        MemberContext pendingMember = iterator.next();
 
                         if (pendingMember == null) {
                             continue;

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/86ec1ff0/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/OneAfterAnother.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/OneAfterAnother.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/OneAfterAnother.java
index 65cbdfc..becfd5b 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/OneAfterAnother.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/OneAfterAnother.java
@@ -106,15 +106,15 @@ public class OneAfterAnother implements AutoscaleAlgorithm {
                         // current partition is free
                         if (log.isDebugEnabled())
                             log.debug(String.format("A free space found for scale down in partition %s [current] %s [min] %s",
-                                    currentPartitionId, networkPartitionContext.getNonTerminatedMemberCountOfPartition(currentPartitionId),
+                                    currentPartitionId, networkPartitionContext.getActiveMemberCount(currentPartitionId),
                                                                     currentPartition.getPartitionMin()))  ;
                         return currentPartition;
                     } else {
                         if (currentPartitionIndex == 0) {
                             if (log.isDebugEnabled())
                                 log.debug(String.format("Partition %s reached with no space to scale down," +
-                                        "[current] %s [mib] %s", currentPartitionId,
-                                        networkPartitionContext.getNonTerminatedMemberCountOfPartition(currentPartitionId),
+                                        "[current] %s [min] %s", currentPartitionId,
+                                        networkPartitionContext.getActiveMemberCount(currentPartitionId),
                                         currentPartition.getPartitionMin()));
                             return null;
                         }


[3/3] git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-stratos

Posted by la...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-stratos


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

Branch: refs/heads/master
Commit: 3a5f074afd9b8a0db0019bb7b7b5d86f0f5d14d5
Parents: ead062a f6c4515
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Thu Jan 16 10:23:50 2014 +0530
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Thu Jan 16 10:23:50 2014 +0530

----------------------------------------------------------------------
 .../java/org/apache/stratos/cli/commands/AddTenantCommand.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------



[2/3] git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-stratos

Posted by la...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-stratos


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

Branch: refs/heads/master
Commit: ead062ab9c64eee73b163055e52bed8f55e2daca
Parents: 86ec1ff 219e3a1
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Thu Jan 16 09:32:07 2014 +0530
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Thu Jan 16 09:32:07 2014 +0530

----------------------------------------------------------------------
 .../java/org/apache/stratos/cli/commands/AddTenantCommand.java     | 2 +-
 .../stratos/cli/commands/AutoscalingPolicyDeploymentCommand.java   | 2 +-
 .../apache/stratos/cli/commands/CartridgeDeploymentCommand.java    | 2 +-
 .../stratos/cli/commands/DeploymentPolicyDeploymentCommand.java    | 2 +-
 .../apache/stratos/cli/commands/PartitionDeploymentCommand.java    | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------