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 2013/11/19 18:07:23 UTC
[1/2] git commit: Introduced an optimized data structure in load
balancer context to fetch cluster information using hostname
Updated Branches:
refs/heads/master acf4e629e -> b6fa20233
Introduced an optimized data structure in load balancer context to fetch cluster information using hostname
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/955bc29f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/955bc29f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/955bc29f
Branch: refs/heads/master
Commit: 955bc29f0d3659ae024980c14ecaf88e3a765e11
Parents: 6e8221d
Author: Imesh Gunaratne <im...@apache.org>
Authored: Tue Nov 19 22:35:53 2013 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Tue Nov 19 22:35:53 2013 +0530
----------------------------------------------------------------------
.../topology/TopologyEventSender.java | 10 +-
.../extension/api/LoadBalancerExtension.java | 2 +-
.../load/balancer/LoadBalancerContext.java | 64 +++++-
.../balancer/LoadBalancerTopologyReceiver.java | 207 +++++++++++++++++++
.../stratos/load/balancer/RequestDelegator.java | 42 ++--
.../internal/LoadBalancerServiceComponent.java | 26 +--
components/org.apache.stratos.messaging/pom.xml | 6 +-
.../stratos/messaging/event/EventListener.java | 50 -----
.../messaging/event/EventObservable.java | 2 +
.../event/topology/ClusterCreatedEvent.java | 3 +-
.../topology/ClusterCreatedEventListener.java | 30 ---
.../event/topology/ClusterRemovedEvent.java | 15 ++
.../topology/ClusterRemovedEventListener.java | 30 ---
.../topology/CompleteTopologyEventListener.java | 30 ---
.../topology/InstanceSpawnedEventListener.java | 30 ---
.../topology/MemberActivatedEventListener.java | 30 ---
.../topology/MemberStartedEventListener.java | 30 ---
.../topology/MemberSuspendedEventListener.java | 30 ---
.../topology/MemberTerminatedEventListener.java | 30 ---
.../topology/ServiceCreatedEventListener.java | 30 ---
.../topology/ServiceRemovedEventListener.java | 30 ---
.../messaging/listener/EventListener.java | 51 +++++
.../topology/ClusterCreatedEventListener.java | 30 +++
.../topology/ClusterRemovedEventListener.java | 30 +++
.../topology/CompleteTopologyEventListener.java | 30 +++
.../topology/InstanceSpawnedEventListener.java | 30 +++
.../topology/MemberActivatedEventListener.java | 30 +++
.../topology/MemberStartedEventListener.java | 30 +++
.../topology/MemberSuspendedEventListener.java | 30 +++
.../topology/MemberTerminatedEventListener.java | 30 +++
.../topology/ServiceCreatedEventListener.java | 30 +++
.../topology/ServiceRemovedEventListener.java | 30 +++
.../topology/ClusterCreatedEventProcessor.java | 9 +-
.../topology/ClusterRemovedEventProcessor.java | 10 +-
.../topology/TopologyEventProcessorChain.java | 4 +-
.../topology/TopologyEventMessageDelegator.java | 3 +-
.../load-balancer/modules/p2-profile/pom.xml | 8 +
37 files changed, 689 insertions(+), 423 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/955bc29f/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyEventSender.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyEventSender.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyEventSender.java
index 1986157..f0b5c37 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyEventSender.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyEventSender.java
@@ -109,8 +109,8 @@ public class TopologyEventSender {
public static void sendClusterCreatedEvent(ServiceContext serviceContext) {
ClusterCreatedEvent clusterCreatedEvent = new ClusterCreatedEvent(serviceContext.getCartridgeType(),
- serviceContext.getClusterId());
- clusterCreatedEvent.setHostName(serviceContext.getHostName());
+ serviceContext.getClusterId(),
+ serviceContext.getHostName());
clusterCreatedEvent.setTenantRange(serviceContext.getTenantRange());
clusterCreatedEvent.setAutoscalingPolicyName(serviceContext.getAutoScalerPolicyName());
@@ -123,9 +123,9 @@ public class TopologyEventSender {
}
public static void sendClusterRemovedEvent(ServiceContext serviceContext) {
- ClusterRemovedEvent clusterRemovedEvent = new ClusterRemovedEvent();
- clusterRemovedEvent.setClusterId(serviceContext.getClusterId());
- clusterRemovedEvent.setServiceName(serviceContext.getCartridgeType());
+ ClusterRemovedEvent clusterRemovedEvent = new ClusterRemovedEvent(serviceContext.getCartridgeType(),
+ serviceContext.getClusterId(),
+ serviceContext.getHostName());
if(log.isInfoEnabled()) {
log.info(String.format("Publishing cluster removed event: [service] %s [cluster] %s", serviceContext.getCartridgeType(), serviceContext.getClusterId()));
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/955bc29f/components/org.apache.stratos.load.balancer.extension.api/src/main/java/org/apache/stratos/load/balancer/extension/api/LoadBalancerExtension.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.load.balancer.extension.api/src/main/java/org/apache/stratos/load/balancer/extension/api/LoadBalancerExtension.java b/components/org.apache.stratos.load.balancer.extension.api/src/main/java/org/apache/stratos/load/balancer/extension/api/LoadBalancerExtension.java
index 74af8f9..61781c9 100644
--- a/components/org.apache.stratos.load.balancer.extension.api/src/main/java/org/apache/stratos/load/balancer/extension/api/LoadBalancerExtension.java
+++ b/components/org.apache.stratos.load.balancer.extension.api/src/main/java/org/apache/stratos/load/balancer/extension/api/LoadBalancerExtension.java
@@ -23,7 +23,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.stratos.load.balancer.common.topology.TopologyReceiver;
import org.apache.stratos.messaging.event.Event;
-import org.apache.stratos.messaging.event.topology.*;
+import org.apache.stratos.messaging.listener.topology.*;
import org.apache.stratos.messaging.message.processor.topology.TopologyEventProcessorChain;
import org.apache.stratos.messaging.message.receiver.topology.TopologyEventMessageDelegator;
import org.apache.stratos.messaging.message.receiver.topology.TopologyManager;
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/955bc29f/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/LoadBalancerContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/LoadBalancerContext.java b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/LoadBalancerContext.java
index 02f1a23..16b8c4b 100644
--- a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/LoadBalancerContext.java
+++ b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/LoadBalancerContext.java
@@ -23,6 +23,7 @@ import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.engine.AxisConfiguration;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.domain.topology.Cluster;
import org.apache.synapse.config.SynapseConfiguration;
import org.wso2.carbon.mediation.dependency.mgt.services.DependencyManagementService;
import org.wso2.carbon.mediation.initializer.services.SynapseEnvironmentService;
@@ -38,8 +39,8 @@ import java.util.Map;
*/
public class LoadBalancerContext {
- private static volatile LoadBalancerContext instance;
private static final Log log = LogFactory.getLog(LoadBalancerContext.class);
+ private static volatile LoadBalancerContext instance;
private SynapseConfiguration synapseConfiguration;
private ConfigurationContext configCtxt;
@@ -47,16 +48,21 @@ public class LoadBalancerContext {
private UserRegistry configRegistry;
private UserRegistry governanceRegistry;
private DependencyManagementService dependencyManager;
- private Map<Integer, SynapseEnvironmentService> synapseEnvironmentServices;
+ // <TenantId, SynapseEnvironmentService> Map
+ private Map<Integer, SynapseEnvironmentService> synapseEnvironmentServices;
+ // <ServiceName, ServiceContext> Map
private Map<String, ServiceContext> serviceContextMap;
+ // <ClusterId, ClusterContext> Map
private Map<String, ClusterContext> clusterContextMap;
+ // <Hostname, Cluster> Map
+ private Map<String, Cluster> clusterMap;
private LoadBalancerContext() {
synapseEnvironmentServices = new HashMap<Integer, SynapseEnvironmentService>();
-
serviceContextMap = new HashMap<String, ServiceContext>();
clusterContextMap = new HashMap<String, ClusterContext>();
+ clusterMap = new HashMap<String, Cluster>();
}
public static synchronized LoadBalancerContext getInstance() {
@@ -131,16 +137,16 @@ public class LoadBalancerContext {
this.governanceRegistry = governanceRegistry;
}
- public SynapseEnvironmentService getSynapseEnvironmentService(int id) {
- return synapseEnvironmentServices.get(id);
+ public SynapseEnvironmentService getSynapseEnvironmentService(int tenantId) {
+ return synapseEnvironmentServices.get(tenantId);
}
- public void addSynapseEnvironmentService(int id, SynapseEnvironmentService synapseEnvironmentService) {
- synapseEnvironmentServices.put(id, synapseEnvironmentService);
+ public void addSynapseEnvironmentService(int tenantId, SynapseEnvironmentService synapseEnvironmentService) {
+ synapseEnvironmentServices.put(tenantId, synapseEnvironmentService);
}
- public void removeSynapseEnvironmentService(int id) {
- synapseEnvironmentServices.remove(id);
+ public void removeSynapseEnvironmentService(int tenantId) {
+ synapseEnvironmentServices.remove(tenantId);
}
public Map<Integer, SynapseEnvironmentService> getSynapseEnvironmentServices() {
@@ -155,6 +161,7 @@ public class LoadBalancerContext {
this.configCtxt = configCtxt;
}
+ // ServiceContextMap methods START
public Collection<ServiceContext> getServiceContexts() {
return serviceContextMap.values();
}
@@ -167,6 +174,12 @@ public class LoadBalancerContext {
serviceContextMap.put(serviceContext.getServiceName(), serviceContext);
}
+ public void removeServiceContext(String serviceName) {
+ serviceContextMap.remove(serviceName);
+ }
+ // ServiceContextMap methods END
+
+ // ClusterContextMap methods START
public Collection<ClusterContext> getClusterContexts() {
return clusterContextMap.values();
}
@@ -178,4 +191,37 @@ public class LoadBalancerContext {
public void addClusterContext(ClusterContext clusterContext) {
clusterContextMap.put(clusterContext.getClusterId(), clusterContext);
}
+
+ public void removeClusterContext(String clusterId) {
+ clusterContextMap.remove(clusterId);
+ }
+ // ClusterContextMap methods END
+
+ // ClusterMap methods START
+ public Collection<Cluster> getClusters() {
+ return clusterMap.values();
+ }
+
+ public Cluster getCluster(String hostName) {
+ long startTime = System.currentTimeMillis();
+ Cluster cluster = clusterMap.get(hostName);
+ long endTime = System.currentTimeMillis();
+ if(log.isDebugEnabled()) {
+ log.debug(String.format("Cluster resolved using hostname in %dms: [cluster] %s [hostname] %s", (endTime - startTime), cluster.getClusterId(), hostName));
+ }
+ return cluster;
+ }
+
+ public boolean clusterExists(String hostName) {
+ return clusterMap.containsKey(hostName);
+ }
+
+ public void addCluster(Cluster cluster) {
+ clusterMap.put(cluster.getHostName(), cluster);
+ }
+
+ public void removeCluster(String hostName) {
+ clusterMap.remove(hostName);
+ }
+ // ClusterMap methods END
}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/955bc29f/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/LoadBalancerTopologyReceiver.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/LoadBalancerTopologyReceiver.java b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/LoadBalancerTopologyReceiver.java
new file mode 100644
index 0000000..fdbca11
--- /dev/null
+++ b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/LoadBalancerTopologyReceiver.java
@@ -0,0 +1,207 @@
+/*
+ * 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.load.balancer;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.load.balancer.common.topology.TopologyReceiver;
+import org.apache.stratos.messaging.domain.topology.Cluster;
+import org.apache.stratos.messaging.domain.topology.Member;
+import org.apache.stratos.messaging.domain.topology.Service;
+import org.apache.stratos.messaging.event.Event;
+import org.apache.stratos.messaging.listener.topology.ClusterRemovedEventListener;
+import org.apache.stratos.messaging.listener.topology.CompleteTopologyEventListener;
+import org.apache.stratos.messaging.listener.topology.MemberActivatedEventListener;
+import org.apache.stratos.messaging.listener.topology.ServiceRemovedEventListener;
+import org.apache.stratos.messaging.event.topology.*;
+import org.apache.stratos.messaging.message.processor.topology.TopologyEventProcessorChain;
+import org.apache.stratos.messaging.message.receiver.topology.TopologyEventMessageDelegator;
+import org.apache.stratos.messaging.message.receiver.topology.TopologyManager;
+
+import java.util.Collection;
+
+/**
+ * Load balancer topology receiver.
+ */
+public class LoadBalancerTopologyReceiver implements Runnable {
+
+ private static final Log log = LogFactory.getLog(LoadBalancerTopologyReceiver.class);
+
+ private TopologyReceiver topologyReceiver;
+ private boolean terminated;
+
+ public LoadBalancerTopologyReceiver() {
+ this.topologyReceiver = new TopologyReceiver(createMessageDelegator());
+ }
+
+ @Override
+ public void run() {
+ Thread thread = new Thread(topologyReceiver);
+ thread.start();
+ if(log.isInfoEnabled()) {
+ log.info("Load balancer topology receiver thread started");
+ }
+
+ // Keep the thread live until terminated
+ while (!terminated);
+ if(log.isInfoEnabled()) {
+ log.info("Load balancer topology receiver thread terminated");
+ }
+ }
+
+ private TopologyEventMessageDelegator createMessageDelegator() {
+ TopologyEventProcessorChain processorChain = createEventProcessorChain();
+ final TopologyEventMessageDelegator messageDelegator = new TopologyEventMessageDelegator(processorChain);
+ messageDelegator.addCompleteTopologyEventListener(new CompleteTopologyEventListener() {
+ @Override
+ protected void onEvent(Event event) {
+ try {
+ TopologyManager.acquireReadLock();
+ for(Service service : TopologyManager.getTopology().getServices()) {
+ for(Cluster cluster : service.getClusters()) {
+ if(hasActiveMembers(cluster)) {
+ addClusterToContext(cluster);
+ }
+ }
+ }
+ }
+ finally {
+ TopologyManager.releaseReadLock();
+ }
+ // Complete topology is only consumed once, remove listener
+ messageDelegator.removeCompleteTopologyEventListener(this);
+ }
+
+ private boolean hasActiveMembers(Cluster cluster) {
+ for(Member member : cluster.getMembers()) {
+ if(member.isActive()) {
+ return true;
+ }
+ }
+ return false;
+ }
+ });
+ return messageDelegator;
+ }
+
+ private TopologyEventProcessorChain createEventProcessorChain() {
+ // Listen to topology events that affect clusters
+ TopologyEventProcessorChain processorChain = new TopologyEventProcessorChain();
+ processorChain.addEventListener(new MemberActivatedEventListener() {
+ @Override
+ protected void onEvent(Event event) {
+ try {
+ TopologyManager.acquireReadLock();
+
+ // Add cluster to the context when its first member is activated
+ MemberActivatedEvent memberActivatedEvent = (MemberActivatedEvent)event;
+ Cluster cluster = findCluster(memberActivatedEvent.getClusterId());
+ if(cluster == null) {
+ if(log.isErrorEnabled()) {
+ log.error(String.format("Cluster not found in topology: [cluster] %s", memberActivatedEvent.getClusterId()));
+ }
+ }
+ addClusterToContext(cluster);
+ }
+ finally {
+ TopologyManager.releaseReadLock();
+ }
+ }
+ });
+ processorChain.addEventListener(new ClusterRemovedEventListener() {
+ @Override
+ protected void onEvent(Event event) {
+ try {
+ TopologyManager.acquireReadLock();
+
+ // Remove cluster from context
+ ClusterRemovedEvent clusterRemovedEvent = (ClusterRemovedEvent)event;
+ removeClusterFromContext(clusterRemovedEvent.getHostName());
+ }
+ finally {
+ TopologyManager.releaseReadLock();
+ }
+ }
+ });
+ processorChain.addEventListener(new ServiceRemovedEventListener() {
+ @Override
+ protected void onEvent(Event event) {
+ try {
+ TopologyManager.acquireReadLock();
+
+ // Remove all clusters of given service from context
+ ServiceRemovedEvent serviceRemovedEvent = (ServiceRemovedEvent)event;
+ for(Service service : TopologyManager.getTopology().getServices()) {
+ for(Cluster cluster : service.getClusters()) {
+ removeClusterFromContext(cluster.getHostName());
+ }
+ }
+ }
+ finally {
+ TopologyManager.releaseReadLock();
+ }
+ }
+ });
+ return processorChain;
+ }
+
+ private void addClusterToContext(Cluster cluster) {
+ if(!LoadBalancerContext.getInstance().clusterExists(cluster.getHostName())) {
+ LoadBalancerContext.getInstance().addCluster(cluster);
+ if(log.isDebugEnabled()) {
+ log.debug(String.format("Cluster added to load balancer context: [cluster] %s [hostname] %s", cluster.getClusterId(), cluster.getHostName()));
+ }
+ }
+ }
+
+ private void removeClusterFromContext(String hostName) {
+ if(LoadBalancerContext.getInstance().clusterExists(hostName)) {
+ Cluster cluster = LoadBalancerContext.getInstance().getCluster(hostName);
+ LoadBalancerContext.getInstance().removeCluster(hostName);
+ if(log.isDebugEnabled()) {
+ log.debug(String.format("Cluster removed from load balancer context: [cluster] %s [hostname] %s", cluster.getClusterId(), hostName));
+ }
+ }
+ }
+
+ private Cluster findCluster(String clusterId) {
+ if(clusterId == null) {
+ return null;
+ }
+
+ Collection<Service> services = TopologyManager.getTopology().getServices();
+ for (Service service : services) {
+ for (Cluster cluster : service.getClusters()) {
+ if (clusterId.equals(cluster.getClusterId())) {
+ return cluster;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Terminate load balancer topology receiver thread.
+ */
+ public void terminate() {
+ topologyReceiver.terminate();
+ terminated = true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/955bc29f/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/RequestDelegator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/RequestDelegator.java b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/RequestDelegator.java
index 583541b..11ea81d 100644
--- a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/RequestDelegator.java
+++ b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/RequestDelegator.java
@@ -45,15 +45,16 @@ public class RequestDelegator {
this.algorithm = algorithm;
}
- public Member findNextMember(String targetHost) {
+ public Member findNextMember(String hostName) {
try {
- if(targetHost == null)
+ if(hostName == null)
return null;
TopologyManager.acquireReadLock();
+ long startTime = System.currentTimeMillis();
- Cluster cluster = findCluster(targetHost);
+ Cluster cluster = LoadBalancerContext.getInstance().getCluster(hostName);
if(cluster != null) {
// Find algorithm context of the cluster
ClusterContext clusterContext = LoadBalancerContext.getInstance().getClusterContext(cluster.getClusterId());
@@ -69,8 +70,9 @@ public class RequestDelegator {
}
algorithm.setMembers(new ArrayList<Member>(cluster.getMembers()));
Member member = algorithm.getNextMember(algorithmContext);
+ long endTime = System.currentTimeMillis();
if(log.isDebugEnabled()) {
- log.debug(String.format("Next member found: service: %s cluster id: %s member id: %s", member.getServiceName(), member.getClusterId(), member.getMemberId()));
+ log.debug(String.format("Next member identified in %dms: [service] %s [cluster] %s [member] %s", (endTime - startTime), member.getServiceName(), member.getClusterId(), member.getMemberId()));
}
return member;
}
@@ -81,32 +83,16 @@ public class RequestDelegator {
}
}
- public Member findNextMember(String serviceName, int tenantId, String targetHost) {
- throw new NotImplementedException();
- }
+ public boolean isTargetHostValid(String hostName) {
+ try {
+ if(hostName == null)
+ return false;
- private Service findService(String serviceName) {
- Collection<Service> services = TopologyManager.getTopology().getServices();
- for (Service service : services) {
- if(service.getServiceName().equals(serviceName))
- return service;
+ TopologyManager.acquireReadLock();
+ return LoadBalancerContext.getInstance().clusterExists(hostName);
}
- return null;
- }
-
- private Cluster findCluster(String targetHost) {
- Collection<Service> services = TopologyManager.getTopology().getServices();
- for (Service service : services) {
- for (Cluster cluster : service.getClusters()) {
- if (targetHost.equals(cluster.getHostName())) {
- return cluster;
- }
- }
+ finally {
+ TopologyManager.releaseReadLock();
}
- return null;
- }
-
- public boolean isTargetHostValid(String targetHost) {
- return (findCluster(targetHost) != null);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/955bc29f/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/internal/LoadBalancerServiceComponent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/internal/LoadBalancerServiceComponent.java b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/internal/LoadBalancerServiceComponent.java
index 440a6fb..304dd55 100644
--- a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/internal/LoadBalancerServiceComponent.java
+++ b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/internal/LoadBalancerServiceComponent.java
@@ -22,13 +22,10 @@ package org.apache.stratos.load.balancer.internal;
import org.apache.axis2.deployment.DeploymentEngine;
import org.apache.axis2.engine.AxisConfiguration;
import org.apache.stratos.load.balancer.LoadBalancerContext;
+import org.apache.stratos.load.balancer.LoadBalancerTopologyReceiver;
import org.apache.stratos.load.balancer.TenantAwareLoadBalanceEndpointException;
-import org.apache.stratos.messaging.message.receiver.topology.TopologyEventMessageDelegator;
-import org.apache.stratos.messaging.message.receiver.topology.TopologyEventMessageReceiver;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.broker.subscribe.TopicSubscriber;
-import org.apache.stratos.messaging.util.Constants;
import org.apache.synapse.config.SynapseConfiguration;
import org.apache.synapse.config.xml.MultiXMLConfigurationBuilder;
import org.apache.synapse.core.SynapseEnvironment;
@@ -92,6 +89,7 @@ public class LoadBalancerServiceComponent {
private static final Log log = LogFactory.getLog(LoadBalancerServiceComponent.class);
private boolean activated = false;
+ private LoadBalancerTopologyReceiver topologyReceiver;
protected void activate(ComponentContext ctxt) {
try {
@@ -101,20 +99,12 @@ public class LoadBalancerServiceComponent {
registerDeployer(LoadBalancerContext.getInstance().getAxisConfiguration(),
synEnvService.getSynapseEnvironment());
- // Start topic subscriber thread
- TopicSubscriber topicSubscriber = new TopicSubscriber(Constants.TOPOLOGY_TOPIC);
- topicSubscriber.setMessageListener(new TopologyEventMessageReceiver());
- Thread subscriberThread = new Thread(topicSubscriber);
- subscriberThread.start();
- if (log.isDebugEnabled()) {
- log.debug("Topology event message receiver thread started");
- }
-
- // Start topology message receiver thread
- Thread receiverThread = new Thread(new TopologyEventMessageDelegator());
- receiverThread.start();
- if (log.isDebugEnabled()) {
- log.debug("Topology message processor thread started");
+ // Start topology receiver
+ topologyReceiver = new LoadBalancerTopologyReceiver();
+ Thread topologyReceiverThread = new Thread(topologyReceiver);
+ topologyReceiverThread.start();
+ if(log.isInfoEnabled()) {
+ log.info("Topology receiver thread started");
}
activated = true;
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/955bc29f/components/org.apache.stratos.messaging/pom.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/pom.xml b/components/org.apache.stratos.messaging/pom.xml
index 7530175..ea179f3 100644
--- a/components/org.apache.stratos.messaging/pom.xml
+++ b/components/org.apache.stratos.messaging/pom.xml
@@ -50,9 +50,9 @@
<version>2.2.4</version>
</dependency>
<dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>1.8</version>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>3.1</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/955bc29f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/EventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/EventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/EventListener.java
deleted file mode 100644
index 6d341b1..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/EventListener.java
+++ /dev/null
@@ -1,50 +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.messaging.event;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.util.Observable;
-import java.util.Observer;
-
-/**
- * Event listener definition.
- */
-public abstract class EventListener implements Observer {
- private static final Log log = LogFactory.getLog(EventListener.class);
-
- @Override
- public void update(Observable o, Object arg) {
- if(arg instanceof Event) {
- Event event = (Event) arg;
- if(log.isDebugEnabled()) {
- log.debug(String.format("Event received: %s", event.getClass().getName()));
- }
- onEvent(event);
- }
- }
-
- /**
- * Triggered when an event is received.
- * @param event
- */
- protected abstract void onEvent(Event event);
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/955bc29f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/EventObservable.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/EventObservable.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/EventObservable.java
index 497f8eb..528d426 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/EventObservable.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/EventObservable.java
@@ -19,6 +19,8 @@
package org.apache.stratos.messaging.event;
+import org.apache.stratos.messaging.listener.EventListener;
+
import java.util.Observable;
/**
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/955bc29f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterCreatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterCreatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterCreatedEvent.java
index bec5806..b906fa1 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterCreatedEvent.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterCreatedEvent.java
@@ -37,9 +37,10 @@ public class ClusterCreatedEvent extends TopologyEvent implements Serializable {
private String autoscalingPolicyName;
private Properties properties;
- public ClusterCreatedEvent(String serviceName, String clusterId) {
+ public ClusterCreatedEvent(String serviceName, String clusterId, String hostName) {
this.serviceName = serviceName;
this.clusterId = clusterId;
+ this.hostName = hostName;
}
public String getServiceName() {
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/955bc29f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterCreatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterCreatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterCreatedEventListener.java
deleted file mode 100644
index 503f0d1..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterCreatedEventListener.java
+++ /dev/null
@@ -1,30 +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.messaging.event.topology;
-
-import org.apache.stratos.messaging.event.Event;
-import org.apache.stratos.messaging.event.EventListener;
-
-public class ClusterCreatedEventListener extends EventListener {
-
- @Override
- protected void onEvent(Event event) {
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/955bc29f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterRemovedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterRemovedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterRemovedEvent.java
index f4adac1..6537e3a 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterRemovedEvent.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterRemovedEvent.java
@@ -28,6 +28,13 @@ public class ClusterRemovedEvent extends TopologyEvent implements Serializable {
private static final long serialVersionUID = -1335777148602870262L;
private String serviceName;
private String clusterId;
+ private String hostName;
+
+ public ClusterRemovedEvent(String serviceName, String clusterId, String hostName) {
+ this.serviceName = serviceName;
+ this.clusterId = clusterId;
+ this.hostName = hostName;
+ }
public String getServiceName() {
return serviceName;
@@ -44,4 +51,12 @@ public class ClusterRemovedEvent extends TopologyEvent implements Serializable {
public void setClusterId(String clusterId) {
this.clusterId = clusterId;
}
+
+ public String getHostName() {
+ return hostName;
+ }
+
+ public void setHostName(String hostName) {
+ this.hostName = hostName;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/955bc29f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterRemovedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterRemovedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterRemovedEventListener.java
deleted file mode 100644
index 7a5c584..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterRemovedEventListener.java
+++ /dev/null
@@ -1,30 +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.messaging.event.topology;
-
-import org.apache.stratos.messaging.event.Event;
-import org.apache.stratos.messaging.event.EventListener;
-
-public class ClusterRemovedEventListener extends EventListener {
-
- @Override
- protected void onEvent(Event event) {
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/955bc29f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/CompleteTopologyEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/CompleteTopologyEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/CompleteTopologyEventListener.java
deleted file mode 100644
index 4c0c229..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/CompleteTopologyEventListener.java
+++ /dev/null
@@ -1,30 +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.messaging.event.topology;
-
-import org.apache.stratos.messaging.event.Event;
-import org.apache.stratos.messaging.event.EventListener;
-
-public class CompleteTopologyEventListener extends EventListener {
-
- @Override
- protected void onEvent(Event event) {
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/955bc29f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/InstanceSpawnedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/InstanceSpawnedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/InstanceSpawnedEventListener.java
deleted file mode 100644
index e70a3d0..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/InstanceSpawnedEventListener.java
+++ /dev/null
@@ -1,30 +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.messaging.event.topology;
-
-import org.apache.stratos.messaging.event.Event;
-import org.apache.stratos.messaging.event.EventListener;
-
-public class InstanceSpawnedEventListener extends EventListener {
-
- @Override
- protected void onEvent(Event event) {
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/955bc29f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/MemberActivatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/MemberActivatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/MemberActivatedEventListener.java
deleted file mode 100644
index cad1b5f..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/MemberActivatedEventListener.java
+++ /dev/null
@@ -1,30 +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.messaging.event.topology;
-
-import org.apache.stratos.messaging.event.Event;
-import org.apache.stratos.messaging.event.EventListener;
-
-public class MemberActivatedEventListener extends EventListener {
-
- @Override
- protected void onEvent(Event event) {
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/955bc29f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/MemberStartedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/MemberStartedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/MemberStartedEventListener.java
deleted file mode 100644
index aa8a5f6..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/MemberStartedEventListener.java
+++ /dev/null
@@ -1,30 +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.messaging.event.topology;
-
-import org.apache.stratos.messaging.event.Event;
-import org.apache.stratos.messaging.event.EventListener;
-
-public class MemberStartedEventListener extends EventListener {
-
- @Override
- protected void onEvent(Event event) {
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/955bc29f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/MemberSuspendedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/MemberSuspendedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/MemberSuspendedEventListener.java
deleted file mode 100644
index 1990c7d..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/MemberSuspendedEventListener.java
+++ /dev/null
@@ -1,30 +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.messaging.event.topology;
-
-import org.apache.stratos.messaging.event.Event;
-import org.apache.stratos.messaging.event.EventListener;
-
-public class MemberSuspendedEventListener extends EventListener {
-
- @Override
- protected void onEvent(Event event) {
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/955bc29f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/MemberTerminatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/MemberTerminatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/MemberTerminatedEventListener.java
deleted file mode 100644
index 9375415..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/MemberTerminatedEventListener.java
+++ /dev/null
@@ -1,30 +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.messaging.event.topology;
-
-import org.apache.stratos.messaging.event.Event;
-import org.apache.stratos.messaging.event.EventListener;
-
-public class MemberTerminatedEventListener extends EventListener {
-
- @Override
- protected void onEvent(Event event) {
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/955bc29f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ServiceCreatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ServiceCreatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ServiceCreatedEventListener.java
deleted file mode 100644
index 5d8d9b5..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ServiceCreatedEventListener.java
+++ /dev/null
@@ -1,30 +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.messaging.event.topology;
-
-import org.apache.stratos.messaging.event.Event;
-import org.apache.stratos.messaging.event.EventListener;
-
-public class ServiceCreatedEventListener extends EventListener {
-
- @Override
- protected void onEvent(Event event) {
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/955bc29f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ServiceRemovedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ServiceRemovedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ServiceRemovedEventListener.java
deleted file mode 100644
index f76fe3b..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ServiceRemovedEventListener.java
+++ /dev/null
@@ -1,30 +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.messaging.event.topology;
-
-import org.apache.stratos.messaging.event.Event;
-import org.apache.stratos.messaging.event.EventListener;
-
-public class ServiceRemovedEventListener extends EventListener {
-
- @Override
- protected void onEvent(Event event) {
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/955bc29f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/EventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/EventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/EventListener.java
new file mode 100644
index 0000000..a359af1
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/EventListener.java
@@ -0,0 +1,51 @@
+/*
+ * 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.messaging.listener;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.event.Event;
+
+import java.util.Observable;
+import java.util.Observer;
+
+/**
+ * Event listener definition.
+ */
+public abstract class EventListener implements Observer {
+ private static final Log log = LogFactory.getLog(EventListener.class);
+
+ @Override
+ public void update(Observable o, Object arg) {
+ if(arg instanceof Event) {
+ Event event = (Event) arg;
+ if(log.isDebugEnabled()) {
+ log.debug(String.format("Event received: %s", event.getClass().getName()));
+ }
+ onEvent(event);
+ }
+ }
+
+ /**
+ * Triggered when an event is received.
+ * @param event
+ */
+ protected abstract void onEvent(Event event);
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/955bc29f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ClusterCreatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ClusterCreatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ClusterCreatedEventListener.java
new file mode 100644
index 0000000..7e916e6
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ClusterCreatedEventListener.java
@@ -0,0 +1,30 @@
+/*
+ * 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.messaging.listener.topology;
+
+import org.apache.stratos.messaging.event.Event;
+import org.apache.stratos.messaging.listener.EventListener;
+
+public class ClusterCreatedEventListener extends EventListener {
+
+ @Override
+ protected void onEvent(Event event) {
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/955bc29f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ClusterRemovedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ClusterRemovedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ClusterRemovedEventListener.java
new file mode 100644
index 0000000..5c088db
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ClusterRemovedEventListener.java
@@ -0,0 +1,30 @@
+/*
+ * 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.messaging.listener.topology;
+
+import org.apache.stratos.messaging.event.Event;
+import org.apache.stratos.messaging.listener.EventListener;
+
+public class ClusterRemovedEventListener extends EventListener {
+
+ @Override
+ protected void onEvent(Event event) {
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/955bc29f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/CompleteTopologyEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/CompleteTopologyEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/CompleteTopologyEventListener.java
new file mode 100644
index 0000000..f7b9ef4
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/CompleteTopologyEventListener.java
@@ -0,0 +1,30 @@
+/*
+ * 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.messaging.listener.topology;
+
+import org.apache.stratos.messaging.event.Event;
+import org.apache.stratos.messaging.listener.EventListener;
+
+public class CompleteTopologyEventListener extends EventListener {
+
+ @Override
+ protected void onEvent(Event event) {
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/955bc29f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/InstanceSpawnedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/InstanceSpawnedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/InstanceSpawnedEventListener.java
new file mode 100644
index 0000000..75713bd
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/InstanceSpawnedEventListener.java
@@ -0,0 +1,30 @@
+/*
+ * 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.messaging.listener.topology;
+
+import org.apache.stratos.messaging.event.Event;
+import org.apache.stratos.messaging.listener.EventListener;
+
+public class InstanceSpawnedEventListener extends EventListener {
+
+ @Override
+ protected void onEvent(Event event) {
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/955bc29f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/MemberActivatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/MemberActivatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/MemberActivatedEventListener.java
new file mode 100644
index 0000000..951fdbf
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/MemberActivatedEventListener.java
@@ -0,0 +1,30 @@
+/*
+ * 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.messaging.listener.topology;
+
+import org.apache.stratos.messaging.event.Event;
+import org.apache.stratos.messaging.listener.EventListener;
+
+public class MemberActivatedEventListener extends EventListener {
+
+ @Override
+ protected void onEvent(Event event) {
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/955bc29f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/MemberStartedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/MemberStartedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/MemberStartedEventListener.java
new file mode 100644
index 0000000..5286c01
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/MemberStartedEventListener.java
@@ -0,0 +1,30 @@
+/*
+ * 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.messaging.listener.topology;
+
+import org.apache.stratos.messaging.event.Event;
+import org.apache.stratos.messaging.listener.EventListener;
+
+public class MemberStartedEventListener extends EventListener {
+
+ @Override
+ protected void onEvent(Event event) {
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/955bc29f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/MemberSuspendedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/MemberSuspendedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/MemberSuspendedEventListener.java
new file mode 100644
index 0000000..23fdd8d
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/MemberSuspendedEventListener.java
@@ -0,0 +1,30 @@
+/*
+ * 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.messaging.listener.topology;
+
+import org.apache.stratos.messaging.event.Event;
+import org.apache.stratos.messaging.listener.EventListener;
+
+public class MemberSuspendedEventListener extends EventListener {
+
+ @Override
+ protected void onEvent(Event event) {
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/955bc29f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/MemberTerminatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/MemberTerminatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/MemberTerminatedEventListener.java
new file mode 100644
index 0000000..202fce0
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/MemberTerminatedEventListener.java
@@ -0,0 +1,30 @@
+/*
+ * 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.messaging.listener.topology;
+
+import org.apache.stratos.messaging.event.Event;
+import org.apache.stratos.messaging.listener.EventListener;
+
+public class MemberTerminatedEventListener extends EventListener {
+
+ @Override
+ protected void onEvent(Event event) {
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/955bc29f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ServiceCreatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ServiceCreatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ServiceCreatedEventListener.java
new file mode 100644
index 0000000..b1d4399
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ServiceCreatedEventListener.java
@@ -0,0 +1,30 @@
+/*
+ * 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.messaging.listener.topology;
+
+import org.apache.stratos.messaging.event.Event;
+import org.apache.stratos.messaging.listener.EventListener;
+
+public class ServiceCreatedEventListener extends EventListener {
+
+ @Override
+ protected void onEvent(Event event) {
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/955bc29f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ServiceRemovedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ServiceRemovedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ServiceRemovedEventListener.java
new file mode 100644
index 0000000..f9c0e58
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ServiceRemovedEventListener.java
@@ -0,0 +1,30 @@
+/*
+ * 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.messaging.listener.topology;
+
+import org.apache.stratos.messaging.event.Event;
+import org.apache.stratos.messaging.listener.EventListener;
+
+public class ServiceRemovedEventListener extends EventListener {
+
+ @Override
+ protected void onEvent(Event event) {
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/955bc29f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ClusterCreatedEventProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ClusterCreatedEventProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ClusterCreatedEventProcessor.java
index b311e27..30e3e7e 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ClusterCreatedEventProcessor.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ClusterCreatedEventProcessor.java
@@ -18,6 +18,7 @@
*/
package org.apache.stratos.messaging.message.processor.topology;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.stratos.messaging.domain.topology.Cluster;
@@ -45,6 +46,10 @@ public class ClusterCreatedEventProcessor extends MessageProcessor {
// Parse complete message and build event
ClusterCreatedEvent event = (ClusterCreatedEvent) Util.jsonToObject(message, ClusterCreatedEvent.class);
+ // Validate event properties
+ if(StringUtils.isBlank(event.getHostName())) {
+ throw new RuntimeException("Hostname not found in cluster created event");
+ }
// Validate event against the existing topology
Service service = topology.getService(event.getServiceName());
if (service == null) {
@@ -64,8 +69,8 @@ public class ClusterCreatedEventProcessor extends MessageProcessor {
service.addCluster(cluster);
if (log.isInfoEnabled()) {
- log.info(String.format("Cluster created: [service] %s [cluster] %s",
- event.getServiceName(), event.getClusterId()));
+ log.info(String.format("Cluster created: [service] %s [cluster] %s [hostname] %s",
+ event.getServiceName(), event.getClusterId(), event.getHostName()));
}
// Notify event listeners
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/955bc29f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ClusterRemovedEventProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ClusterRemovedEventProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ClusterRemovedEventProcessor.java
index 689c062..6cceb0b 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ClusterRemovedEventProcessor.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ClusterRemovedEventProcessor.java
@@ -18,6 +18,7 @@
*/
package org.apache.stratos.messaging.message.processor.topology;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.stratos.messaging.domain.topology.Service;
@@ -43,6 +44,10 @@ public class ClusterRemovedEventProcessor extends MessageProcessor {
if (ClusterRemovedEvent.class.getName().equals(type)) {
// Parse complete message and build event
ClusterRemovedEvent event = (ClusterRemovedEvent) Util.jsonToObject(message, ClusterRemovedEvent.class);
+ // Validate event properties
+ if(StringUtils.isBlank(event.getHostName())) {
+ throw new RuntimeException("Hostname not found in cluster removed event");
+ }
// Validate event against the existing topology
Service service = topology.getService(event.getServiceName());
if (service == null) {
@@ -50,9 +55,10 @@ public class ClusterRemovedEventProcessor extends MessageProcessor {
event.getServiceName()));
}
if (!service.clusterExists(event.getClusterId())) {
- throw new RuntimeException(String.format("Cluster does not exist: [service] %s [cluster] %s",
+ throw new RuntimeException(String.format("Cluster does not exist: [service] %s [cluster] %s [hostname] %s",
event.getServiceName(),
- event.getClusterId()));
+ event.getClusterId(),
+ event.getHostName()));
}
// Apply changes to the topology
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/955bc29f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/TopologyEventProcessorChain.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/TopologyEventProcessorChain.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/TopologyEventProcessorChain.java
index 00b14a6..75e395d 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/TopologyEventProcessorChain.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/TopologyEventProcessorChain.java
@@ -21,8 +21,8 @@ package org.apache.stratos.messaging.message.processor.topology;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.event.EventListener;
-import org.apache.stratos.messaging.event.topology.*;
+import org.apache.stratos.messaging.listener.EventListener;
+import org.apache.stratos.messaging.listener.topology.*;
import org.apache.stratos.messaging.message.processor.MessageProcessorChain;
/**
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/955bc29f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/topology/TopologyEventMessageDelegator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/topology/TopologyEventMessageDelegator.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/topology/TopologyEventMessageDelegator.java
index 408e27c..5afb54b 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/topology/TopologyEventMessageDelegator.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/topology/TopologyEventMessageDelegator.java
@@ -22,8 +22,7 @@ import javax.jms.TextMessage;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.event.EventListener;
-import org.apache.stratos.messaging.event.topology.CompleteTopologyEventListener;
+import org.apache.stratos.messaging.listener.topology.CompleteTopologyEventListener;
import org.apache.stratos.messaging.message.processor.MessageProcessorChain;
import org.apache.stratos.messaging.message.processor.topology.*;
import org.apache.stratos.messaging.util.Constants;
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/955bc29f/products/load-balancer/modules/p2-profile/pom.xml
----------------------------------------------------------------------
diff --git a/products/load-balancer/modules/p2-profile/pom.xml b/products/load-balancer/modules/p2-profile/pom.xml
index b1daac4..0575c73 100755
--- a/products/load-balancer/modules/p2-profile/pom.xml
+++ b/products/load-balancer/modules/p2-profile/pom.xml
@@ -145,6 +145,10 @@
</featureArtifactDef>
<featureArtifactDef>
+ org.apache.stratos:org.apache.stratos.load.balancer.common.feature:${project.version}
+ </featureArtifactDef>
+
+ <featureArtifactDef>
org.wso2.carbon:org.wso2.carbon.sequences.server.feature:${carbon.patch.version.4.1.1}
</featureArtifactDef>
@@ -285,6 +289,10 @@
<version>${project.version}</version>
</feature>
<feature>
+ <id>org.apache.stratos.load.balancer.common.feature.group</id>
+ <version>${project.version}</version>
+ </feature>
+ <feature>
<id>org.wso2.carbon.databridge.datapublisher.feature.group</id>
<version>${carbon.patch.version.4.1.1}</version>
</feature>
[2/2] git commit: Merge remote-tracking branch 'origin/master'
Posted by im...@apache.org.
Merge remote-tracking branch 'origin/master'
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/b6fa2023
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/b6fa2023
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/b6fa2023
Branch: refs/heads/master
Commit: b6fa20233b8a17f1ca546df299790d7c67869ec0
Parents: 955bc29 acf4e62
Author: Imesh Gunaratne <im...@apache.org>
Authored: Tue Nov 19 22:37:03 2013 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Tue Nov 19 22:37:03 2013 +0530
----------------------------------------------------------------------
.../java/org/apache/stratos/adc/mgt/payload/PayloadFactory.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------