Repository: stratos Updated Branches: refs/heads/master 9f2a410b4 -> ed90b71b8
removing unused classes and methods Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/ed90b71b Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/ed90b71b Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/ed90b71b Branch: refs/heads/master Commit: ed90b71b8fe652124d5948dfa7eafe5e628f4df7 Parents: 9f2a410 Author: R-Rajkumar <[email protected]> Authored: Sat Mar 7 00:20:12 2015 +0530 Committer: R-Rajkumar <[email protected]> Committed: Sat Mar 7 00:20:12 2015 +0530 ---------------------------------------------------------------------- .../WeightedOneAfterAnotherAlgorithm.java | 31 ------- .../internal/AutoscalerServiceComponent.java | 2 - .../monitor/cluster/ClusterMonitor.java | 25 ----- .../monitor/component/ApplicationMonitor.java | 96 -------------------- .../autoscaler/registry/RegistryManager.java | 34 ------- .../autoscaler/util/AutoscalerConstants.java | 1 - .../stratos/autoscaler/util/AutoscalerUtil.java | 15 --- .../common/constants/StratosConstants.java | 1 - 8 files changed, 205 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/ed90b71b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithms/networkpartition/WeightedOneAfterAnotherAlgorithm.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithms/networkpartition/WeightedOneAfterAnotherAlgorithm.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithms/networkpartition/WeightedOneAfterAnotherAlgorithm.java deleted file mode 100644 index 5cea03a..0000000 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithms/networkpartition/WeightedOneAfterAnotherAlgorithm.java +++ /dev/null @@ -1,31 +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.algorithms.networkpartition; - -import java.util.List; - -import org.apache.stratos.autoscaler.algorithms.NetworkPartitionAlgorithm; - -public class WeightedOneAfterAnotherAlgorithm implements NetworkPartitionAlgorithm{ - - @Override - public List<String> getNextNetworkPartitions(NetworkPartitionAlgorithmContext cloudBurstAlgorithmContext) { - return null; - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/ed90b71b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/internal/AutoscalerServiceComponent.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/internal/AutoscalerServiceComponent.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/internal/AutoscalerServiceComponent.java index 3cd11ce..3929853 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/internal/AutoscalerServiceComponent.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/internal/AutoscalerServiceComponent.java @@ -37,7 +37,6 @@ import org.apache.stratos.autoscaler.status.processor.group.GroupStatusProcessor import org.apache.stratos.autoscaler.util.AutoscalerConstants; import org.apache.stratos.autoscaler.util.ConfUtil; import org.apache.stratos.autoscaler.util.ServiceReferenceHolder; -import org.apache.stratos.cloud.controller.stub.domain.Partition; import org.apache.stratos.common.clustering.DistributedObjectProvider; import org.apache.stratos.common.threading.StratosThreadPool; import org.osgi.service.component.ComponentContext; @@ -50,7 +49,6 @@ import com.hazelcast.core.HazelcastInstance; import java.util.Iterator; import java.util.List; -import java.util.Map; import java.util.concurrent.ExecutorService; /** http://git-wip-us.apache.org/repos/asf/stratos/blob/ed90b71b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java index 970e3a7..dfaa582 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java @@ -31,7 +31,6 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; -import org.apache.axis2.AxisFault; import org.apache.commons.configuration.XMLConfiguration; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; @@ -329,30 +328,6 @@ public class ClusterMonitor extends Monitor implements Runnable { this.hasFaultyMember = hasFaultyMember; } - /*public void addClusterContextForInstance (String instanceId, AbstractClusterContext clusterContext) { - - if (instanceIdToClusterContextMap.get(instanceId) == null) { - synchronized (instanceIdToClusterContextMap) { - if (instanceIdToClusterContextMap.get(instanceId) == null) { - instanceIdToClusterContextMap.put(instanceId, clusterContext); - } else { - log.warn("ClusterContext for already exists for cluster instance id: " + instanceId + - ", service type: " + serviceType + ", cluster id: " + clusterId); - } - } - } else { - log.warn("ClusterContext for already exists for cluster instance id: " + instanceId + - ", service type: " + serviceType + ", cluster id: " + clusterId); - } - } - - public AbstractClusterContext getClusterContext (String instanceId) { - - // if instanceId is null, assume that map contains only one element and return that - - return instanceIdToClusterContextMap.get(instanceId); - }*/ - public boolean isStop() { return stop; } http://git-wip-us.apache.org/repos/asf/stratos/blob/ed90b71b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/ApplicationMonitor.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/ApplicationMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/ApplicationMonitor.java index c3f3ff1..4b27f48 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/ApplicationMonitor.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/ApplicationMonitor.java @@ -24,7 +24,6 @@ import org.apache.stratos.autoscaler.algorithms.NetworkPartitionAlgorithm; import org.apache.stratos.autoscaler.algorithms.networkpartition.AllAtOnceAlgorithm; import org.apache.stratos.autoscaler.algorithms.networkpartition.NetworkPartitionAlgorithmContext; import org.apache.stratos.autoscaler.algorithms.networkpartition.OneAfterAnotherAlgorithm; -import org.apache.stratos.autoscaler.algorithms.networkpartition.WeightedOneAfterAnotherAlgorithm; import org.apache.stratos.autoscaler.applications.ApplicationHolder; import org.apache.stratos.autoscaler.applications.topic.ApplicationBuilder; import org.apache.stratos.autoscaler.context.AutoscalerContext; @@ -359,58 +358,10 @@ public class ApplicationMonitor extends ParentComponentMonitor { networkPartitionIds + " [appInstanceId] " + instanceId); } -// for (ApplicationPolicyNetworkPartitionReference -// appPolicyNetworkPartition : getNetworkPartitionReferences(application.getApplicationPolicyId())) { -// if(appPolicyNetworkPartition.isActiveByDefault()) { -// ApplicationLevelNetworkPartitionContext context = -// new ApplicationLevelNetworkPartitionContext(appPolicyNetworkPartition.getNetworkPartitionId()); -// //If application instances found in the ApplicationsTopology, -// // then have to add them first before creating new one -// ApplicationInstance appInstance = (ApplicationInstance) application. -// getInstanceByNetworkPartitionId(context.getId()); -// if (appInstance != null) { -// //use the existing instance in the Topology to create the data -// instanceId = handleApplicationInstanceCreation(application, context, appInstance); -// initialStartup = false; -// } else { -// //create new app instance as it doesn't exist in the Topology -// instanceId = handleApplicationInstanceCreation(application, context, null); -// -// } -// instanceIds.add(instanceId); -// log.info("Application instance has been added for the [network partition] " + -// appPolicyNetworkPartition.getNetworkPartitionId() + " [appInstanceId] " + instanceId); -// -// } -// } - - -// } startDependency(application, instanceIds); return initialStartup; } -// private ApplicationPolicyNetworkPartitionReference[] getNetworkPartitionReferences( -// String applicationPolicyId) throws PolicyValidationException { -// -// ApplicationPolicy applicationPolicy = PolicyManager.getInstance().getApplicationPolicy(applicationPolicyId); -// -// if(applicationPolicy == null) { -// String msg = String.format("Application policy is not found [application-policy-id] %s [application-id] %s", applicationPolicyId, appId); -// log.error(msg); -// throw new PolicyValidationException(msg); -// } -// ApplicationPolicyNetworkPartitionReference[] npReference = applicationPolicy.getNetworkPartitionReferences(); -// -// if(npReference == null || npReference.length <= 0) { -// String msg = "Network partition references cannot be found in application policy "+ applicationPolicy+ " is not found " -// + "for application ["+ applicationPolicyId + "] "; -// log.error(msg); -// throw new PolicyValidationException(msg); -// } -// return npReference; -// } - private String handleApplicationInstanceCreation(Application application, ApplicationLevelNetworkPartitionContext context, ApplicationInstance instanceExist) { @@ -498,34 +449,6 @@ public class ApplicationMonitor extends ParentComponentMonitor { } } -// for (ApplicationPolicyNetworkPartitionReference -// appPolicyNetworkPartition : getNetworkPartitionReferences(application.getApplicationPolicyId())) { -// //Checking whether any not active NP found -// if (!appPolicyNetworkPartition.isActiveByDefault()) { -// -// if (!this.networkPartitionCtxts.containsKey(appPolicyNetworkPartition.getNetworkPartitionId())) { -// -// ApplicationLevelNetworkPartitionContext context = -// new ApplicationLevelNetworkPartitionContext(appPolicyNetworkPartition.getNetworkPartitionId()); -// -// //Setting flags saying that it has been created by burst -// context.setCreatedOnBurst(true); -// ApplicationInstance appInstance = (ApplicationInstance) application. -// getInstanceByNetworkPartitionId(context.getId()); -// -// if (appInstance == null) { -// instanceId = handleApplicationInstanceCreation(application, context, null); -// } else { -// log.warn("The Network partition is already associated with an " + -// "[ApplicationInstance] " + appInstance.getInstanceId() + -// "in the ApplicationsTopology. Hence not creating new AppInstance."); -// instanceId = handleApplicationInstanceCreation(application, context, appInstance); -// } -// burstNPFound = true; -// } -// } -// } -// } if (!burstNPFound) { log.warn("[Application] " + appId + " cannot be burst as no available resources found"); } else { @@ -533,23 +456,6 @@ public class ApplicationMonitor extends ParentComponentMonitor { } } -// private DeploymentPolicy getDeploymentPolicy(Application application) throws PolicyValidationException { -// String deploymentPolicyName = application.getDeploymentPolicy(); -// DeploymentPolicy deploymentPolicy = PolicyManager.getInstance(). -// getDeploymentPolicyByApplication(application.getUniqueIdentifier()); -// if (deploymentPolicyName != null) { -// deploymentPolicy = PolicyManager.getInstance() -// .getDeploymentPolicy(deploymentPolicyName); -// if (deploymentPolicy == null) { -// String msg = "Deployment policy is null: [policy-name] " + deploymentPolicyName; -// log.error(msg); -// throw new PolicyValidationException(msg); -// } -// } -// -// return deploymentPolicy; -// } - private ApplicationInstance createApplicationInstance(Application application, String networkPartitionId) { //String instanceId = this.generateInstanceId(application); ApplicationInstance instance = ApplicationBuilder.handleApplicationInstanceCreatedEvent( @@ -584,8 +490,6 @@ public class ApplicationMonitor extends ParentComponentMonitor { if (algorithmName.equals(StratosConstants.NETWORK_PARTITION_ONE_AFTER_ANOTHER_ALGORITHM_ID)) { return new OneAfterAnotherAlgorithm(); - } else if (algorithmName.equals(StratosConstants.NETWORK_PARTITION_WEIGHTED_ONE_AFTER_ANOTHER_ALGORITHM_ID)) { - return new WeightedOneAfterAnotherAlgorithm(); } else if (algorithmName.equals(StratosConstants.NETWORK_PARTITION_ALL_AT_ONCE_ALGORITHM_ID)) { return new AllAtOnceAlgorithm(); } http://git-wip-us.apache.org/repos/asf/stratos/blob/ed90b71b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java index a9a0b7b..3f770cb 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java @@ -34,7 +34,6 @@ import org.apache.stratos.autoscaler.util.AutoscalerConstants; import org.apache.stratos.autoscaler.util.Deserializer; import org.apache.stratos.autoscaler.util.Serializer; import org.apache.stratos.autoscaler.util.ServiceReferenceHolder; -import org.apache.stratos.cloud.controller.stub.domain.Partition; import org.apache.stratos.messaging.domain.application.Application; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.registry.core.Registry; @@ -355,39 +354,6 @@ public class RegistryManager { return this.retrieve(resourcePath) != null; } - public List<Partition> retrievePartitions() { - List<Partition> partitionList = new ArrayList<Partition>(); - RegistryManager registryManager = RegistryManager.getInstance(); - String[] partitionsResourceList = (String[]) registryManager.retrieve(AutoscalerConstants.AUTOSCALER_RESOURCE + AutoscalerConstants.PARTITION_RESOURCE); - - if (partitionsResourceList != null) { - Partition partition; - for (String resourcePath : partitionsResourceList) { - Object serializedObj = registryManager.retrieve(resourcePath); - if (serializedObj != null) { - try { - - Object dataObj = Deserializer.deserializeFromByteArray((byte[]) serializedObj); - if (dataObj instanceof Partition) { - partition = (Partition) dataObj; - if (log.isDebugEnabled()) { - log.debug(String.format("Partition read from registry: [id] %s [provider] %s [min] %d [max] %d", - partition.getId(), partition.getProvider())); - } - partitionList.add(partition); - } else { - return null; - } - } catch (Exception e) { - String msg = "Unable to retrieve data from Registry. Hence, any historical partitions will not get reflected."; - log.warn(msg, e); - } - } - } - } - return partitionList; - } - public List<AutoscalePolicy> retrieveASPolicies() { List<AutoscalePolicy> asPolicyList = new ArrayList<AutoscalePolicy>(); RegistryManager registryManager = RegistryManager.getInstance(); http://git-wip-us.apache.org/repos/asf/stratos/blob/ed90b71b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerConstants.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerConstants.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerConstants.java index f7e6370..f5d74fc 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerConstants.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerConstants.java @@ -43,7 +43,6 @@ public final class AutoscalerConstants { * Persistence */ public static final String AUTOSCALER_RESOURCE = "/autoscaler"; - public static final String PARTITION_RESOURCE = "/partitions"; public static final String AS_POLICY_RESOURCE = "/policies/autoscalingPolicies"; public static final String APPLICATIONS_RESOURCE = "/applications"; public static final String APPLICATION_CONTEXTS_RESOURCE = "/applicationContexts"; http://git-wip-us.apache.org/repos/asf/stratos/blob/ed90b71b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java index 89f9c63..59cce01 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java @@ -606,10 +606,6 @@ public class AutoscalerUtil { throw new InvalidApplicationPolicyException(msg); } - // to count the number of network partitions which are active by default - // if the count is 0, we should raise the error -// int activeByDefaultNetworkPartitionsCount = 0; - // validating all network partition references for (String networkPartitionId : networkPartitionIds) { @@ -629,18 +625,7 @@ public class AutoscalerUtil { throw new InvalidApplicationPolicyException(msg); } -// // counting number of network partitions which are active by default -// if (true == applicationPolicyNetworkPartitionReference.isActiveByDefault()) { -// activeByDefaultNetworkPartitionsCount++; -// } } - - // there should be at least one network partition reference which is active by default -// if (activeByDefaultNetworkPartitionsCount == 0) { -// String msg = "Invalid Application Policy. Cause -> No active by default network partitions found"; -// log.error(msg); -// throw new InvalidApplicationPolicyException(msg); -// } } http://git-wip-us.apache.org/repos/asf/stratos/blob/ed90b71b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/constants/StratosConstants.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/constants/StratosConstants.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/constants/StratosConstants.java index 4ca0411..01a9dc7 100644 --- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/constants/StratosConstants.java +++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/constants/StratosConstants.java @@ -200,7 +200,6 @@ public class StratosConstants { public static final String PARTITION_ONE_AFTER_ANOTHER_ALGORITHM_ID = "one-after-another"; // network partition algorithm id constants public static final String NETWORK_PARTITION_ONE_AFTER_ANOTHER_ALGORITHM_ID = "one-after-another"; - public static final String NETWORK_PARTITION_WEIGHTED_ONE_AFTER_ANOTHER_ALGORITHM_ID = "weighted-one-after-another"; public static final String NETWORK_PARTITION_ALL_AT_ONCE_ALGORITHM_ID = "all-at-once"; }
