You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by is...@apache.org on 2014/02/19 06:14:48 UTC

git commit: sending artifact update to all subscriptions regardless of tenancy

Repository: incubator-stratos
Updated Branches:
  refs/heads/master 5c2b5a0cc -> 7533eb57c


sending artifact update to all subscriptions regardless of tenancy


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

Branch: refs/heads/master
Commit: 7533eb57c0449eb02f5c2cf55fd585ace420ef2b
Parents: 5c2b5a0
Author: Isuru <is...@wso2.com>
Authored: Wed Feb 19 10:44:28 2014 +0530
Committer: Isuru <is...@wso2.com>
Committed: Wed Feb 19 10:44:28 2014 +0530

----------------------------------------------------------------------
 .../listener/InstanceStatusListener.java        | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/7533eb57/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/listener/InstanceStatusListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/listener/InstanceStatusListener.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/listener/InstanceStatusListener.java
index 722a829..2b68de6 100644
--- a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/listener/InstanceStatusListener.java
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/listener/InstanceStatusListener.java
@@ -58,19 +58,7 @@ public class InstanceStatusListener implements MessageListener {
                 if(log.isInfoEnabled()) {
                     log.info("Cluster id: " + clusterId);
                 }
-                ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-                /*CartridgeSubscriptionInfo subscription = PersistenceManager.getSubscriptionFromClusterId(clusterId);
 
-                if (subscription.getRepository() != null) {
-                    InstanceNotificationPublisher publisher = new InstanceNotificationPublisher(subscription.getRepository(), clusterId, String.valueOf(subscription.getTenantId()));
-                    publisher.publish();
-                }
-                else {
-                    //TODO: make this log debug
-                    log.info("No repository found for subscription with alias: " + subscription.getAlias() + ", type: " + subscription.getCartridge() +
-                        ". Not sending the Depsync event");
-                }*/
-                ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                 Set<CartridgeSubscription> cartridgeSubscriptions = new DataInsertionAndRetrievalManager().getCartridgeSubscriptionForCluster(clusterId);
                 if (cartridgeSubscriptions == null || cartridgeSubscriptions.isEmpty()) {
                     // No subscriptions, return
@@ -81,10 +69,10 @@ public class InstanceStatusListener implements MessageListener {
                 }
 
                 for (CartridgeSubscription cartridgeSubscription : cartridgeSubscriptions) {
-                    // If only this is a non-multitenant Cartridge Subscription and repository is not null, need to
-                    // send an ArtifactUpdatedEvent event. If this is a multitenant cartridge, sending this event
-                    // will be done in SubscriptionMultiTenantBehaviour#createSubscription method
-                    if (!cartridgeSubscription.getCartridgeInfo().getMultiTenant() && cartridgeSubscription.getRepository() != null) {
+                    // We need to send this event for all types, single tenant and multi tenant.
+                    // In an autoscaling scenario, we need to send this event for all existing subscriptions for the newly spawned instance
+                    // Also in a case of restarting the agent, this event needs to be sent for all subscriptions for the existing instance
+                    if (cartridgeSubscription.getRepository() != null) {
                         InstanceNotificationPublisher publisher = new InstanceNotificationPublisher();
                         publisher.sendArtifactUpdateEvent(cartridgeSubscription.getRepository(), clusterId,
                                 String.valueOf(cartridgeSubscription.getSubscriber().getTenantId()));