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/12/12 14:54:13 UTC
stratos git commit: Rename classes s/InActive/Inactive
Repository: stratos
Updated Branches:
refs/heads/4.1.0-test 56145f105 -> 3bed802ce
Rename classes s/InActive/Inactive
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/3bed802c
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/3bed802c
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/3bed802c
Branch: refs/heads/4.1.0-test
Commit: 3bed802ce7a3d9a7be5e42641a477e8f5426eb2e
Parents: 56145f1
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Fri Dec 12 19:25:50 2014 +0530
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Fri Dec 12 19:26:11 2014 +0530
----------------------------------------------------------------------
.../cluster/ClusterStatusInActiveProcessor.java | 108 -----------
.../cluster/ClusterStatusInactiveProcessor.java | 108 +++++++++++
.../group/GroupStatusInActiveProcessor.java | 180 -------------------
.../group/GroupStatusInactiveProcessor.java | 180 +++++++++++++++++++
4 files changed, 288 insertions(+), 288 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/3bed802c/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/processor/cluster/ClusterStatusInActiveProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/processor/cluster/ClusterStatusInActiveProcessor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/processor/cluster/ClusterStatusInActiveProcessor.java
deleted file mode 100644
index 852beb3..0000000
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/processor/cluster/ClusterStatusInActiveProcessor.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.stratos.autoscaler.status.processor.cluster;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.autoscaler.context.AutoscalerContext;
-import org.apache.stratos.autoscaler.context.cluster.ClusterInstanceContext;
-import org.apache.stratos.autoscaler.context.partition.network.ClusterLevelNetworkPartitionContext;
-import org.apache.stratos.autoscaler.event.publisher.ClusterStatusEventPublisher;
-import org.apache.stratos.autoscaler.monitor.cluster.VMClusterMonitor;
-import org.apache.stratos.autoscaler.status.processor.StatusProcessor;
-
-/**
- * Cluster inactive checking processor
- */
-public class ClusterStatusInactiveProcessor extends ClusterStatusProcessor {
- private static final Log log = LogFactory.getLog(ClusterStatusInactiveProcessor.class);
- private ClusterStatusProcessor nextProcessor;
-
- @Override
- public void setNext(StatusProcessor nextProcessor) {
- this.nextProcessor = (ClusterStatusProcessor) nextProcessor;
- }
- @Override
- public boolean process(String type, String clusterId, String instanceId) {
- boolean statusChanged;
- if (type == null || (ClusterStatusInactiveProcessor.class.getName().equals(type))) {
- statusChanged = doProcess(clusterId, instanceId);
- if (statusChanged) {
- return statusChanged;
- }
-
- } else {
- if (nextProcessor != null) {
- // ask the next processor to take care of the message.
- return nextProcessor.process(type, clusterId, instanceId);
- } else {
-
- log.warn(String.format("No possible state change found for [type] %s [cluster] %s [instance]",
- type, clusterId, instanceId));
- }
- }
- return false;
- }
-
- private boolean doProcess(String clusterId, String instanceId) {
- VMClusterMonitor monitor = (VMClusterMonitor) AutoscalerContext.getInstance().
- getClusterMonitor(clusterId);
-
- boolean clusterInactive;
- clusterInactive = getClusterInactive(instanceId, monitor);
- if(clusterInactive) {
- //if the monitor is dependent, temporarily pausing it
- if (monitor.hasStartupDependents()) {
- monitor.setHasFaultyMember(true);
- }
- if (log.isInfoEnabled()) {
- log.info("Publishing Cluster inactivate event for [application]: "
- + monitor.getAppId() + " [cluster]: " + clusterId);
- }
- //send cluster In-Active event to cluster status topic
- ClusterStatusEventPublisher.sendClusterInactivateEvent(monitor.getAppId(),
- monitor.getServiceId(), clusterId, instanceId);
- }
- return clusterInactive;
- }
-
- private boolean getClusterInactive(String instanceId, VMClusterMonitor monitor) {
- boolean clusterInactive = false;
- for (ClusterLevelNetworkPartitionContext clusterLevelNetworkPartitionContext :
- monitor.getAllNetworkPartitionCtxts().values()) {
- ClusterInstanceContext instanceContext = clusterLevelNetworkPartitionContext.
- getClusterInstanceContext(instanceId);
- if(instanceContext != null) {
- if(instanceContext.getActiveMembers() < instanceContext.getMinInstanceCount()) {
- clusterInactive = true;
- break;
- } else {
- clusterInactive = false;
- break;
- }
- } else {
- clusterInactive = false;
- break;
- }
-
-
- }
- return clusterInactive;
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/3bed802c/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/processor/cluster/ClusterStatusInactiveProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/processor/cluster/ClusterStatusInactiveProcessor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/processor/cluster/ClusterStatusInactiveProcessor.java
new file mode 100644
index 0000000..852beb3
--- /dev/null
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/processor/cluster/ClusterStatusInactiveProcessor.java
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.stratos.autoscaler.status.processor.cluster;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.autoscaler.context.AutoscalerContext;
+import org.apache.stratos.autoscaler.context.cluster.ClusterInstanceContext;
+import org.apache.stratos.autoscaler.context.partition.network.ClusterLevelNetworkPartitionContext;
+import org.apache.stratos.autoscaler.event.publisher.ClusterStatusEventPublisher;
+import org.apache.stratos.autoscaler.monitor.cluster.VMClusterMonitor;
+import org.apache.stratos.autoscaler.status.processor.StatusProcessor;
+
+/**
+ * Cluster inactive checking processor
+ */
+public class ClusterStatusInactiveProcessor extends ClusterStatusProcessor {
+ private static final Log log = LogFactory.getLog(ClusterStatusInactiveProcessor.class);
+ private ClusterStatusProcessor nextProcessor;
+
+ @Override
+ public void setNext(StatusProcessor nextProcessor) {
+ this.nextProcessor = (ClusterStatusProcessor) nextProcessor;
+ }
+ @Override
+ public boolean process(String type, String clusterId, String instanceId) {
+ boolean statusChanged;
+ if (type == null || (ClusterStatusInactiveProcessor.class.getName().equals(type))) {
+ statusChanged = doProcess(clusterId, instanceId);
+ if (statusChanged) {
+ return statusChanged;
+ }
+
+ } else {
+ if (nextProcessor != null) {
+ // ask the next processor to take care of the message.
+ return nextProcessor.process(type, clusterId, instanceId);
+ } else {
+
+ log.warn(String.format("No possible state change found for [type] %s [cluster] %s [instance]",
+ type, clusterId, instanceId));
+ }
+ }
+ return false;
+ }
+
+ private boolean doProcess(String clusterId, String instanceId) {
+ VMClusterMonitor monitor = (VMClusterMonitor) AutoscalerContext.getInstance().
+ getClusterMonitor(clusterId);
+
+ boolean clusterInactive;
+ clusterInactive = getClusterInactive(instanceId, monitor);
+ if(clusterInactive) {
+ //if the monitor is dependent, temporarily pausing it
+ if (monitor.hasStartupDependents()) {
+ monitor.setHasFaultyMember(true);
+ }
+ if (log.isInfoEnabled()) {
+ log.info("Publishing Cluster inactivate event for [application]: "
+ + monitor.getAppId() + " [cluster]: " + clusterId);
+ }
+ //send cluster In-Active event to cluster status topic
+ ClusterStatusEventPublisher.sendClusterInactivateEvent(monitor.getAppId(),
+ monitor.getServiceId(), clusterId, instanceId);
+ }
+ return clusterInactive;
+ }
+
+ private boolean getClusterInactive(String instanceId, VMClusterMonitor monitor) {
+ boolean clusterInactive = false;
+ for (ClusterLevelNetworkPartitionContext clusterLevelNetworkPartitionContext :
+ monitor.getAllNetworkPartitionCtxts().values()) {
+ ClusterInstanceContext instanceContext = clusterLevelNetworkPartitionContext.
+ getClusterInstanceContext(instanceId);
+ if(instanceContext != null) {
+ if(instanceContext.getActiveMembers() < instanceContext.getMinInstanceCount()) {
+ clusterInactive = true;
+ break;
+ } else {
+ clusterInactive = false;
+ break;
+ }
+ } else {
+ clusterInactive = false;
+ break;
+ }
+
+
+ }
+ return clusterInactive;
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/3bed802c/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/processor/group/GroupStatusInActiveProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/processor/group/GroupStatusInActiveProcessor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/processor/group/GroupStatusInActiveProcessor.java
deleted file mode 100644
index 37781a0..0000000
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/processor/group/GroupStatusInActiveProcessor.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.stratos.autoscaler.status.processor.group;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.autoscaler.applications.ApplicationHolder;
-import org.apache.stratos.autoscaler.applications.topic.ApplicationBuilder;
-import org.apache.stratos.autoscaler.status.processor.StatusProcessor;
-import org.apache.stratos.messaging.domain.applications.*;
-import org.apache.stratos.messaging.domain.instance.ClusterInstance;
-import org.apache.stratos.messaging.domain.instance.GroupInstance;
-import org.apache.stratos.messaging.domain.topology.Cluster;
-import org.apache.stratos.messaging.domain.topology.ClusterStatus;
-import org.apache.stratos.messaging.domain.topology.Service;
-import org.apache.stratos.messaging.message.receiver.topology.TopologyManager;
-
-import java.util.Map;
-
-/**
- * Cluster active status processor
- */
-public class GroupStatusInactiveProcessor extends GroupStatusProcessor {
- private static final Log log = LogFactory.getLog(GroupStatusInactiveProcessor.class);
- private GroupStatusProcessor nextProcessor;
-
- @Override
- public void setNext(StatusProcessor nextProcessor) {
- this.nextProcessor = (GroupStatusProcessor) nextProcessor;
- }
-
- @Override
- public boolean process(String idOfComponent, String appId,
- String instanceId) {
- boolean statusChanged;
- statusChanged = doProcess(idOfComponent, appId, instanceId);
- if (statusChanged) {
- return statusChanged;
- }
-
- if (nextProcessor != null) {
- // ask the next processor to take care of the message.
- return nextProcessor.process(idOfComponent, appId, instanceId);
- } else {
-
- log.warn(String.format("No possible state change found for [component] %s [instance]",
- idOfComponent, instanceId));
- }
- return false;
- }
-
-
- private boolean doProcess(String idOfComponent, String appId, String instanceId) {
- ParentComponent component;
- Map<String, Group> groups;
- Map<String, ClusterDataHolder> clusterData;
-
- if (log.isInfoEnabled()) {
- log.info("StatusChecker calculating the status for the group [ " + idOfComponent + " ]");
- }
-
- try {
- ApplicationHolder.acquireWriteLock();
- if (idOfComponent.equals(appId)) {
- //it is an application
- component = ApplicationHolder.getApplications().
- getApplication(appId);
- } else {
- //it is a group
- component = ApplicationHolder.getApplications().
- getApplication(appId).getGroupRecursively(idOfComponent);
- }
- //finding all the children of the application/group
- groups = component.getAliasToGroupMap();
- clusterData = component.getClusterDataMap();
-
- if (groups.isEmpty() && getAllClusterInactive(clusterData, instanceId) ||
- clusterData.isEmpty() && getAllGroupInactive(groups, instanceId) ||
- getAllClusterInactive(clusterData, instanceId) || getAllGroupInactive(groups, instanceId)) {
- //send the in activation event
- if (component instanceof Application) {
- //send application activated event
- log.warn("Sending application instance in-active for [Application] " + appId +
- " [ApplicationInstance] " + instanceId);
- ApplicationBuilder.handleApplicationInstanceInactivateEvent(appId, instanceId);
-
- return true;
- //ApplicationBuilder.handleApp(appId);
- } else if (component instanceof Group) {
- //send activation to the parent
- if (((Group) component).getStatus(instanceId) != GroupStatus.Inactive) {
- log.info("sending group inactive: " + component.getUniqueIdentifier());
- ApplicationBuilder.handleGroupInactivateEvent(appId, component.getUniqueIdentifier(), instanceId);
- return true;
- }
- }
- }
-
-
- } finally {
- ApplicationHolder.releaseWriteLock();
-
- }
-
-
- return false;
- }
-
-
- /**
- * Find out whether any of the clusters of a group in the Inactive state
- *
- * @param clusterData clusters of the group
- * @return whether inactive or not
- */
-
- private boolean getAllClusterInactive(Map<String, ClusterDataHolder> clusterData, String instanceId) {
- boolean clusterStat = false;
- for (Map.Entry<String, ClusterDataHolder> clusterDataHolderEntry : clusterData.entrySet()) {
- Service service = TopologyManager.getTopology().getService(clusterDataHolderEntry.getValue().getServiceType());
- Cluster cluster = service.getCluster(clusterDataHolderEntry.getValue().getClusterId());
- ClusterInstance context = cluster.getInstanceContexts(instanceId);
- if (context != null) {
- if (context.getStatus() == ClusterStatus.Inactive) {
- clusterStat = true;
- return clusterStat;
- } else {
- clusterStat = false;
-
- }
- } else {
- clusterStat = false;
- }
-
- }
- return clusterStat;
- }
-
-
- /**
- * Find out whether all the any group is inactive
- *
- * @param groups groups of a group/application
- * @return whether inactive or not
- */
- private boolean getAllGroupInactive(Map<String, Group> groups, String instanceId) {
- boolean groupStat = false;
- for (Group group : groups.values()) {
- GroupInstance context = group.getInstanceContexts(instanceId);
- if (context != null) {
- if (context.getStatus() == GroupStatus.Inactive) {
- groupStat = true;
- return groupStat;
- } else {
- groupStat = false;
- }
- //TODO get by parent
- } else {
- groupStat = false;
- }
- }
- return groupStat;
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/3bed802c/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/processor/group/GroupStatusInactiveProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/processor/group/GroupStatusInactiveProcessor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/processor/group/GroupStatusInactiveProcessor.java
new file mode 100644
index 0000000..37781a0
--- /dev/null
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/processor/group/GroupStatusInactiveProcessor.java
@@ -0,0 +1,180 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.stratos.autoscaler.status.processor.group;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.autoscaler.applications.ApplicationHolder;
+import org.apache.stratos.autoscaler.applications.topic.ApplicationBuilder;
+import org.apache.stratos.autoscaler.status.processor.StatusProcessor;
+import org.apache.stratos.messaging.domain.applications.*;
+import org.apache.stratos.messaging.domain.instance.ClusterInstance;
+import org.apache.stratos.messaging.domain.instance.GroupInstance;
+import org.apache.stratos.messaging.domain.topology.Cluster;
+import org.apache.stratos.messaging.domain.topology.ClusterStatus;
+import org.apache.stratos.messaging.domain.topology.Service;
+import org.apache.stratos.messaging.message.receiver.topology.TopologyManager;
+
+import java.util.Map;
+
+/**
+ * Cluster active status processor
+ */
+public class GroupStatusInactiveProcessor extends GroupStatusProcessor {
+ private static final Log log = LogFactory.getLog(GroupStatusInactiveProcessor.class);
+ private GroupStatusProcessor nextProcessor;
+
+ @Override
+ public void setNext(StatusProcessor nextProcessor) {
+ this.nextProcessor = (GroupStatusProcessor) nextProcessor;
+ }
+
+ @Override
+ public boolean process(String idOfComponent, String appId,
+ String instanceId) {
+ boolean statusChanged;
+ statusChanged = doProcess(idOfComponent, appId, instanceId);
+ if (statusChanged) {
+ return statusChanged;
+ }
+
+ if (nextProcessor != null) {
+ // ask the next processor to take care of the message.
+ return nextProcessor.process(idOfComponent, appId, instanceId);
+ } else {
+
+ log.warn(String.format("No possible state change found for [component] %s [instance]",
+ idOfComponent, instanceId));
+ }
+ return false;
+ }
+
+
+ private boolean doProcess(String idOfComponent, String appId, String instanceId) {
+ ParentComponent component;
+ Map<String, Group> groups;
+ Map<String, ClusterDataHolder> clusterData;
+
+ if (log.isInfoEnabled()) {
+ log.info("StatusChecker calculating the status for the group [ " + idOfComponent + " ]");
+ }
+
+ try {
+ ApplicationHolder.acquireWriteLock();
+ if (idOfComponent.equals(appId)) {
+ //it is an application
+ component = ApplicationHolder.getApplications().
+ getApplication(appId);
+ } else {
+ //it is a group
+ component = ApplicationHolder.getApplications().
+ getApplication(appId).getGroupRecursively(idOfComponent);
+ }
+ //finding all the children of the application/group
+ groups = component.getAliasToGroupMap();
+ clusterData = component.getClusterDataMap();
+
+ if (groups.isEmpty() && getAllClusterInactive(clusterData, instanceId) ||
+ clusterData.isEmpty() && getAllGroupInactive(groups, instanceId) ||
+ getAllClusterInactive(clusterData, instanceId) || getAllGroupInactive(groups, instanceId)) {
+ //send the in activation event
+ if (component instanceof Application) {
+ //send application activated event
+ log.warn("Sending application instance in-active for [Application] " + appId +
+ " [ApplicationInstance] " + instanceId);
+ ApplicationBuilder.handleApplicationInstanceInactivateEvent(appId, instanceId);
+
+ return true;
+ //ApplicationBuilder.handleApp(appId);
+ } else if (component instanceof Group) {
+ //send activation to the parent
+ if (((Group) component).getStatus(instanceId) != GroupStatus.Inactive) {
+ log.info("sending group inactive: " + component.getUniqueIdentifier());
+ ApplicationBuilder.handleGroupInactivateEvent(appId, component.getUniqueIdentifier(), instanceId);
+ return true;
+ }
+ }
+ }
+
+
+ } finally {
+ ApplicationHolder.releaseWriteLock();
+
+ }
+
+
+ return false;
+ }
+
+
+ /**
+ * Find out whether any of the clusters of a group in the Inactive state
+ *
+ * @param clusterData clusters of the group
+ * @return whether inactive or not
+ */
+
+ private boolean getAllClusterInactive(Map<String, ClusterDataHolder> clusterData, String instanceId) {
+ boolean clusterStat = false;
+ for (Map.Entry<String, ClusterDataHolder> clusterDataHolderEntry : clusterData.entrySet()) {
+ Service service = TopologyManager.getTopology().getService(clusterDataHolderEntry.getValue().getServiceType());
+ Cluster cluster = service.getCluster(clusterDataHolderEntry.getValue().getClusterId());
+ ClusterInstance context = cluster.getInstanceContexts(instanceId);
+ if (context != null) {
+ if (context.getStatus() == ClusterStatus.Inactive) {
+ clusterStat = true;
+ return clusterStat;
+ } else {
+ clusterStat = false;
+
+ }
+ } else {
+ clusterStat = false;
+ }
+
+ }
+ return clusterStat;
+ }
+
+
+ /**
+ * Find out whether all the any group is inactive
+ *
+ * @param groups groups of a group/application
+ * @return whether inactive or not
+ */
+ private boolean getAllGroupInactive(Map<String, Group> groups, String instanceId) {
+ boolean groupStat = false;
+ for (Group group : groups.values()) {
+ GroupInstance context = group.getInstanceContexts(instanceId);
+ if (context != null) {
+ if (context.getStatus() == GroupStatus.Inactive) {
+ groupStat = true;
+ return groupStat;
+ } else {
+ groupStat = false;
+ }
+ //TODO get by parent
+ } else {
+ groupStat = false;
+ }
+ }
+ return groupStat;
+ }
+}