You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by im...@apache.org on 2015/02/15 18:58:14 UTC

[1/3] stratos git commit: Fixing issue of finding cluster id from application id and subscription alias in stratos manager when application has not initialized

Repository: stratos
Updated Branches:
  refs/heads/master 41b19581d -> c44112c00


Fixing issue of finding cluster id from application id and subscription alias in stratos manager when application has not initialized


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

Branch: refs/heads/master
Commit: 6dce38d447a10a3992864ef6be1d0b896bde621d
Parents: 41b1958
Author: Imesh Gunaratne <im...@apache.org>
Authored: Sun Feb 15 23:16:36 2015 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Sun Feb 15 23:16:36 2015 +0530

----------------------------------------------------------------------
 .../autoscaler/services/AutoscalerService.java  |  15 +-
 .../services/impl/AutoscalerServiceImpl.java    |  19 ++
 .../common/client/AutoscalerServiceClient.java  |   4 +
 .../ArtifactDistributionCoordinator.java        |  44 +--
 .../src/main/resources/AutoscalerService.wsdl   | 308 +++++++++++--------
 5 files changed, 225 insertions(+), 165 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/6dce38d4/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/AutoscalerService.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/AutoscalerService.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/AutoscalerService.java
index f445441..595e393 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/AutoscalerService.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/AutoscalerService.java
@@ -22,14 +22,13 @@
 package org.apache.stratos.autoscaler.services;
 
 import org.apache.stratos.autoscaler.applications.pojo.ApplicationContext;
-import org.apache.stratos.autoscaler.exception.kubernetes.InvalidServiceGroupException;
-import org.apache.stratos.autoscaler.pojo.policy.deployment.DeploymentPolicy;
-import org.apache.stratos.autoscaler.exception.*;
+import org.apache.stratos.autoscaler.exception.InvalidArgumentException;
 import org.apache.stratos.autoscaler.exception.application.ApplicationDefinitionException;
+import org.apache.stratos.autoscaler.exception.kubernetes.InvalidServiceGroupException;
 import org.apache.stratos.autoscaler.exception.policy.InvalidPolicyException;
 import org.apache.stratos.autoscaler.pojo.ServiceGroup;
 import org.apache.stratos.autoscaler.pojo.policy.autoscale.AutoscalePolicy;
-import org.apache.stratos.autoscaler.pojo.policy.deployment.partition.network.ChildLevelNetworkPartition;
+import org.apache.stratos.autoscaler.pojo.policy.deployment.DeploymentPolicy;
 import org.apache.stratos.autoscaler.pojo.policy.deployment.partition.network.NetworkPartition;
 import org.apache.stratos.common.Properties;
 
@@ -175,4 +174,12 @@ public interface AutoscalerService {
      * @return
      */
     public NetworkPartition getNetworkPartition(String networkPartitionId);
+
+    /**
+     * Find cluster id of an application by subscription alias.
+     * @param applicationId
+     * @param alias
+     * @return
+     */
+    public String findClusterId(String applicationId, String alias);
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/6dce38d4/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java
index fa7a96f..ffca22e 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java
@@ -59,6 +59,7 @@ import org.apache.stratos.manager.service.stub.domain.application.signup.Artifac
 import org.apache.stratos.messaging.domain.application.Application;
 import org.apache.stratos.messaging.domain.application.ClusterDataHolder;
 import org.apache.stratos.messaging.domain.application.Group;
+import org.apache.stratos.messaging.message.receiver.application.ApplicationManager;
 import org.apache.stratos.metadata.client.defaults.DefaultMetaDataServiceClient;
 import org.apache.stratos.metadata.client.defaults.MetaDataServiceClient;
 import org.apache.stratos.metadata.client.exception.MetaDataServiceClientException;
@@ -733,6 +734,24 @@ public class AutoscalerServiceImpl implements AutoscalerService {
         }
     }
 
+    @Override
+    public String findClusterId(String applicationId, String alias) {
+        try {
+            Application application = ApplicationManager.getApplications().getApplication(applicationId);
+            if(application != null) {
+                ClusterDataHolder clusterData = application.getClusterData(alias);
+                if(clusterData != null) {
+                    return clusterData.getClusterId();
+                }
+            }
+            return null;
+        } catch (Exception e) {
+            String message = String.format("Could not find cluster id: [application-id] %s [alias] %s",
+                    applicationId, alias);
+            throw new AutoScalerException(message, e);
+        }
+    }
+
     public ServiceGroup[] getServiceGroups() throws AutoScalerException {
         return RegistryManager.getInstance().getServiceGroups();
     }

http://git-wip-us.apache.org/repos/asf/stratos/blob/6dce38d4/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/AutoscalerServiceClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/AutoscalerServiceClient.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/AutoscalerServiceClient.java
index f184f1b..4c22c09 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/AutoscalerServiceClient.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/AutoscalerServiceClient.java
@@ -176,4 +176,8 @@ public class AutoscalerServiceClient {
             throws RemoteException, AutoscalerServiceInvalidArgumentExceptionException {
         stub.updateClusterMonitor(clusterId, properties);
     }
+
+    public String findClusterId(String applicationId, String alias) throws RemoteException {
+        return stub.findClusterId(applicationId, alias);
+    }
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/6dce38d4/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/components/ArtifactDistributionCoordinator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/components/ArtifactDistributionCoordinator.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/components/ArtifactDistributionCoordinator.java
index 96a9191..e996a6f 100644
--- a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/components/ArtifactDistributionCoordinator.java
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/components/ArtifactDistributionCoordinator.java
@@ -22,15 +22,11 @@ package org.apache.stratos.manager.components;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.domain.application.Group;
-import org.apache.stratos.messaging.domain.application.signup.ApplicationSignUp;
-import org.apache.stratos.messaging.domain.application.signup.ArtifactRepository;
+import org.apache.stratos.common.client.AutoscalerServiceClient;
 import org.apache.stratos.manager.exception.ArtifactDistributionCoordinatorException;
 import org.apache.stratos.manager.messaging.publisher.InstanceNotificationPublisher;
-import org.apache.stratos.messaging.domain.application.Application;
-import org.apache.stratos.messaging.domain.application.Applications;
-import org.apache.stratos.messaging.domain.application.ClusterDataHolder;
-import org.apache.stratos.messaging.message.receiver.application.ApplicationManager;
+import org.apache.stratos.messaging.domain.application.signup.ApplicationSignUp;
+import org.apache.stratos.messaging.domain.application.signup.ArtifactRepository;
 
 import java.util.List;
 
@@ -164,33 +160,15 @@ public class ArtifactDistributionCoordinator {
     }
 
     private String findClusterId(String applicationId, String alias) {
-        Applications applications = ApplicationManager.getApplications();
-        if (applications == null) {
-            throw new RuntimeException("Applications not found in application manager");
-        }
-
-        Application application = applications.getApplication(applicationId);
-        if (application == null) {
-            throw new RuntimeException(String.format("Application not found: [application-id] %s", applicationId));
-        }
-
-        ClusterDataHolder clusterData = application.getClusterData(alias);
-
-        if(clusterData == null) {
-	        for(Group group:application.getGroups()){
-		        clusterData=group.getClusterData(alias);
-		        if(clusterData!=null){
-			        break;
-		        }
-	        }
-	        if (clusterData == null) {
-		        throw new RuntimeException(
-				        String.format("Cluster data not found for alias: [application-id] %s [alias] %s",
-				                      applicationId, alias));
-	        }
-
+        try {
+            AutoscalerServiceClient autoscalerServiceClient = AutoscalerServiceClient.getInstance();
+            return autoscalerServiceClient.findClusterId(applicationId, alias);
+        } catch (Exception e) {
+            String message = String.format("Could not find cluster id of alias: [application-id] %s [alias] %s",
+                    applicationId, alias);
+            log.error(message, e);
+            throw new RuntimeException(message, e);
         }
-        return clusterData.getClusterId();
     }
 
     private boolean artifactRepositoriesExist(ApplicationSignUp applicationSignUp) {

http://git-wip-us.apache.org/repos/asf/stratos/blob/6dce38d4/service-stubs/org.apache.stratos.autoscaler.service.stub/src/main/resources/AutoscalerService.wsdl
----------------------------------------------------------------------
diff --git a/service-stubs/org.apache.stratos.autoscaler.service.stub/src/main/resources/AutoscalerService.wsdl b/service-stubs/org.apache.stratos.autoscaler.service.stub/src/main/resources/AutoscalerService.wsdl
index affdd03..7cf765c 100644
--- a/service-stubs/org.apache.stratos.autoscaler.service.stub/src/main/resources/AutoscalerService.wsdl
+++ b/service-stubs/org.apache.stratos.autoscaler.service.stub/src/main/resources/AutoscalerService.wsdl
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ax29="http://deployment.policy.pojo.autoscaler.stratos.apache.org/xsd" xmlns:ns="http://impl.services.autoscaler.stratos.apache.org" xmlns:ax27="http://pojo.autoscaler.stratos.apache.org/xsd" xmlns:ax25="http://application.exception.autoscaler.stratos.apache.org/xsd" xmlns:ax21="http://pojo.applications.autoscaler.stratos.apache.org/xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ax216="http://policy.exception.autoscaler.stratos.apache.org/xsd" xmlns:ax22="http://common.stratos.apache.org/xsd" xmlns:ax218="http://exception.autoscaler.stratos.apache.org/xsd" xmlns:ax214="http://autoscale.policy.pojo.autoscaler.stratos.apache.org/xsd" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ax221="http://kubernetes.exception.autoscaler.stratos.apache.org/xsd" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:ax210="http://network.partition.deployment.policy.pojo.autoscale
 r.stratos.apache.org/xsd" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://impl.services.autoscaler.stratos.apache.org">
+<?xml version="1.0" encoding="UTF-8"?><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ax29="http://autoscale.policy.pojo.autoscaler.stratos.apache.org/xsd" xmlns:ns="http://impl.services.autoscaler.stratos.apache.org" xmlns:ax25="http://common.stratos.apache.org/xsd" xmlns:ax23="http://deployment.policy.pojo.autoscaler.stratos.apache.org/xsd" xmlns:ax24="http://network.partition.deployment.policy.pojo.autoscaler.stratos.apache.org/xsd" xmlns:ax217="http://exception.autoscaler.stratos.apache.org/xsd" xmlns:ax21="http://pojo.autoscaler.stratos.apache.org/xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ax219="http://policy.exception.autoscaler.stratos.apache.org/xsd" xmlns:ax214="http://application.exception.autoscaler.stratos.apache.org/xsd" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ax222="http://kubernetes.exception.autoscaler.stratos.apache.org/xsd" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/htt
 p/" xmlns:ax211="http://pojo.applications.autoscaler.stratos.apache.org/xsd" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://impl.services.autoscaler.stratos.apache.org">
     <wsdl:types>
         <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://autoscale.policy.pojo.autoscaler.stratos.apache.org/xsd">
             <xs:complexType name="AutoscalePolicy">
@@ -8,7 +8,7 @@
                     <xs:element minOccurs="0" name="id" nillable="true" type="xs:string"/>
                     <xs:element minOccurs="0" name="instanceRoundingFactor" type="xs:float"/>
                     <xs:element minOccurs="0" name="isPublic" type="xs:boolean"/>
-                    <xs:element minOccurs="0" name="loadThresholds" nillable="true" type="ax214:LoadThresholds"/>
+                    <xs:element minOccurs="0" name="loadThresholds" nillable="true" type="ax29:LoadThresholds"/>
                     <xs:element minOccurs="0" name="tenantId" type="xs:int"/>
                 </xs:sequence>
             </xs:complexType>
@@ -20,17 +20,17 @@
                 </xs:sequence>
             </xs:complexType>
         </xs:schema>
-        <xs:schema xmlns:ax23="http://common.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://pojo.applications.autoscaler.stratos.apache.org/xsd">
+        <xs:schema xmlns:ax212="http://common.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://pojo.applications.autoscaler.stratos.apache.org/xsd">
             <xs:import namespace="http://common.stratos.apache.org/xsd"/>
             <xs:complexType name="ApplicationContext">
                 <xs:sequence>
                     <xs:element minOccurs="0" name="alias" nillable="true" type="xs:string"/>
                     <xs:element minOccurs="0" name="applicationId" nillable="true" type="xs:string"/>
-                    <xs:element minOccurs="0" name="components" nillable="true" type="ax21:ComponentContext"/>
+                    <xs:element minOccurs="0" name="components" nillable="true" type="ax211:ComponentContext"/>
                     <xs:element minOccurs="0" name="description" nillable="true" type="xs:string"/>
                     <xs:element minOccurs="0" name="multiTenant" type="xs:boolean"/>
                     <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
-                    <xs:element minOccurs="0" name="properties" nillable="true" type="ax23:Properties"/>
+                    <xs:element minOccurs="0" name="properties" nillable="true" type="ax25:Properties"/>
                     <xs:element minOccurs="0" name="status" nillable="true" type="xs:string"/>
                     <xs:element minOccurs="0" name="tenantAdminUsername" nillable="true" type="xs:string"/>
                     <xs:element minOccurs="0" name="tenantDomain" nillable="true" type="xs:string"/>
@@ -39,10 +39,10 @@
             </xs:complexType>
             <xs:complexType name="ComponentContext">
                 <xs:sequence>
-                    <xs:element maxOccurs="unbounded" minOccurs="0" name="applicationClusterContexts" nillable="true" type="ax21:ApplicationClusterContext"/>
-                    <xs:element maxOccurs="unbounded" minOccurs="0" name="cartridgeContexts" nillable="true" type="ax21:CartridgeContext"/>
-                    <xs:element minOccurs="0" name="dependencyContext" nillable="true" type="ax21:DependencyContext"/>
-                    <xs:element maxOccurs="unbounded" minOccurs="0" name="groupContexts" nillable="true" type="ax21:GroupContext"/>
+                    <xs:element maxOccurs="unbounded" minOccurs="0" name="applicationClusterContexts" nillable="true" type="ax211:ApplicationClusterContext"/>
+                    <xs:element maxOccurs="unbounded" minOccurs="0" name="cartridgeContexts" nillable="true" type="ax211:CartridgeContext"/>
+                    <xs:element minOccurs="0" name="dependencyContext" nillable="true" type="ax211:DependencyContext"/>
+                    <xs:element maxOccurs="unbounded" minOccurs="0" name="groupContexts" nillable="true" type="ax211:GroupContext"/>
                 </xs:sequence>
             </xs:complexType>
             <xs:complexType name="ApplicationClusterContext">
@@ -54,7 +54,7 @@
                     <xs:element minOccurs="0" name="deploymentPolicyName" nillable="true" type="xs:string"/>
                     <xs:element minOccurs="0" name="hostName" nillable="true" type="xs:string"/>
                     <xs:element minOccurs="0" name="lbCluster" type="xs:boolean"/>
-                    <xs:element minOccurs="0" name="properties" nillable="true" type="ax23:Properties"/>
+                    <xs:element minOccurs="0" name="properties" nillable="true" type="ax25:Properties"/>
                     <xs:element minOccurs="0" name="tenantRange" nillable="true" type="xs:string"/>
                     <xs:element minOccurs="0" name="textPayload" nillable="true" type="xs:string"/>
                 </xs:sequence>
@@ -63,20 +63,20 @@
                 <xs:sequence>
                     <xs:element minOccurs="0" name="cartridgeMax" type="xs:int"/>
                     <xs:element minOccurs="0" name="cartridgeMin" type="xs:int"/>
-                    <xs:element minOccurs="0" name="subscribableInfoContext" nillable="true" type="ax21:SubscribableInfoContext"/>
+                    <xs:element minOccurs="0" name="subscribableInfoContext" nillable="true" type="ax211:SubscribableInfoContext"/>
                     <xs:element minOccurs="0" name="type" nillable="true" type="xs:string"/>
                 </xs:sequence>
             </xs:complexType>
             <xs:complexType name="SubscribableInfoContext">
                 <xs:sequence>
                     <xs:element minOccurs="0" name="alias" nillable="true" type="xs:string"/>
-                    <xs:element minOccurs="0" name="artifactRepositoryContext" nillable="true" type="ax21:ArtifactRepositoryContext"/>
+                    <xs:element minOccurs="0" name="artifactRepositoryContext" nillable="true" type="ax211:ArtifactRepositoryContext"/>
                     <xs:element minOccurs="0" name="autoscalingPolicy" nillable="true" type="xs:string"/>
                     <xs:element maxOccurs="unbounded" minOccurs="0" name="dependencyAliases" nillable="true" type="xs:string"/>
                     <xs:element minOccurs="0" name="deploymentPolicy" nillable="true" type="xs:string"/>
                     <xs:element minOccurs="0" name="maxMembers" type="xs:int"/>
                     <xs:element minOccurs="0" name="minMembers" type="xs:int"/>
-                    <xs:element minOccurs="0" name="properties" nillable="true" type="ax23:Properties"/>
+                    <xs:element minOccurs="0" name="properties" nillable="true" type="ax25:Properties"/>
                 </xs:sequence>
             </xs:complexType>
             <xs:complexType name="ArtifactRepositoryContext">
@@ -98,8 +98,8 @@
             <xs:complexType name="GroupContext">
                 <xs:sequence>
                     <xs:element minOccurs="0" name="alias" nillable="true" type="xs:string"/>
-                    <xs:element maxOccurs="unbounded" minOccurs="0" name="cartridgeContexts" nillable="true" type="ax21:CartridgeContext"/>
-                    <xs:element maxOccurs="unbounded" minOccurs="0" name="groupContexts" nillable="true" type="ax21:GroupContext"/>
+                    <xs:element maxOccurs="unbounded" minOccurs="0" name="cartridgeContexts" nillable="true" type="ax211:CartridgeContext"/>
+                    <xs:element maxOccurs="unbounded" minOccurs="0" name="groupContexts" nillable="true" type="ax211:GroupContext"/>
                     <xs:element minOccurs="0" name="groupMaxInstances" type="xs:int"/>
                     <xs:element minOccurs="0" name="groupMinInstances" type="xs:int"/>
                     <xs:element minOccurs="0" name="groupScalingEnabled" type="xs:boolean"/>
@@ -111,8 +111,8 @@
             <xs:complexType name="ServiceGroup">
                 <xs:sequence>
                     <xs:element maxOccurs="unbounded" minOccurs="0" name="cartridges" nillable="true" type="xs:string"/>
-                    <xs:element minOccurs="0" name="dependencies" nillable="true" type="ax27:Dependencies"/>
-                    <xs:element maxOccurs="unbounded" minOccurs="0" name="groups" nillable="true" type="ax27:ServiceGroup"/>
+                    <xs:element minOccurs="0" name="dependencies" nillable="true" type="ax21:Dependencies"/>
+                    <xs:element maxOccurs="unbounded" minOccurs="0" name="groups" nillable="true" type="ax21:ServiceGroup"/>
                     <xs:element minOccurs="0" name="groupscalingEnabled" type="xs:boolean"/>
                     <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
                 </xs:sequence>
@@ -125,322 +125,337 @@
                 </xs:sequence>
             </xs:complexType>
         </xs:schema>
-        <xs:schema xmlns:ax28="http://pojo.autoscaler.stratos.apache.org/xsd" xmlns:ax26="http://application.exception.autoscaler.stratos.apache.org/xsd" xmlns:ax24="http://pojo.applications.autoscaler.stratos.apache.org/xsd" xmlns:ax217="http://policy.exception.autoscaler.stratos.apache.org/xsd" xmlns:ax219="http://exception.autoscaler.stratos.apache.org/xsd" xmlns:ax215="http://autoscale.policy.pojo.autoscaler.stratos.apache.org/xsd" xmlns:ax220="http://common.stratos.apache.org/xsd" xmlns:ax222="http://kubernetes.exception.autoscaler.stratos.apache.org/xsd" xmlns:ax213="http://deployment.policy.pojo.autoscaler.stratos.apache.org/xsd" xmlns:ax223="http://network.partition.deployment.policy.pojo.autoscaler.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://impl.services.autoscaler.stratos.apache.org">
-            <xs:import namespace="http://pojo.applications.autoscaler.stratos.apache.org/xsd"/>
-            <xs:import namespace="http://application.exception.autoscaler.stratos.apache.org/xsd"/>
+        <xs:schema xmlns:ax28="http://deployment.policy.pojo.autoscaler.stratos.apache.org/xsd" xmlns:ax216="http://network.partition.deployment.policy.pojo.autoscaler.stratos.apache.org/xsd" xmlns:ax22="http://pojo.autoscaler.stratos.apache.org/xsd" xmlns:ax218="http://exception.autoscaler.stratos.apache.org/xsd" xmlns:ax220="http://policy.exception.autoscaler.stratos.apache.org/xsd" xmlns:ax215="http://application.exception.autoscaler.stratos.apache.org/xsd" xmlns:ax221="http://common.stratos.apache.org/xsd" xmlns:ax213="http://pojo.applications.autoscaler.stratos.apache.org/xsd" xmlns:ax223="http://kubernetes.exception.autoscaler.stratos.apache.org/xsd" xmlns:ax210="http://autoscale.policy.pojo.autoscaler.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://impl.services.autoscaler.stratos.apache.org">
             <xs:import namespace="http://pojo.autoscaler.stratos.apache.org/xsd"/>
             <xs:import namespace="http://deployment.policy.pojo.autoscaler.stratos.apache.org/xsd"/>
             <xs:import namespace="http://autoscale.policy.pojo.autoscaler.stratos.apache.org/xsd"/>
-            <xs:import namespace="http://policy.exception.autoscaler.stratos.apache.org/xsd"/>
+            <xs:import namespace="http://pojo.applications.autoscaler.stratos.apache.org/xsd"/>
+            <xs:import namespace="http://application.exception.autoscaler.stratos.apache.org/xsd"/>
+            <xs:import namespace="http://network.partition.deployment.policy.pojo.autoscaler.stratos.apache.org/xsd"/>
             <xs:import namespace="http://exception.autoscaler.stratos.apache.org/xsd"/>
+            <xs:import namespace="http://policy.exception.autoscaler.stratos.apache.org/xsd"/>
             <xs:import namespace="http://common.stratos.apache.org/xsd"/>
             <xs:import namespace="http://kubernetes.exception.autoscaler.stratos.apache.org/xsd"/>
-            <xs:import namespace="http://network.partition.deployment.policy.pojo.autoscaler.stratos.apache.org/xsd"/>
-            <xs:element name="getApplication">
+            <xs:element name="deleteApplication">
                 <xs:complexType>
                     <xs:sequence>
                         <xs:element minOccurs="0" name="applicationId" nillable="true" type="xs:string"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getApplicationResponse">
+            <xs:element name="getServiceGroup">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="return" nillable="true" type="ax24:ApplicationContext"/>
+                        <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="deleteApplication">
+            <xs:element name="getServiceGroupResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="applicationId" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="return" nillable="true" type="ax21:ServiceGroup"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="AutoscalerServiceApplicationDefinitionException">
+            <xs:element name="getDeploymentPolicy">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="ApplicationDefinitionException" nillable="true" type="ax25:ApplicationDefinitionException"/>
+                        <xs:element minOccurs="0" name="deploymentPolicyId" nillable="true" type="xs:string"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="addApplication">
+            <xs:element name="getDeploymentPolicyResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="applicationContext" nillable="true" type="ax24:ApplicationContext"/>
+                        <xs:element minOccurs="0" name="return" nillable="true" type="ax28:DeploymentPolicy"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getApplications">
+            <xs:element name="getAutoscalingPolicy">
                 <xs:complexType>
-                    <xs:sequence/>
+                    <xs:sequence>
+                        <xs:element minOccurs="0" name="autoscalingPolicyId" nillable="true" type="xs:string"/>
+                    </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getApplicationsResponse">
+            <xs:element name="getAutoscalingPolicyResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax24:ApplicationContext"/>
+                        <xs:element minOccurs="0" name="return" nillable="true" type="ax29:AutoscalePolicy"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getServiceGroup">
+            <xs:element name="getApplication">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="applicationId" nillable="true" type="xs:string"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getServiceGroupResponse">
+            <xs:element name="getApplicationResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="return" nillable="true" type="ax27:ServiceGroup"/>
+                        <xs:element minOccurs="0" name="return" nillable="true" type="ax213:ApplicationContext"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getDeploymentPolicy">
+            <xs:element name="getApplications">
                 <xs:complexType>
-                    <xs:sequence>
-                        <xs:element minOccurs="0" name="deploymentPolicyId" nillable="true" type="xs:string"/>
-                    </xs:sequence>
+                    <xs:sequence/>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getDeploymentPolicyResponse">
+            <xs:element name="getApplicationsResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="return" nillable="true" type="ax29:DeploymentPolicy"/>
+                        <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax213:ApplicationContext"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getAutoscalingPolicy">
+            <xs:element name="AutoscalerServiceApplicationDefinitionException">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="autoscalingPolicyId" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="ApplicationDefinitionException" nillable="true" type="ax214:ApplicationDefinitionException"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getAutoscalingPolicyResponse">
+            <xs:element name="addApplication">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="return" nillable="true" type="ax214:AutoscalePolicy"/>
+                        <xs:element minOccurs="0" name="applicationContext" nillable="true" type="ax213:ApplicationContext"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="AutoscalerServiceInvalidPolicyException">
+            <xs:element name="getNetworkPartitions">
+                <xs:complexType>
+                    <xs:sequence/>
+                </xs:complexType>
+            </xs:element>
+            <xs:element name="getNetworkPartitionsResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="InvalidPolicyException" nillable="true" type="ax217:InvalidPolicyException"/>
+                        <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax24:NetworkPartition"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="addAutoScalingPolicy">
+            <xs:element name="getNetworkPartition">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="autoscalePolicy" nillable="true" type="ax214:AutoscalePolicy"/>
+                        <xs:element minOccurs="0" name="networkPartitionId" nillable="true" type="xs:string"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="addAutoScalingPolicyResponse">
+            <xs:element name="getNetworkPartitionResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="return" type="xs:boolean"/>
+                        <xs:element minOccurs="0" name="return" nillable="true" type="ax24:NetworkPartition"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getAutoScalingPolicies">
+            <xs:element name="removeNetworkPartition">
                 <xs:complexType>
-                    <xs:sequence/>
+                    <xs:sequence>
+                        <xs:element minOccurs="0" name="networkPartitionId" nillable="true" type="xs:string"/>
+                    </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getAutoScalingPoliciesResponse">
+            <xs:element name="updateNetworkPartition">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax214:AutoscalePolicy"/>
+                        <xs:element minOccurs="0" name="networkPartition" nillable="true" type="ax24:NetworkPartition"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="updateAutoScalingPolicy">
+            <xs:element name="serviceGroupExist">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="autoscalePolicy" nillable="true" type="ax214:AutoscalePolicy"/>
+                        <xs:element minOccurs="0" name="serviceName" nillable="true" type="xs:string"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="updateAutoScalingPolicyResponse">
+            <xs:element name="serviceGroupExistResponse">
                 <xs:complexType>
                     <xs:sequence>
                         <xs:element minOccurs="0" name="return" type="xs:boolean"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="removeAutoScalingPolicy">
+            <xs:element name="AutoscalerServiceAutoScalerException">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="autoscalePolicyId" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="AutoScalerException" nillable="true" type="ax217:AutoScalerException"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="removeAutoScalingPolicyResponse">
+            <xs:element name="getServiceGroups">
                 <xs:complexType>
-                    <xs:sequence>
-                        <xs:element minOccurs="0" name="return" type="xs:boolean"/>
-                    </xs:sequence>
+                    <xs:sequence/>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="deployApplication">
+            <xs:element name="getServiceGroupsResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="applicationId" nillable="true" type="xs:string"/>
-                        <xs:element minOccurs="0" name="deploymentPolicy" nillable="true" type="ax29:DeploymentPolicy"/>
+                        <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax21:ServiceGroup"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="deployApplicationResponse">
+            <xs:element name="removeServiceGroup">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="return" type="xs:boolean"/>
+                        <xs:element minOccurs="0" name="groupName" nillable="true" type="xs:string"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="undeployApplication">
+            <xs:element name="AutoscalerServiceInvalidPolicyException">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="applicationId" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="InvalidPolicyException" nillable="true" type="ax219:InvalidPolicyException"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="AutoscalerServiceInvalidArgumentException">
+            <xs:element name="addAutoScalingPolicy">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="InvalidArgumentException" nillable="true" type="ax219:InvalidArgumentException"/>
+                        <xs:element minOccurs="0" name="autoscalePolicy" nillable="true" type="ax29:AutoscalePolicy"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="updateClusterMonitor">
+            <xs:element name="addAutoScalingPolicyResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
-                        <xs:element minOccurs="0" name="properties" nillable="true" type="ax22:Properties"/>
+                        <xs:element minOccurs="0" name="return" type="xs:boolean"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="AutoscalerServiceInvalidServiceGroupException">
+            <xs:element name="getAutoScalingPolicies">
+                <xs:complexType>
+                    <xs:sequence/>
+                </xs:complexType>
+            </xs:element>
+            <xs:element name="getAutoScalingPoliciesResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="InvalidServiceGroupException" nillable="true" type="ax221:InvalidServiceGroupException"/>
+                        <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax29:AutoscalePolicy"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="addServiceGroup">
+            <xs:element name="updateAutoScalingPolicy">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="servicegroup" nillable="true" type="ax27:ServiceGroup"/>
+                        <xs:element minOccurs="0" name="autoscalePolicy" nillable="true" type="ax29:AutoscalePolicy"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="addNetworkPartition">
+            <xs:element name="updateAutoScalingPolicyResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="networkPartition" nillable="true" type="ax223:NetworkPartition"/>
+                        <xs:element minOccurs="0" name="return" type="xs:boolean"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="AutoscalerServiceAutoScalerException">
+            <xs:element name="removeAutoScalingPolicy">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="AutoScalerException" nillable="true" type="ax219:AutoScalerException"/>
+                        <xs:element minOccurs="0" name="autoscalePolicyId" nillable="true" type="xs:string"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="undeployServiceGroup">
+            <xs:element name="removeAutoScalingPolicyResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="return" type="xs:boolean"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getNetworkPartitions">
+            <xs:element name="deployApplication">
                 <xs:complexType>
-                    <xs:sequence/>
+                    <xs:sequence>
+                        <xs:element minOccurs="0" name="applicationId" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="deploymentPolicy" nillable="true" type="ax28:DeploymentPolicy"/>
+                    </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getNetworkPartitionsResponse">
+            <xs:element name="deployApplicationResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax223:NetworkPartition"/>
+                        <xs:element minOccurs="0" name="return" type="xs:boolean"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getNetworkPartition">
+            <xs:element name="undeployApplication">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="networkPartitionId" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="applicationId" nillable="true" type="xs:string"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getNetworkPartitionResponse">
+            <xs:element name="AutoscalerServiceInvalidArgumentException">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="return" nillable="true" type="ax223:NetworkPartition"/>
+                        <xs:element minOccurs="0" name="InvalidArgumentException" nillable="true" type="ax217:InvalidArgumentException"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="removeNetworkPartition">
+            <xs:element name="updateClusterMonitor">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="networkPartitionId" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="properties" nillable="true" type="ax25:Properties"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="updateNetworkPartition">
+            <xs:element name="AutoscalerServiceInvalidServiceGroupException">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="networkPartition" nillable="true" type="ax223:NetworkPartition"/>
+                        <xs:element minOccurs="0" name="InvalidServiceGroupException" nillable="true" type="ax222:InvalidServiceGroupException"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="serviceGroupExist">
+            <xs:element name="addServiceGroup">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="serviceName" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="servicegroup" nillable="true" type="ax21:ServiceGroup"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="serviceGroupExistResponse">
+            <xs:element name="addNetworkPartition">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="return" type="xs:boolean"/>
+                        <xs:element minOccurs="0" name="networkPartition" nillable="true" type="ax24:NetworkPartition"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getServiceGroups">
+            <xs:element name="findClusterId">
                 <xs:complexType>
-                    <xs:sequence/>
+                    <xs:sequence>
+                        <xs:element minOccurs="0" name="applicationId" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="alias" nillable="true" type="xs:string"/>
+                    </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getServiceGroupsResponse">
+            <xs:element name="findClusterIdResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax27:ServiceGroup"/>
+                        <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="removeServiceGroup">
+            <xs:element name="undeployServiceGroup">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="groupName" nillable="true" type="xs:string"/>
+                        <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
         </xs:schema>
-        <xs:schema xmlns:ax212="http://network.partition.deployment.policy.pojo.autoscaler.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://deployment.policy.pojo.autoscaler.stratos.apache.org/xsd">
+        <xs:schema xmlns:ax27="http://network.partition.deployment.policy.pojo.autoscaler.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://deployment.policy.pojo.autoscaler.stratos.apache.org/xsd">
             <xs:import namespace="http://network.partition.deployment.policy.pojo.autoscaler.stratos.apache.org/xsd"/>
             <xs:complexType name="DeploymentPolicy">
                 <xs:sequence>
-                    <xs:element maxOccurs="unbounded" minOccurs="0" name="allPartitions" nillable="true" type="ax212:Partition"/>
+                    <xs:element maxOccurs="unbounded" minOccurs="0" name="allPartitions" nillable="true" type="ax27:Partition"/>
                     <xs:element minOccurs="0" name="applicationId" nillable="true" type="xs:string"/>
-                    <xs:element maxOccurs="unbounded" minOccurs="0" name="applicationLevelNetworkPartitions" nillable="true" type="ax212:NetworkPartition"/>
-                    <xs:element maxOccurs="unbounded" minOccurs="0" name="childLevelNetworkPartitions" nillable="true" type="ax212:ChildLevelNetworkPartition"/>
-                    <xs:element maxOccurs="unbounded" minOccurs="0" name="childPolicies" nillable="true" type="ax29:ChildPolicy"/>
+                    <xs:element maxOccurs="unbounded" minOccurs="0" name="applicationLevelNetworkPartitions" nillable="true" type="ax27:NetworkPartition"/>
+                    <xs:element maxOccurs="unbounded" minOccurs="0" name="childLevelNetworkPartitions" nillable="true" type="ax27:ChildLevelNetworkPartition"/>
+                    <xs:element maxOccurs="unbounded" minOccurs="0" name="childPolicies" nillable="true" type="ax23:ChildPolicy"/>
                     <xs:element minOccurs="0" name="description" nillable="true" type="xs:string"/>
                     <xs:element minOccurs="0" name="isPublic" type="xs:boolean"/>
                     <xs:element minOccurs="0" name="tenantId" type="xs:int"/>
@@ -449,7 +464,7 @@
             <xs:complexType name="ChildPolicy">
                 <xs:sequence>
                     <xs:element minOccurs="0" name="alias" nillable="true" type="xs:string"/>
-                    <xs:element maxOccurs="unbounded" minOccurs="0" name="childLevelNetworkPartitions" nillable="true" type="ax212:ChildLevelNetworkPartition"/>
+                    <xs:element maxOccurs="unbounded" minOccurs="0" name="childLevelNetworkPartitions" nillable="true" type="ax27:ChildLevelNetworkPartition"/>
                 </xs:sequence>
             </xs:complexType>
         </xs:schema>
@@ -460,7 +475,7 @@
                 </xs:sequence>
             </xs:complexType>
         </xs:schema>
-        <xs:schema xmlns:ax211="http://common.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://network.partition.deployment.policy.pojo.autoscaler.stratos.apache.org/xsd">
+        <xs:schema xmlns:ax26="http://common.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://network.partition.deployment.policy.pojo.autoscaler.stratos.apache.org/xsd">
             <xs:import namespace="http://common.stratos.apache.org/xsd"/>
             <xs:complexType name="Partition">
                 <xs:sequence>
@@ -468,7 +483,7 @@
                     <xs:element minOccurs="0" name="id" nillable="true" type="xs:string"/>
                     <xs:element minOccurs="0" name="isPublic" type="xs:boolean"/>
                     <xs:element minOccurs="0" name="kubernetesClusterId" nillable="true" type="xs:string"/>
-                    <xs:element minOccurs="0" name="properties" nillable="true" type="ax211:Properties"/>
+                    <xs:element minOccurs="0" name="properties" nillable="true" type="ax25:Properties"/>
                     <xs:element minOccurs="0" name="provider" nillable="true" type="xs:string"/>
                 </xs:sequence>
             </xs:complexType>
@@ -477,12 +492,12 @@
                     <xs:element minOccurs="0" name="activeByDefault" type="xs:boolean"/>
                     <xs:element minOccurs="0" name="id" nillable="true" type="xs:string"/>
                     <xs:element minOccurs="0" name="kubernetesClusterId" nillable="true" type="xs:string"/>
-                    <xs:element maxOccurs="unbounded" minOccurs="0" name="partitions" nillable="true" type="ax210:Partition"/>
+                    <xs:element maxOccurs="unbounded" minOccurs="0" name="partitions" nillable="true" type="ax24:Partition"/>
                 </xs:sequence>
             </xs:complexType>
             <xs:complexType name="ChildLevelNetworkPartition">
                 <xs:sequence>
-                    <xs:element maxOccurs="unbounded" minOccurs="0" name="childLevelPartitions" nillable="true" type="ax210:ChildLevelPartition"/>
+                    <xs:element maxOccurs="unbounded" minOccurs="0" name="childLevelPartitions" nillable="true" type="ax24:ChildLevelPartition"/>
                     <xs:element minOccurs="0" name="id" nillable="true" type="xs:string"/>
                     <xs:element minOccurs="0" name="min" type="xs:int"/>
                     <xs:element minOccurs="0" name="partitionAlgo" nillable="true" type="xs:string"/>
@@ -506,7 +521,7 @@
         <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://common.stratos.apache.org/xsd">
             <xs:complexType name="Properties">
                 <xs:sequence>
-                    <xs:element maxOccurs="unbounded" minOccurs="0" name="properties" nillable="true" type="ax22:Property"/>
+                    <xs:element maxOccurs="unbounded" minOccurs="0" name="properties" nillable="true" type="ax25:Property"/>
                 </xs:sequence>
             </xs:complexType>
             <xs:complexType name="Property">
@@ -524,11 +539,6 @@
             </xs:complexType>
         </xs:schema>
         <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://exception.autoscaler.stratos.apache.org/xsd">
-            <xs:complexType name="InvalidArgumentException">
-                <xs:sequence>
-                    <xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
-                </xs:sequence>
-            </xs:complexType>
             <xs:complexType name="AutoScalerException">
                 <xs:complexContent>
                     <xs:extension base="xs:RuntimeException">
@@ -536,6 +546,11 @@
                     </xs:extension>
                 </xs:complexContent>
             </xs:complexType>
+            <xs:complexType name="InvalidArgumentException">
+                <xs:sequence>
+                    <xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
+                </xs:sequence>
+            </xs:complexType>
         </xs:schema>
     </wsdl:types>
     <wsdl:message name="removeAutoScalingPolicyRequest">
@@ -631,6 +646,12 @@
     <wsdl:message name="updateAutoScalingPolicyResponse">
         <wsdl:part name="parameters" element="ns:updateAutoScalingPolicyResponse"/>
     </wsdl:message>
+    <wsdl:message name="findClusterIdRequest">
+        <wsdl:part name="parameters" element="ns:findClusterId"/>
+    </wsdl:message>
+    <wsdl:message name="findClusterIdResponse">
+        <wsdl:part name="parameters" element="ns:findClusterIdResponse"/>
+    </wsdl:message>
     <wsdl:message name="getApplicationsRequest">
         <wsdl:part name="parameters" element="ns:getApplications"/>
     </wsdl:message>
@@ -734,6 +755,10 @@
             <wsdl:output message="ns:updateAutoScalingPolicyResponse" wsaw:Action="urn:updateAutoScalingPolicyResponse"/>
             <wsdl:fault message="ns:AutoscalerServiceInvalidPolicyException" name="AutoscalerServiceInvalidPolicyException" wsaw:Action="urn:updateAutoScalingPolicyAutoscalerServiceInvalidPolicyException"/>
         </wsdl:operation>
+        <wsdl:operation name="findClusterId">
+            <wsdl:input message="ns:findClusterIdRequest" wsaw:Action="urn:findClusterId"/>
+            <wsdl:output message="ns:findClusterIdResponse" wsaw:Action="urn:findClusterIdResponse"/>
+        </wsdl:operation>
         <wsdl:operation name="getApplications">
             <wsdl:input message="ns:getApplicationsRequest" wsaw:Action="urn:getApplications"/>
             <wsdl:output message="ns:getApplicationsResponse" wsaw:Action="urn:getApplicationsResponse"/>
@@ -916,6 +941,15 @@
                 <soap:fault use="literal" name="AutoscalerServiceInvalidPolicyException"/>
             </wsdl:fault>
         </wsdl:operation>
+        <wsdl:operation name="findClusterId">
+            <soap:operation soapAction="urn:findClusterId" style="document"/>
+            <wsdl:input>
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output>
+                <soap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
         <wsdl:operation name="getApplications">
             <soap:operation soapAction="urn:getApplications" style="document"/>
             <wsdl:input>
@@ -1132,6 +1166,15 @@
                 <soap12:fault use="literal" name="AutoscalerServiceInvalidPolicyException"/>
             </wsdl:fault>
         </wsdl:operation>
+        <wsdl:operation name="findClusterId">
+            <soap12:operation soapAction="urn:findClusterId" style="document"/>
+            <wsdl:input>
+                <soap12:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output>
+                <soap12:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
         <wsdl:operation name="getApplications">
             <soap12:operation soapAction="urn:getApplications" style="document"/>
             <wsdl:input>
@@ -1327,6 +1370,15 @@
                 <mime:content type="text/xml" part="parameters"/>
             </wsdl:output>
         </wsdl:operation>
+        <wsdl:operation name="findClusterId">
+            <http:operation location="findClusterId"/>
+            <wsdl:input>
+                <mime:content type="text/xml" part="parameters"/>
+            </wsdl:input>
+            <wsdl:output>
+                <mime:content type="text/xml" part="parameters"/>
+            </wsdl:output>
+        </wsdl:operation>
         <wsdl:operation name="getApplications">
             <http:operation location="getApplications"/>
             <wsdl:input>


[3/3] stratos git commit: Disabling mock iaas in default configuration and simulating 2 second instance creation time

Posted by im...@apache.org.
Disabling mock iaas in default configuration and simulating 2 second instance creation time


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

Branch: refs/heads/master
Commit: c44112c002d8227c3bf52d24c1bd38b1ea576e6c
Parents: 2c00b9f
Author: Imesh Gunaratne <im...@apache.org>
Authored: Sun Feb 15 23:27:57 2015 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Sun Feb 15 23:27:57 2015 +0530

----------------------------------------------------------------------
 .../mock/iaas/services/impl/MockIaasServiceImpl.java | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/c44112c0/components/org.apache.stratos.mock.iaas/src/main/java/org/apache/stratos/mock/iaas/services/impl/MockIaasServiceImpl.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.mock.iaas/src/main/java/org/apache/stratos/mock/iaas/services/impl/MockIaasServiceImpl.java b/components/org.apache.stratos.mock.iaas/src/main/java/org/apache/stratos/mock/iaas/services/impl/MockIaasServiceImpl.java
index bc2e792..aeec0c6 100644
--- a/components/org.apache.stratos.mock.iaas/src/main/java/org/apache/stratos/mock/iaas/services/impl/MockIaasServiceImpl.java
+++ b/components/org.apache.stratos.mock.iaas/src/main/java/org/apache/stratos/mock/iaas/services/impl/MockIaasServiceImpl.java
@@ -22,6 +22,7 @@ package org.apache.stratos.mock.iaas.services.impl;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.stratos.common.threading.StratosThreadPool;
+import org.apache.stratos.mock.iaas.config.MockIaasConfig;
 import org.apache.stratos.mock.iaas.domain.MockInstanceContext;
 import org.apache.stratos.mock.iaas.domain.MockInstanceMetadata;
 import org.apache.stratos.mock.iaas.exceptions.MockIaasException;
@@ -65,6 +66,10 @@ public class MockIaasServiceImpl implements MockIaasService {
 
     public MockIaasServiceImpl() {
         try {
+            if(!MockIaasConfig.getInstance().isEnabled()) {
+                throw new RuntimeException("Mock IaaS is disabled, please check the configuration");
+            }
+
             String persistenceManagerTypeStr = System.getProperty(MockConstants.PERSISTENCE_MANAGER_TYPE,
                     PersistenceManagerType.Registry.toString());
             PersistenceManagerType persistenceManagerType = PersistenceManagerType.valueOf(persistenceManagerTypeStr);
@@ -111,10 +116,20 @@ public class MockIaasServiceImpl implements MockIaasService {
             String serviceName = mockInstanceContext.getServiceName();
             MockHealthStatisticsGenerator.getInstance().scheduleStatisticsUpdaterTasks(serviceName);
 
+            // Simulate instance creation time
+            sleep(2000);
+
             return new MockInstanceMetadata(mockInstanceContext);
         }
     }
 
+    private void sleep(int time) {
+        try {
+            Thread.sleep(time);
+        } catch (InterruptedException ignore) {
+        }
+    }
+
     /**
      * Get mock instance contexts.
      * @return


[2/3] stratos git commit: Updating thread pool ids and moving all executor service/scheduler initializations to stratos thread pool

Posted by im...@apache.org.
Updating thread pool ids and moving all executor service/scheduler initializations to stratos thread pool


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

Branch: refs/heads/master
Commit: 2c00b9fd87ab19eaeb5c4c82c07c1eb47653c703
Parents: 6dce38d
Author: Imesh Gunaratne <im...@apache.org>
Authored: Sun Feb 15 23:25:06 2015 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Sun Feb 15 23:25:06 2015 +0530

----------------------------------------------------------------------
 .../monitor/cluster/ClusterMonitor.java         |  2 +-
 .../monitor/component/ApplicationMonitor.java   |  2 +-
 .../monitor/component/GroupMonitor.java         |  2 +-
 .../component/ParentComponentMonitor.java       |  3 +-
 .../autoscaler/util/AutoscalerConstants.java    |  2 +-
 .../agent/CartridgeAgentEventListeners.java     | 29 +++-----
 .../concurrent/ScheduledThreadExecutor.java     | 78 --------------------
 .../controller/concurrent/ThreadExecutor.java   | 73 ------------------
 .../context/CloudControllerContext.java         | 17 +++--
 .../impl/CloudControllerServiceImpl.java        | 22 +++---
 .../common/threading/StratosThreadPool.java     | 11 ++-
 .../mock/iaas/services/impl/MockInstance.java   |  8 +-
 .../MockHealthStatisticsGenerator.java          |  2 +-
 .../apache/stratos/haproxy/extension/Main.java  |  2 +-
 14 files changed, 54 insertions(+), 199 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/2c00b9fd/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 e2db9e6..887d2ef 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
@@ -117,7 +117,7 @@ public class ClusterMonitor extends Monitor implements Runnable {
     public ClusterMonitor(Cluster cluster, boolean hasScalingDependents, boolean groupScalingEnabledSubtree) {
 
         scheduler = StratosThreadPool.getScheduledExecutorService(AutoscalerConstants.CLUSTER_MONITOR_SCHEDULER_ID, 1);
-        int threadPoolSize = Integer.getInteger(AutoscalerConstants.CLUSTER_MONITOR_THREAD_POOL_SIZE, 10);
+        int threadPoolSize = Integer.getInteger(AutoscalerConstants.CLUSTER_MONITOR_THREAD_POOL_SIZE, 50);
         executorService = StratosThreadPool.getExecutorService(
                 AutoscalerConstants.CLUSTER_MONITOR_THREAD_POOL_ID, threadPoolSize);
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/2c00b9fd/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 00547b9..d78f777 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
@@ -69,7 +69,7 @@ public class ApplicationMonitor extends ParentComponentMonitor {
             TopologyInConsistentException {
         super(application);
 
-        int threadPoolSize = Integer.getInteger(AutoscalerConstants.APPLICATION_MONITOR_THREAD_POOL_SIZE, 10);
+        int threadPoolSize = Integer.getInteger(AutoscalerConstants.APPLICATION_MONITOR_THREAD_POOL_SIZE, 20);
         this.executorService = StratosThreadPool.getExecutorService(
                 AutoscalerConstants.APPLICATION_MONITOR_THREAD_POOL_ID, threadPoolSize);
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/2c00b9fd/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/GroupMonitor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/GroupMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/GroupMonitor.java
index ed48829..60fd555 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/GroupMonitor.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/GroupMonitor.java
@@ -83,7 +83,7 @@ public class GroupMonitor extends ParentComponentMonitor {
             TopologyInConsistentException {
         super(group);
 
-        int threadPoolSize = Integer.getInteger(AutoscalerConstants.GROUP_MONITOR_THREAD_POOL_SIZE, 10);
+        int threadPoolSize = Integer.getInteger(AutoscalerConstants.GROUP_MONITOR_THREAD_POOL_SIZE, 20);
         this.executorService = StratosThreadPool.getExecutorService(
                 AutoscalerConstants.GROUP_MONITOR_THREAD_POOL_ID, threadPoolSize);
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/2c00b9fd/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/ParentComponentMonitor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/ParentComponentMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/ParentComponentMonitor.java
index c682544..aa4ddb5 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/ParentComponentMonitor.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/ParentComponentMonitor.java
@@ -64,7 +64,8 @@ public abstract class ParentComponentMonitor extends Monitor implements Runnable
     private static final Log log = LogFactory.getLog(ParentComponentMonitor.class);
 
     //Scheduler executor service to execute this monitor in a thread
-    private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
+    private final ScheduledExecutorService scheduler = StratosThreadPool.getScheduledExecutorService(
+            "autoscaler.monitor.scheduler.thread.pool", 100);
     //The monitors dependency tree with all the start-able/kill-able dependencies
     protected DependencyTree startupDependencyTree;
     //The monitors dependency tree with all the scaling dependencies

http://git-wip-us.apache.org/repos/asf/stratos/blob/2c00b9fd/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 370e836..ce970e2 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
@@ -35,7 +35,7 @@ public final class AutoscalerConstants {
     public static final String PROPERTY_VALUE_ATTR = "value";
     public static final String AUTOSCALER_THREAD_POOL_ID = "autoscaler.thread.pool";
     public static final String THREAD_POOL_SIZE_KEY = "autoscaler.thread.pool.size";
-    public static final int AUTOSCALER_THREAD_POOL_SIZE = 10;
+    public static final int AUTOSCALER_THREAD_POOL_SIZE = 50;
     public static final String COMPONENTS_CONFIG = CarbonUtils.getCarbonConfigDirPath() +
             File.separator + "stratos-config.xml";
     

http://git-wip-us.apache.org/repos/asf/stratos/blob/2c00b9fd/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/CartridgeAgentEventListeners.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/CartridgeAgentEventListeners.java b/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/CartridgeAgentEventListeners.java
index b64e32d..c66ea50 100644
--- a/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/CartridgeAgentEventListeners.java
+++ b/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/CartridgeAgentEventListeners.java
@@ -40,26 +40,20 @@ public class CartridgeAgentEventListeners
     private TenantEventReceiver tenantEventReceiver;
     
     private ExtensionHandler extensionHandler;
-    private static final ExecutorService instanceNotifierExecutorService =
-            StratosThreadPool.getExecutorService("CARTRIDGEAGENT_NOTIFIER_EVENT_LISTENERS", 1);
-    
-    private static final ExecutorService topologyEventExecutorService =
-            StratosThreadPool.getExecutorService("CARTRIDGEAGENT_TOPOLOGY_EVENT_LISTENERS", 1);
-    
-    private static final ExecutorService tenantEventExecutorService =
-            StratosThreadPool.getExecutorService("CARTRIDGEAGENT_TENANT_EVENT_LISTENERS", 1);
+    private static final ExecutorService eventListenerExecutorService =
+            StratosThreadPool.getExecutorService("cartridge.agent.event.listener.thread.pool", 10);
 
     public CartridgeAgentEventListeners() {
     	if (log.isDebugEnabled()) {
-            log.debug("creating cartridgeAgentEventListeners ... ");
+            log.debug("Creating cartridge agent event listeners...");
         }
         this.topologyEventReceiver = new TopologyEventReceiver();
-        this.topologyEventReceiver.setExecutorService(topologyEventExecutorService);
+        this.topologyEventReceiver.setExecutorService(eventListenerExecutorService);
         
         this.instanceNotifierEventReceiver = new InstanceNotifierEventReceiver();
         
         this.tenantEventReceiver = new TenantEventReceiver();
-        this.tenantEventReceiver.setExecutorService(tenantEventExecutorService);
+        this.tenantEventReceiver.setExecutorService(eventListenerExecutorService);
 
         extensionHandler = new DefaultExtensionHandler();
         
@@ -68,9 +62,8 @@ public class CartridgeAgentEventListeners
         addTenantEventListeners();
         
         if (log.isDebugEnabled()) {
-            log.debug("creating cartridgeAgentEventListeners ... done ");
+            log.debug("Cartridge agent event listeners created");
         }
-        
     }
 
     public void startTopologyEventReceiver() {
@@ -78,8 +71,8 @@ public class CartridgeAgentEventListeners
     	if (log.isDebugEnabled()) {
             log.debug("Starting cartridge agent topology event message receiver");
         }
-    	
-        topologyEventExecutorService.submit(new Runnable() {
+
+        eventListenerExecutorService.submit(new Runnable() {
             @Override
             public void run() {
             	topologyEventReceiver.execute();
@@ -99,7 +92,7 @@ public class CartridgeAgentEventListeners
             log.debug("Starting cartridge agent instance notifier event message receiver");
         }
 
-        instanceNotifierExecutorService.submit(new Runnable() {
+        eventListenerExecutorService.submit(new Runnable() {
             @Override
             public void run() {
                 instanceNotifierEventReceiver.execute();
@@ -116,8 +109,8 @@ public class CartridgeAgentEventListeners
     	if (log.isDebugEnabled()) {
             log.debug("Starting cartridge agent tenant event message receiver");
         }
-    	
-        topologyEventExecutorService.submit(new Runnable() {
+
+        eventListenerExecutorService.submit(new Runnable() {
             @Override
             public void run() {
             	topologyEventReceiver.execute();

http://git-wip-us.apache.org/repos/asf/stratos/blob/2c00b9fd/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/concurrent/ScheduledThreadExecutor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/concurrent/ScheduledThreadExecutor.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/concurrent/ScheduledThreadExecutor.java
deleted file mode 100644
index 56f2a2c..0000000
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/concurrent/ScheduledThreadExecutor.java
+++ /dev/null
@@ -1,78 +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.cloud.controller.concurrent;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.TimeUnit;
-
-/**
- * This class can be used to create a scheduled executor pool, and hand over new jobs to the pool.
- */
-public class ScheduledThreadExecutor {
-    private ScheduledExecutorService executor;
-
-    private static class Holder {
-        private static final ScheduledThreadExecutor INSTANCE = new ScheduledThreadExecutor();
-    }
-    
-    public static ScheduledThreadExecutor getInstance() {
-        return Holder.INSTANCE;
-    }
-    
-    private ScheduledThreadExecutor() {
-        executor = Executors.newScheduledThreadPool(50);
-    }
-    
-    public ScheduledFuture<?> schedule(Runnable job, int interval){
-        return executor.scheduleAtFixedRate(job, 0, interval, TimeUnit.MILLISECONDS);
-    }
-    
-    public List<ScheduledFuture<?>> scheduleAll(Runnable[] jobs, int interval){
-        List<ScheduledFuture<?>> list = new ArrayList<ScheduledFuture<?>>();
-        for (Runnable job : jobs) {
-            
-            list.add(this.schedule(job, interval));
-        }
-        return list;
-    }
-    
-    public void shutdown() {
-        executor.shutdown(); // Disable new tasks from being submitted
-        try {
-          // Wait a while for existing tasks to terminate
-          if (!executor.awaitTermination(60, TimeUnit.SECONDS)) {
-            executor.shutdownNow(); // Cancel currently executing tasks
-            // Wait a while for tasks to respond to being cancelled
-            if (!executor.awaitTermination(60, TimeUnit.SECONDS))
-                System.err.println("Pool did not terminate");
-          }
-        } catch (InterruptedException ie) {
-          // (Re-)Cancel if current thread also interrupted
-          executor.shutdownNow();
-          // Preserve interrupt status
-          Thread.currentThread().interrupt();
-        }
-    }
-    
-    
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/2c00b9fd/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/concurrent/ThreadExecutor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/concurrent/ThreadExecutor.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/concurrent/ThreadExecutor.java
deleted file mode 100644
index 6735c3f..0000000
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/concurrent/ThreadExecutor.java
+++ /dev/null
@@ -1,73 +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.cloud.controller.concurrent;
-
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-
-/**
- * This class can be used to create a thread pool, and hand over new jobs to the pool.
- */
-public class ThreadExecutor {
-    private ExecutorService executor;
-
-    private static class Holder {
-        private static final ThreadExecutor INSTANCE = new ThreadExecutor();
-    }
-    
-    public static ThreadExecutor getInstance() {
-        return Holder.INSTANCE;
-    }
-    
-    private ThreadExecutor() {
-        executor = Executors.newFixedThreadPool(50);
-    }
-    
-    public void execute(Runnable job){
-        executor.execute(job);
-    }
-    
-    public void executeAll(Runnable[] jobs){
-        for (Runnable job : jobs) {
-            
-            executor.execute(job);
-        }
-    }
-    
-    public void shutdown() {
-        executor.shutdown(); // Disable new tasks from being submitted
-        try {
-          // Wait a while for existing tasks to terminate
-          if (!executor.awaitTermination(60, TimeUnit.SECONDS)) {
-            executor.shutdownNow(); // Cancel currently executing tasks
-            // Wait a while for tasks to respond to being cancelled
-            if (!executor.awaitTermination(60, TimeUnit.SECONDS))
-                System.err.println("Pool did not terminate");
-          }
-        } catch (InterruptedException ie) {
-          // (Re-)Cancel if current thread also interrupted
-          executor.shutdownNow();
-          // Preserve interrupt status
-          Thread.currentThread().interrupt();
-        }
-    }
-    
-    
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/2c00b9fd/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/context/CloudControllerContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/context/CloudControllerContext.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/context/CloudControllerContext.java
index 34ccb9b..6274160 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/context/CloudControllerContext.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/context/CloudControllerContext.java
@@ -22,16 +22,21 @@ import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.cloud.controller.domain.kubernetes.KubernetesClusterContext;
-import org.apache.stratos.common.clustering.DistributedObjectProvider;
+import org.apache.stratos.cloud.controller.domain.Cartridge;
+import org.apache.stratos.cloud.controller.domain.ClusterContext;
+import org.apache.stratos.cloud.controller.domain.MemberContext;
+import org.apache.stratos.cloud.controller.domain.ServiceGroup;
 import org.apache.stratos.cloud.controller.domain.kubernetes.KubernetesCluster;
+import org.apache.stratos.cloud.controller.domain.kubernetes.KubernetesClusterContext;
 import org.apache.stratos.cloud.controller.domain.kubernetes.KubernetesHost;
 import org.apache.stratos.cloud.controller.domain.kubernetes.KubernetesMaster;
-import org.apache.stratos.cloud.controller.domain.*;
-import org.apache.stratos.cloud.controller.exception.*;
+import org.apache.stratos.cloud.controller.exception.NonExistingKubernetesClusterException;
+import org.apache.stratos.cloud.controller.exception.NonExistingKubernetesHostException;
 import org.apache.stratos.cloud.controller.internal.ServiceReferenceHolder;
 import org.apache.stratos.cloud.controller.registry.RegistryManager;
 import org.apache.stratos.cloud.controller.util.CloudControllerConstants;
+import org.apache.stratos.common.clustering.DistributedObjectProvider;
+import org.apache.stratos.common.threading.StratosThreadPool;
 import org.wso2.carbon.databridge.agent.thrift.AsyncDataPublisher;
 import org.wso2.carbon.registry.core.exceptions.RegistryException;
 
@@ -39,7 +44,6 @@ import java.io.Serializable;
 import java.util.*;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledFuture;
 import java.util.concurrent.locks.Lock;
 
@@ -122,7 +126,8 @@ public class CloudControllerContext implements Serializable {
     /**
      * Thread pool used in this task to execute parallel tasks.
      */
-    private transient ExecutorService executorService = Executors.newFixedThreadPool(20);
+    private transient ExecutorService executorService = StratosThreadPool.getExecutorService(
+            "cloud.controller.context.thread.pool", 10);
 
     /**
      * Map of registered {@link org.apache.stratos.cloud.controller.domain.Cartridge}s

http://git-wip-us.apache.org/repos/asf/stratos/blob/2c00b9fd/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java
index d58c326..5ea260a 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java
@@ -22,7 +22,6 @@ import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.stratos.cloud.controller.concurrent.PartitionValidatorCallable;
-import org.apache.stratos.cloud.controller.concurrent.ThreadExecutor;
 import org.apache.stratos.cloud.controller.config.CloudControllerConfig;
 import org.apache.stratos.cloud.controller.context.CloudControllerContext;
 import org.apache.stratos.cloud.controller.domain.*;
@@ -41,6 +40,7 @@ import org.apache.stratos.cloud.controller.services.CloudControllerService;
 import org.apache.stratos.cloud.controller.util.CloudControllerConstants;
 import org.apache.stratos.cloud.controller.util.CloudControllerUtil;
 import org.apache.stratos.common.Property;
+import org.apache.stratos.common.threading.StratosThreadPool;
 import org.apache.stratos.messaging.domain.topology.*;
 import org.apache.stratos.messaging.event.topology.MemberReadyToShutdownEvent;
 
@@ -50,6 +50,7 @@ import java.util.*;
 import java.util.Map.Entry;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Future;
 import java.util.concurrent.locks.Lock;
 
@@ -64,8 +65,11 @@ public class CloudControllerServiceImpl implements CloudControllerService {
     private static final String PERSISTENCE_MAPPING = "PERSISTENCE_MAPPING";
 
     private CloudControllerContext cloudControllerContext = CloudControllerContext.getInstance();
+    private ExecutorService executorService;
 
     public CloudControllerServiceImpl() {
+        executorService = StratosThreadPool.getExecutorService("cloud.controller.instance.manager.thread.pool", 50);
+
     }
 
     public void addCartridge(CartridgeConfig cartridgeConfig) throws InvalidCartridgeDefinitionException,
@@ -448,11 +452,10 @@ public class CloudControllerServiceImpl implements CloudControllerService {
             }
 
             // Start instance in a new thread
-            ThreadExecutor threadExecutor = ThreadExecutor.getInstance();
             if (log.isDebugEnabled()) {
                 log.debug("Starting the instance creator thread...");
             }
-            threadExecutor.execute(new InstanceCreator(memberContext, iaasProvider));
+            executorService.execute(new InstanceCreator(memberContext, iaasProvider));
 
             TopologyBuilder.handleMemberCreatedEvent(memberContext);
             return memberContext;
@@ -593,8 +596,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
                 }
             }
 
-            ThreadExecutor exec = ThreadExecutor.getInstance();
-            exec.execute(new InstanceTerminator(memberContext));
+            executorService.execute(new InstanceTerminator(memberContext));
         } catch (InvalidMemberException e) {
             String message = "Could not terminate instance: [member-id] " + memberId;
             log.error(message, e);
@@ -679,17 +681,15 @@ public class CloudControllerServiceImpl implements CloudControllerService {
 
         handleNullObject(clusterId, "Instance termination failed. Cluster id is null.");
 
-        List<MemberContext> ctxts = CloudControllerContext.getInstance().getMemberContextsOfClusterId(clusterId);
-
-        if (ctxts == null) {
+        List<MemberContext> memberContexts = CloudControllerContext.getInstance().getMemberContextsOfClusterId(clusterId);
+        if (memberContexts == null) {
             String msg = "Instance termination failed. No members found for cluster id: " + clusterId;
             log.warn(msg);
             return;
         }
 
-        ThreadExecutor exec = ThreadExecutor.getInstance();
-        for (MemberContext memberContext : ctxts) {
-            exec.execute(new InstanceTerminator(memberContext));
+        for (MemberContext memberContext : memberContexts) {
+            executorService.execute(new InstanceTerminator(memberContext));
         }
     }
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/2c00b9fd/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/threading/StratosThreadPool.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/threading/StratosThreadPool.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/threading/StratosThreadPool.java
index c85e146..eace99b 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/threading/StratosThreadPool.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/threading/StratosThreadPool.java
@@ -20,6 +20,9 @@
  */
 package org.apache.stratos.common.threading;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ExecutorService;
@@ -31,7 +34,9 @@ import java.util.concurrent.ScheduledExecutorService;
  */
 public class StratosThreadPool {
 
-	private static Map<String, ExecutorService> executorServiceMap = new ConcurrentHashMap<String, ExecutorService>();
+    private static final Log log = LogFactory.getLog(StratosThreadPool.class);
+
+    private static Map<String, ExecutorService> executorServiceMap = new ConcurrentHashMap<String, ExecutorService>();
     private static Map<String, ScheduledExecutorService> scheduledServiceMap = new ConcurrentHashMap<String, ScheduledExecutorService>();
 	private static Object executorServiceMapLock = new Object();
     private static Object scheduledServiceMapLock = new Object();
@@ -50,9 +55,9 @@ public class StratosThreadPool {
 				if (executorService == null) {
 					executorService = Executors.newFixedThreadPool(threadPoolSize);
 					executorServiceMap.put(identifier, executorService);
+                    log.info(String.format("Thread pool created: [type] Executor Service [id] %s [size] %d", identifier, threadPoolSize));
 				}
 			}
-
 		}
 		return executorService;
 	}
@@ -70,6 +75,8 @@ public class StratosThreadPool {
                 if (scheduledExecutorService == null) {
                     scheduledExecutorService = Executors.newScheduledThreadPool(threadPoolSize);
                     scheduledServiceMap.put(identifier, scheduledExecutorService);
+                    log.info(String.format("Thread pool created: [type] Scheduled Executor Service [id] %s [size] %d",
+                            identifier, threadPoolSize));
                 }
             }
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/2c00b9fd/components/org.apache.stratos.mock.iaas/src/main/java/org/apache/stratos/mock/iaas/services/impl/MockInstance.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.mock.iaas/src/main/java/org/apache/stratos/mock/iaas/services/impl/MockInstance.java b/components/org.apache.stratos.mock.iaas/src/main/java/org/apache/stratos/mock/iaas/services/impl/MockInstance.java
index 4ddf4bd..ab3d319 100644
--- a/components/org.apache.stratos.mock.iaas/src/main/java/org/apache/stratos/mock/iaas/services/impl/MockInstance.java
+++ b/components/org.apache.stratos.mock.iaas/src/main/java/org/apache/stratos/mock/iaas/services/impl/MockInstance.java
@@ -43,10 +43,10 @@ import java.util.concurrent.TimeUnit;
 public class MockInstance implements Runnable, Serializable {
 
     private static final Log log = LogFactory.getLog(MockInstance.class);
-    private static final ExecutorService instanceNotifierExecutorService =
-            StratosThreadPool.getExecutorService("MOCK_MEMBER_INSTANCE_NOTIFIER_EXECUTOR_SERVICE", 20);
+    private static final ExecutorService eventListenerExecutorService =
+            StratosThreadPool.getExecutorService("mock.iaas.event.listener.thread.pool", 20);
     private static final ScheduledExecutorService healthStatNotifierExecutorService =
-            StratosThreadPool.getScheduledExecutorService("MOCK_MEMBER_HEALTH_STAT_NOTIFIER_EXECUTOR_SERVICE", 20);
+            StratosThreadPool.getScheduledExecutorService("mock.iaas.health.statistics.notifier.thread.pool", 20);
     private static final int HEALTH_STAT_INTERVAL = 15; // 15 seconds
 
     private final MockInstanceContext mockMemberContext;
@@ -108,7 +108,7 @@ public class MockInstance implements Runnable, Serializable {
             }
         });
 
-        instanceNotifierExecutorService.submit(new Runnable() {
+        eventListenerExecutorService.submit(new Runnable() {
             @Override
             public void run() {
                 instanceNotifierEventReceiver.execute();

http://git-wip-us.apache.org/repos/asf/stratos/blob/2c00b9fd/components/org.apache.stratos.mock.iaas/src/main/java/org/apache/stratos/mock/iaas/statistics/generator/MockHealthStatisticsGenerator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.mock.iaas/src/main/java/org/apache/stratos/mock/iaas/statistics/generator/MockHealthStatisticsGenerator.java b/components/org.apache.stratos.mock.iaas/src/main/java/org/apache/stratos/mock/iaas/statistics/generator/MockHealthStatisticsGenerator.java
index 095d5a7..208a12a 100644
--- a/components/org.apache.stratos.mock.iaas/src/main/java/org/apache/stratos/mock/iaas/statistics/generator/MockHealthStatisticsGenerator.java
+++ b/components/org.apache.stratos.mock.iaas/src/main/java/org/apache/stratos/mock/iaas/statistics/generator/MockHealthStatisticsGenerator.java
@@ -41,7 +41,7 @@ public class MockHealthStatisticsGenerator {
 
     private static volatile MockHealthStatisticsGenerator instance;
     private static final ScheduledExecutorService scheduledExecutorService =
-            StratosThreadPool.getScheduledExecutorService("MOCK_STATISTICS_GENERATOR_EXECUTOR_SERVICE", 10);
+            StratosThreadPool.getScheduledExecutorService("mock.iaas.health.statistics.generator.thread.pool", 10);
 
     private boolean scheduled;
     // Map<ServiceName, List<ScheduledFuture>>

http://git-wip-us.apache.org/repos/asf/stratos/blob/2c00b9fd/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/Main.java
----------------------------------------------------------------------
diff --git a/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/Main.java b/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/Main.java
index d7397ef..c6ee22b 100644
--- a/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/Main.java
+++ b/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/Main.java
@@ -44,7 +44,7 @@ public class Main {
 			if (log.isInfoEnabled()) {
 				log.info("HAProxy extension started");
 			}
-			executorService = StratosThreadPool.getExecutorService("Load_Balance_Extension", 10);
+			executorService = StratosThreadPool.getExecutorService("haproxy.extension.thread.pool", 10);
 			// Validate runtime parameters
 			HAProxyContext.getInstance().validate();
 			extension = new LoadBalancerExtension(new HAProxy(),