Repository: stratos Updated Branches: refs/heads/master 6d1562442 -> c84322805
s/CloudControllerClient/AutoscalerCloudControllerClient and move AutoscalerCloudControllerClient to autoscaler CC client Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/83ca4b92 Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/83ca4b92 Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/83ca4b92 Branch: refs/heads/master Commit: 83ca4b92581b7dde0e91701c6b0e7b8bc5ae66cb Parents: 6d15624 Author: Lahiru Sandaruwan <[email protected]> Authored: Sat Jun 13 07:35:10 2015 +0530 Committer: Lahiru Sandaruwan <[email protected]> Committed: Sat Jun 13 07:35:10 2015 +0530 ---------------------------------------------------------------------- .../applications/topic/ApplicationBuilder.java | 4 +- .../client/AutoscalerCloudControllerClient.java | 217 +++++++++++++++++++ .../client/CloudControllerClient.java | 207 ------------------ .../partition/ClusterLevelPartitionContext.java | 4 +- .../autoscaler/rule/RuleTasksDelegator.java | 4 +- .../client/CloudControllerServiceClient.java | 9 - 6 files changed, 223 insertions(+), 222 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/83ca4b92/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/topic/ApplicationBuilder.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/topic/ApplicationBuilder.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/topic/ApplicationBuilder.java index 03f8e05..31b5e8f 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/topic/ApplicationBuilder.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/topic/ApplicationBuilder.java @@ -23,7 +23,7 @@ import org.apache.commons.logging.LogFactory; import org.apache.stratos.autoscaler.applications.ApplicationHolder; import org.apache.stratos.autoscaler.applications.pojo.ApplicationClusterContext; import org.apache.stratos.autoscaler.applications.pojo.ApplicationContext; -import org.apache.stratos.autoscaler.client.CloudControllerClient; +import org.apache.stratos.autoscaler.client.AutoscalerCloudControllerClient; import org.apache.stratos.autoscaler.context.AutoscalerContext; import org.apache.stratos.autoscaler.context.partition.network.ParentLevelNetworkPartitionContext; import org.apache.stratos.autoscaler.context.partition.network.NetworkPartitionContext; @@ -74,7 +74,7 @@ public class ApplicationBuilder { log.debug("Handling application creation event: [application-id] " + application.getUniqueIdentifier()); } - CloudControllerClient.getInstance().createApplicationClusters(application.getUniqueIdentifier(), + AutoscalerCloudControllerClient.getInstance().createApplicationClusters(application.getUniqueIdentifier(), appClusterContexts); ApplicationHolder.persistApplication(application); ApplicationsEventPublisher.sendApplicationCreatedEvent(application); http://git-wip-us.apache.org/repos/asf/stratos/blob/83ca4b92/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/AutoscalerCloudControllerClient.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/AutoscalerCloudControllerClient.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/AutoscalerCloudControllerClient.java new file mode 100644 index 0000000..c6c59ed --- /dev/null +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/AutoscalerCloudControllerClient.java @@ -0,0 +1,217 @@ +/* + * 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. TcSee the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.stratos.autoscaler.client; + +import org.apache.axis2.transport.http.HTTPConstants; +import org.apache.commons.configuration.XMLConfiguration; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.stratos.autoscaler.applications.pojo.ApplicationClusterContext; +import org.apache.stratos.autoscaler.applications.pojo.VolumeContext; +import org.apache.stratos.autoscaler.exception.cartridge.SpawningException; +import org.apache.stratos.autoscaler.util.AutoscalerConstants; +import org.apache.stratos.autoscaler.util.AutoscalerObjectConverter; +import org.apache.stratos.autoscaler.util.AutoscalerUtil; +import org.apache.stratos.autoscaler.util.ConfUtil; +import org.apache.stratos.cloud.controller.stub.*; +import org.apache.stratos.cloud.controller.stub.domain.InstanceContext; +import org.apache.stratos.cloud.controller.stub.domain.MemberContext; +import org.apache.stratos.cloud.controller.stub.domain.Volume; +import org.apache.stratos.common.Properties; +import org.apache.stratos.common.Property; +import org.apache.stratos.common.constants.StratosConstants; +import org.apache.stratos.common.partition.PartitionRef; + +import java.rmi.RemoteException; +import java.util.ArrayList; +import java.util.List; + +/** + * This class will call cloud controller web service to take the action decided by Autoscaler + */ +public class AutoscalerCloudControllerClient { + + private static final Log log = LogFactory.getLog(AutoscalerCloudControllerClient.class); + + private static CloudControllerServiceStub stub; + + /* An instance of a CloudControllerClient is created when the class is loaded. + * Since the class is loaded only once, it is guaranteed that an object of + * CloudControllerClient is created only once. Hence it is singleton. + */ + private static class InstanceHolder { + private static final AutoscalerCloudControllerClient INSTANCE = new AutoscalerCloudControllerClient(); + } + + public static AutoscalerCloudControllerClient getInstance() { + return InstanceHolder.INSTANCE; + } + + private AutoscalerCloudControllerClient() { + try { + XMLConfiguration conf = ConfUtil.getInstance(null).getConfiguration(); + int port = conf.getInt("autoscaler.cloudController.port", AutoscalerConstants.CLOUD_CONTROLLER_DEFAULT_PORT); + String hostname = conf.getString("autoscaler.cloudController.hostname", "localhost"); + String epr = "https://" + hostname + ":" + port + "/" + AutoscalerConstants.CLOUD_CONTROLLER_SERVICE_SFX; + int cloudControllerClientTimeout = conf.getInt("autoscaler.cloudController.clientTimeout", 180000); + + stub = new CloudControllerServiceStub(epr); + stub._getServiceClient().getOptions().setProperty(HTTPConstants.SO_TIMEOUT, cloudControllerClientTimeout); + stub._getServiceClient().getOptions().setProperty(HTTPConstants.CONNECTION_TIMEOUT, + cloudControllerClientTimeout); + } catch (Exception e) { + log.error("Could not initialize cloud controller client", e); + } + } + + public synchronized MemberContext startInstance(PartitionRef partition, + String clusterId, String clusterInstanceId, + String networkPartitionId, boolean isPrimary, + int minMemberCount) throws SpawningException { + try { + if (log.isInfoEnabled()) { + log.info(String.format("Trying to spawn an instance via cloud controller: " + + "[cluster] %s [partition] %s [network-partition-id] %s", + clusterId, partition.getId(), networkPartitionId)); + } + + XMLConfiguration conf = ConfUtil.getInstance(null).getConfiguration(); + long expiryTime = conf.getLong(StratosConstants.OBSOLETED_MEMBER_EXPIRY_TIMEOUT, 86400000); + if (log.isDebugEnabled()) { + log.debug("Member obsolete expiry time is set to: " + expiryTime); + } + + InstanceContext instanceContext = new InstanceContext(); + instanceContext.setClusterId(clusterId); + instanceContext.setClusterInstanceId(clusterInstanceId); + instanceContext.setPartition(AutoscalerObjectConverter.convertPartitionToCCPartition(partition)); + instanceContext.setInitTime(System.currentTimeMillis()); + instanceContext.setObsoleteExpiryTime(expiryTime); + instanceContext.setNetworkPartitionId(networkPartitionId); + + Properties memberContextProps = new Properties(); + Property isPrimaryProp = new Property(); + isPrimaryProp.setName("PRIMARY"); + isPrimaryProp.setValue(String.valueOf(isPrimary)); + + Property minCountProp = new Property(); + minCountProp.setName(StratosConstants.MIN_COUNT); + minCountProp.setValue(String.valueOf(minMemberCount)); + + memberContextProps.addProperty(isPrimaryProp); + memberContextProps.addProperty(minCountProp); + instanceContext.setProperties(AutoscalerUtil.toStubProperties(memberContextProps)); + + long startTime = System.currentTimeMillis(); + MemberContext memberContext = stub.startInstance(instanceContext); + if (log.isDebugEnabled()) { + long endTime = System.currentTimeMillis(); + log.debug(String.format("Service call startInstance() returned in %dms", (endTime - startTime))); + } + return memberContext; + } catch (CloudControllerServiceCartridgeNotFoundExceptionException e) { + String message = e.getFaultMessage().getCartridgeNotFoundException().getMessage(); + log.error(message, e); + throw new SpawningException(message, e); + } catch (RemoteException e) { + log.error(e.getMessage(), e); + throw new SpawningException(e.getMessage(), e); + } catch (CloudControllerServiceInvalidIaasProviderExceptionException e) { + String message = e.getFaultMessage().getInvalidIaasProviderException().getMessage(); + log.error(message, e); + throw new SpawningException(message, e); + } catch (CloudControllerServiceCloudControllerExceptionException e) { + String message = e.getMessage(); + log.error(message, e); + throw new SpawningException(message, e); + } + } + + public synchronized void createApplicationClusters(String appId, + ApplicationClusterContext[] applicationClusterContexts) { + List<org.apache.stratos.cloud.controller.stub.domain.ApplicationClusterContext> contextDTOs = + new ArrayList<org.apache.stratos.cloud.controller.stub.domain.ApplicationClusterContext>(); + if (applicationClusterContexts != null) { + for (ApplicationClusterContext applicationClusterContext : applicationClusterContexts) { + if (applicationClusterContext != null) { + org.apache.stratos.cloud.controller.stub.domain.ApplicationClusterContext dto = + new org.apache.stratos.cloud.controller.stub.domain.ApplicationClusterContext(); + dto.setClusterId(applicationClusterContext.getClusterId()); + dto.setAutoscalePolicyName(applicationClusterContext.getAutoscalePolicyName()); + dto.setDeploymentPolicyName(applicationClusterContext.getDeploymentPolicyName()); + dto.setCartridgeType(applicationClusterContext.getCartridgeType()); + dto.setHostName(applicationClusterContext.getHostName()); + dto.setTenantRange(applicationClusterContext.getTenantRange()); + dto.setTextPayload(applicationClusterContext.getTextPayload()); + dto.setProperties(AutoscalerUtil.toStubProperties(applicationClusterContext.getProperties())); + dto.setDependencyClusterIds(applicationClusterContext.getDependencyClusterIds()); + if (applicationClusterContext.getPersistenceContext() != null) { + dto.setVolumeRequired(true); + dto.setVolumes(convertVolumesToStubVolumes( + applicationClusterContext.getPersistenceContext().getVolumes())); + } + contextDTOs.add(dto); + } + } + } + + org.apache.stratos.cloud.controller.stub.domain.ApplicationClusterContext[] applicationClusterContextDTOs = + new org.apache.stratos.cloud.controller.stub.domain.ApplicationClusterContext[contextDTOs.size()]; + contextDTOs.toArray(applicationClusterContextDTOs); + try { + stub.createApplicationClusters(appId, applicationClusterContextDTOs); + } catch (RemoteException e) { + String msg = e.getMessage(); + log.error(msg, e); + } catch (CloudControllerServiceApplicationClusterRegistrationExceptionException e) { + String msg = e.getMessage(); + log.error(msg, e); + } + } + + + private Volume[] convertVolumesToStubVolumes(VolumeContext[] volumeContexts) { + + ArrayList<Volume> volumes = new ArrayList<Volume>(); + for (VolumeContext volumeContext : volumeContexts) { + Volume volume = new Volume(); + volume.setRemoveOntermination(volumeContext.isRemoveOntermination()); + volume.setMappingPath(volumeContext.getMappingPath()); + volume.setId(volumeContext.getId()); + volume.setDevice(volumeContext.getDevice()); + volume.setIaasType(volumeContext.getIaasType()); + volume.setSnapshotId(volumeContext.getSnapshotId()); + volume.setVolumeId(volumeContext.getVolumeId()); + volume.setSize(volumeContext.getSize()); + volumes.add(volume); + } + return volumes.toArray(new Volume[volumes.size()]); + } + + public void removeExpiredObsoletedMemberFromCloudController(MemberContext member) { + try { + + stub.removeExpiredObsoletedMemberFromCloudController(member); + } catch (RemoteException e) { + log.error(String.format("Error while removing member from cloud controller for obsolete " + + "member, [member-id] %s ", member.getMemberId())); + } + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/83ca4b92/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/CloudControllerClient.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/CloudControllerClient.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/CloudControllerClient.java deleted file mode 100644 index 478f5ed..0000000 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/CloudControllerClient.java +++ /dev/null @@ -1,207 +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. TcSee the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.stratos.autoscaler.client; - -import org.apache.axis2.transport.http.HTTPConstants; -import org.apache.commons.configuration.XMLConfiguration; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.stratos.autoscaler.applications.pojo.ApplicationClusterContext; -import org.apache.stratos.autoscaler.applications.pojo.VolumeContext; -import org.apache.stratos.autoscaler.exception.cartridge.SpawningException; -import org.apache.stratos.autoscaler.util.AutoscalerConstants; -import org.apache.stratos.autoscaler.util.AutoscalerObjectConverter; -import org.apache.stratos.autoscaler.util.AutoscalerUtil; -import org.apache.stratos.autoscaler.util.ConfUtil; -import org.apache.stratos.cloud.controller.stub.*; -import org.apache.stratos.cloud.controller.stub.domain.InstanceContext; -import org.apache.stratos.cloud.controller.stub.domain.MemberContext; -import org.apache.stratos.cloud.controller.stub.domain.Volume; -import org.apache.stratos.common.Properties; -import org.apache.stratos.common.Property; -import org.apache.stratos.common.constants.StratosConstants; -import org.apache.stratos.common.partition.PartitionRef; - -import java.rmi.RemoteException; -import java.util.ArrayList; -import java.util.List; - -/** - * This class will call cloud controller web service to take the action decided by Autoscaler - */ -public class CloudControllerClient { - - private static final Log log = LogFactory.getLog(CloudControllerClient.class); - - private static CloudControllerServiceStub stub; - - /* An instance of a CloudControllerClient is created when the class is loaded. - * Since the class is loaded only once, it is guaranteed that an object of - * CloudControllerClient is created only once. Hence it is singleton. - */ - private static class InstanceHolder { - private static final CloudControllerClient INSTANCE = new CloudControllerClient(); - } - - public static CloudControllerClient getInstance() { - return InstanceHolder.INSTANCE; - } - - private CloudControllerClient() { - try { - XMLConfiguration conf = ConfUtil.getInstance(null).getConfiguration(); - int port = conf.getInt("autoscaler.cloudController.port", AutoscalerConstants.CLOUD_CONTROLLER_DEFAULT_PORT); - String hostname = conf.getString("autoscaler.cloudController.hostname", "localhost"); - String epr = "https://" + hostname + ":" + port + "/" + AutoscalerConstants.CLOUD_CONTROLLER_SERVICE_SFX; - int cloudControllerClientTimeout = conf.getInt("autoscaler.cloudController.clientTimeout", 180000); - - stub = new CloudControllerServiceStub(epr); - stub._getServiceClient().getOptions().setProperty(HTTPConstants.SO_TIMEOUT, cloudControllerClientTimeout); - stub._getServiceClient().getOptions().setProperty(HTTPConstants.CONNECTION_TIMEOUT, - cloudControllerClientTimeout); - } catch (Exception e) { - log.error("Could not initialize cloud controller client", e); - } - } - - public synchronized MemberContext startInstance(PartitionRef partition, - String clusterId, String clusterInstanceId, - String networkPartitionId, boolean isPrimary, - int minMemberCount) throws SpawningException { - try { - if (log.isInfoEnabled()) { - log.info(String.format("Trying to spawn an instance via cloud controller: " + - "[cluster] %s [partition] %s [network-partition-id] %s", - clusterId, partition.getId(), networkPartitionId)); - } - - XMLConfiguration conf = ConfUtil.getInstance(null).getConfiguration(); - long expiryTime = conf.getLong(StratosConstants.OBSOLETED_MEMBER_EXPIRY_TIMEOUT, 86400000); - if (log.isDebugEnabled()) { - log.debug("Member obsolete expiry time is set to: " + expiryTime); - } - - InstanceContext instanceContext = new InstanceContext(); - instanceContext.setClusterId(clusterId); - instanceContext.setClusterInstanceId(clusterInstanceId); - instanceContext.setPartition(AutoscalerObjectConverter.convertPartitionToCCPartition(partition)); - instanceContext.setInitTime(System.currentTimeMillis()); - instanceContext.setObsoleteExpiryTime(expiryTime); - instanceContext.setNetworkPartitionId(networkPartitionId); - - Properties memberContextProps = new Properties(); - Property isPrimaryProp = new Property(); - isPrimaryProp.setName("PRIMARY"); - isPrimaryProp.setValue(String.valueOf(isPrimary)); - - Property minCountProp = new Property(); - minCountProp.setName(StratosConstants.MIN_COUNT); - minCountProp.setValue(String.valueOf(minMemberCount)); - - memberContextProps.addProperty(isPrimaryProp); - memberContextProps.addProperty(minCountProp); - instanceContext.setProperties(AutoscalerUtil.toStubProperties(memberContextProps)); - - long startTime = System.currentTimeMillis(); - MemberContext memberContext = stub.startInstance(instanceContext); - if (log.isDebugEnabled()) { - long endTime = System.currentTimeMillis(); - log.debug(String.format("Service call startInstance() returned in %dms", (endTime - startTime))); - } - return memberContext; - } catch (CloudControllerServiceCartridgeNotFoundExceptionException e) { - String message = e.getFaultMessage().getCartridgeNotFoundException().getMessage(); - log.error(message, e); - throw new SpawningException(message, e); - } catch (RemoteException e) { - log.error(e.getMessage(), e); - throw new SpawningException(e.getMessage(), e); - } catch (CloudControllerServiceInvalidIaasProviderExceptionException e) { - String message = e.getFaultMessage().getInvalidIaasProviderException().getMessage(); - log.error(message, e); - throw new SpawningException(message, e); - } catch (CloudControllerServiceCloudControllerExceptionException e) { - String message = e.getMessage(); - log.error(message, e); - throw new SpawningException(message, e); - } - } - - public synchronized void createApplicationClusters(String appId, - ApplicationClusterContext[] applicationClusterContexts) { - List<org.apache.stratos.cloud.controller.stub.domain.ApplicationClusterContext> contextDTOs = - new ArrayList<org.apache.stratos.cloud.controller.stub.domain.ApplicationClusterContext>(); - if (applicationClusterContexts != null) { - for (ApplicationClusterContext applicationClusterContext : applicationClusterContexts) { - if (applicationClusterContext != null) { - org.apache.stratos.cloud.controller.stub.domain.ApplicationClusterContext dto = - new org.apache.stratos.cloud.controller.stub.domain.ApplicationClusterContext(); - dto.setClusterId(applicationClusterContext.getClusterId()); - dto.setAutoscalePolicyName(applicationClusterContext.getAutoscalePolicyName()); - dto.setDeploymentPolicyName(applicationClusterContext.getDeploymentPolicyName()); - dto.setCartridgeType(applicationClusterContext.getCartridgeType()); - dto.setHostName(applicationClusterContext.getHostName()); - dto.setTenantRange(applicationClusterContext.getTenantRange()); - dto.setTextPayload(applicationClusterContext.getTextPayload()); - dto.setProperties(AutoscalerUtil.toStubProperties(applicationClusterContext.getProperties())); - dto.setDependencyClusterIds(applicationClusterContext.getDependencyClusterIds()); - if (applicationClusterContext.getPersistenceContext() != null) { - dto.setVolumeRequired(true); - dto.setVolumes(convertVolumesToStubVolumes( - applicationClusterContext.getPersistenceContext().getVolumes())); - } - contextDTOs.add(dto); - } - } - } - - org.apache.stratos.cloud.controller.stub.domain.ApplicationClusterContext[] applicationClusterContextDTOs = - new org.apache.stratos.cloud.controller.stub.domain.ApplicationClusterContext[contextDTOs.size()]; - contextDTOs.toArray(applicationClusterContextDTOs); - try { - stub.createApplicationClusters(appId, applicationClusterContextDTOs); - } catch (RemoteException e) { - String msg = e.getMessage(); - log.error(msg, e); - } catch (CloudControllerServiceApplicationClusterRegistrationExceptionException e) { - String msg = e.getMessage(); - log.error(msg, e); - } - } - - - private Volume[] convertVolumesToStubVolumes(VolumeContext[] volumeContexts) { - - ArrayList<Volume> volumes = new ArrayList<Volume>(); - for (VolumeContext volumeContext : volumeContexts) { - Volume volume = new Volume(); - volume.setRemoveOntermination(volumeContext.isRemoveOntermination()); - volume.setMappingPath(volumeContext.getMappingPath()); - volume.setId(volumeContext.getId()); - volume.setDevice(volumeContext.getDevice()); - volume.setIaasType(volumeContext.getIaasType()); - volume.setSnapshotId(volumeContext.getSnapshotId()); - volume.setVolumeId(volumeContext.getVolumeId()); - volume.setSize(volumeContext.getSize()); - volumes.add(volume); - } - return volumes.toArray(new Volume[volumes.size()]); - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/83ca4b92/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/partition/ClusterLevelPartitionContext.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/partition/ClusterLevelPartitionContext.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/partition/ClusterLevelPartitionContext.java index 9464060..4985fb0 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/partition/ClusterLevelPartitionContext.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/partition/ClusterLevelPartitionContext.java @@ -22,6 +22,7 @@ import org.apache.axis2.AxisFault; import org.apache.commons.configuration.XMLConfiguration; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.stratos.autoscaler.client.AutoscalerCloudControllerClient; import org.apache.stratos.autoscaler.context.member.MemberStatsContext; import org.apache.stratos.autoscaler.util.ConfUtil; import org.apache.stratos.cloud.controller.stub.domain.MemberContext; @@ -30,7 +31,6 @@ import org.apache.stratos.common.constants.StratosConstants; import org.apache.stratos.common.partition.PartitionRef; import java.io.Serializable; -import java.rmi.RemoteException; import java.util.*; import java.util.Map.Entry; import java.util.concurrent.ConcurrentHashMap; @@ -720,7 +720,7 @@ public class ClusterLevelPartitionContext extends PartitionContext implements Se //notifying CC, about the removal of obsolete member try { - CloudControllerServiceClient.getInstance().removeExpiredObsoletedMemberFromCloudController( + AutoscalerCloudControllerClient.getInstance().removeExpiredObsoletedMemberFromCloudController( obsoleteMember); } catch (AxisFault axisFault) { log.error(String.format("Error while removing member from cloud controller for obsolete " + http://git-wip-us.apache.org/repos/asf/stratos/blob/83ca4b92/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/RuleTasksDelegator.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/RuleTasksDelegator.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/RuleTasksDelegator.java index 0ad79fb..a996c0b 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/RuleTasksDelegator.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/RuleTasksDelegator.java @@ -26,7 +26,7 @@ import org.apache.commons.logging.LogFactory; import org.apache.stratos.autoscaler.algorithms.PartitionAlgorithm; import org.apache.stratos.autoscaler.algorithms.partition.OneAfterAnother; import org.apache.stratos.autoscaler.algorithms.partition.RoundRobin; -import org.apache.stratos.autoscaler.client.CloudControllerClient; +import org.apache.stratos.autoscaler.client.AutoscalerCloudControllerClient; import org.apache.stratos.autoscaler.context.AutoscalerContext; import org.apache.stratos.autoscaler.context.cluster.ClusterContext; import org.apache.stratos.autoscaler.context.cluster.ClusterInstanceContext; @@ -194,7 +194,7 @@ public class RuleTasksDelegator { minimumCountOfNetworkPartition = clusterInstanceContext.getMinInstanceCount(); MemberContext memberContext = - CloudControllerClient.getInstance() + AutoscalerCloudControllerClient.getInstance() .startInstance(clusterMonitorPartitionContext.getPartition(), clusterId, clusterInstanceId, clusterMonitorPartitionContext.getNetworkPartitionId(), http://git-wip-us.apache.org/repos/asf/stratos/blob/83ca4b92/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/CloudControllerServiceClient.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/CloudControllerServiceClient.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/CloudControllerServiceClient.java index ad37f2b..890fd59 100644 --- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/CloudControllerServiceClient.java +++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/CloudControllerServiceClient.java @@ -264,13 +264,4 @@ public class CloudControllerServiceClient { } } - public void removeExpiredObsoletedMemberFromCloudController(MemberContext member) { - try { - - stub.removeExpiredObsoletedMemberFromCloudController(member); - } catch (RemoteException e) { - log.error(String.format("Error while removing member from cloud controller for obsolete " + - "member, [member-id] %s ", member.getMemberId())); - } - } }
