Repository: stratos Updated Branches: refs/heads/stratos-4.1.x c0fdd4ac9 -> 9c051e45e
removing the unused class Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/9c051e45 Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/9c051e45 Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/9c051e45 Branch: refs/heads/stratos-4.1.x Commit: 9c051e45e2eb3b5a7ec3d06dd7292d8bc497b3d5 Parents: c0fdd4a Author: reka <[email protected]> Authored: Wed Sep 2 14:59:37 2015 +0530 Committer: reka <[email protected]> Committed: Wed Sep 2 14:59:37 2015 +0530 ---------------------------------------------------------------------- .../group/GroupStatusTerminatingProcessor.java | 119 ------------------- 1 file changed, 119 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/9c051e45/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/processor/group/GroupStatusTerminatingProcessor.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/processor/group/GroupStatusTerminatingProcessor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/processor/group/GroupStatusTerminatingProcessor.java deleted file mode 100644 index 4be8aba..0000000 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/processor/group/GroupStatusTerminatingProcessor.java +++ /dev/null @@ -1,119 +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.application.*; -import org.apache.stratos.messaging.domain.topology.ClusterStatus; - -import java.util.Map; - -/** - * Cluster terminating status processor - */ -public class GroupStatusTerminatingProcessor extends GroupStatusProcessor { - private static final Log log = LogFactory.getLog(GroupStatusTerminatingProcessor.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 true; - } - - 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] %s", - idOfComponent, instanceId)); - } - return false; - } - - @SuppressWarnings("unchecked") - private boolean doProcess(String idOfComponent, String appId, String instanceId) { - ParentComponent component; - Map<String, Group> groups; - Map<String, ClusterDataHolder> clusterData; - - if (log.isDebugEnabled()) { - log.debug("StatusChecker calculating the terminating status for the group " + - "[ " + idOfComponent + " ] " + " for the instance " + " [ " + instanceId + " ]"); - } - - try { - ApplicationHolder.acquireWriteLock(); - - Application application = ApplicationHolder.getApplications(). - getApplication(appId); - component = application; - if (!idOfComponent.equals(appId)) { - //it is an application - component = application.getGroupRecursively(idOfComponent); - } - - //finding all the children of the application/group - groups = component.getAliasToGroupMap(); - clusterData = component.getClusterDataMap(); - - if (groups.isEmpty() && - getAllClusterInSameState(clusterData, ClusterStatus.Terminating, instanceId) || - clusterData.isEmpty() && - getAllGroupInSameState(groups, GroupStatus.Terminating, instanceId) || - getAllClusterInSameState(clusterData, ClusterStatus.Terminating, instanceId) && - getAllGroupInSameState(groups, GroupStatus.Terminating, instanceId)) { - //send the terminating event - if (component instanceof Application) { - log.info("Sending application instance terminating for [application] " - + appId + " and for " + " [instance] " + instanceId); - ApplicationBuilder.handleApplicationInstanceTerminatedEvent(appId, instanceId); - return true; - } else { - //send activation to the parent - log.info("Sending group terminating for [group] " + - component.getUniqueIdentifier() + " and for [instance] " - + instanceId); - ApplicationBuilder.handleGroupTerminatingEvent(appId, - component.getUniqueIdentifier(), instanceId); - return true; - } - } - } finally { - ApplicationHolder.releaseWriteLock(); - - } - return false; - } - - -}
