Repository: stratos Updated Branches: refs/heads/docker-grouping-merge 0137ebb94 -> 91624f9f1
adding comments Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/91624f9f Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/91624f9f Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/91624f9f Branch: refs/heads/docker-grouping-merge Commit: 91624f9f1e8cbe6ab131db49d7862196786d3592 Parents: 0137ebb Author: reka <[email protected]> Authored: Tue Nov 4 17:01:53 2014 +0530 Committer: reka <[email protected]> Committed: Tue Nov 4 17:02:07 2014 +0530 ---------------------------------------------------------------------- .../status/checker/StatusChecker.java | 24 +++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/91624f9f/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/checker/StatusChecker.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/checker/StatusChecker.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/checker/StatusChecker.java index d46be58..d30aa95 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/checker/StatusChecker.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/checker/StatusChecker.java @@ -83,6 +83,13 @@ public class StatusChecker { groupThread.start(); } + /** + * This will calculate the status of the cluster upon a member termination. + * The possible states which cluster can change upon member termination are + * Active --> InActive, Terminating-->Terminated, Terminating-->Reset(Created) + * + * @param clusterId id of the cluster + */ public void onMemberTermination(final String clusterId) { Runnable group = new Runnable() { public void run() { @@ -141,6 +148,12 @@ public class StatusChecker { } + /** + * Calculate whether the cluster is active based on the minimum count available in each partition + * + * @param monitor Cluster monitor which has the member + * @return whether cluster is active or not + */ private boolean clusterActive(VMClusterMonitor monitor) { boolean clusterActive = false; for (NetworkPartitionContext networkPartitionContext : monitor.getNetworkPartitionCtxts().values()) { @@ -152,8 +165,7 @@ public class StatusChecker { log.info("cluster already activated..."); clusterActive = true; } else { - clusterActive = false; - return clusterActive; + return false; } } } @@ -175,7 +187,9 @@ public class StatusChecker { } /** - * @param clusterId + * This will calculate the status of the cluster upon a member fault event + * + * @param clusterId id of the cluster * @param partitionId is to decide in which partition has less members while others have active members */ public void onMemberFaultEvent(final String clusterId, final String partitionId) { @@ -271,9 +285,7 @@ public class StatusChecker { */ private boolean updateChildStatus(String appId, String id, Map<String, Group> groups, Map<String, ClusterDataHolder> clusterData, ParentComponent parent) { - ClusterStatus clusterStatus; - GroupStatus groupStatus; - boolean childFound = false; + boolean childFound; boolean clusterFound = false; for (ClusterDataHolder clusterDataHolder : clusterData.values()) {
