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/11/06 11:40:55 UTC

[1/2] git commit: referring correct application events in the application processor chain

Repository: stratos
Updated Branches:
  refs/heads/docker-grouping-merge 8becdc8ed -> c77a4e0e8


referring correct application events in the application processor chain


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

Branch: refs/heads/docker-grouping-merge
Commit: c77a4e0e82d0f17bcfe414da0729ba670b783331
Parents: 4e2f473
Author: Isuru Haththotuwa <is...@apache.org>
Authored: Thu Nov 6 16:10:02 2014 +0530
Committer: Isuru Haththotuwa <is...@apache.org>
Committed: Thu Nov 6 16:10:17 2014 +0530

----------------------------------------------------------------------
 .../topic/ApplicationsEventPublisher.java       |  5 +-
 .../AppStatusGroupInactivateEvent.java          | 48 --------------------
 .../applications/GroupInactivatedEvent.java     | 43 ++++++++++++++++++
 .../ApplicationActivatedMessageProcessor.java   |  2 +-
 .../applications/GroupActivatedProcessor.java   |  2 +-
 .../applications/GroupInActivateProcessor.java  | 10 ++--
 .../applications/GroupTerminatedProcessor.java  |  2 +-
 .../applications/GroupTerminatingProcessor.java |  2 +-
 8 files changed, 54 insertions(+), 60 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/c77a4e0e/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/topic/ApplicationsEventPublisher.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/topic/ApplicationsEventPublisher.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/topic/ApplicationsEventPublisher.java
index a0aa940..aa037a7 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/topic/ApplicationsEventPublisher.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/topic/ApplicationsEventPublisher.java
@@ -62,10 +62,9 @@ public class ApplicationsEventPublisher {
             log.info("Publishing Group in-activate event for [application]: " + appId +
                     " [group]: " + groupId);
         }
-        AppStatusGroupInactivateEvent appStatusGroupInactivateEvent = new
-                AppStatusGroupInactivateEvent(appId, groupId);
+        GroupInactivatedEvent groupInactivateEvent = new GroupInactivatedEvent(appId, groupId);
 
-        publishEvent(appStatusGroupInactivateEvent);
+        publishEvent(groupInactivateEvent);
     }
 
     public static void sendGroupTerminatingEvent(String appId, String groupId) {

http://git-wip-us.apache.org/repos/asf/stratos/blob/c77a4e0e/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppStatusGroupInactivateEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppStatusGroupInactivateEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppStatusGroupInactivateEvent.java
deleted file mode 100644
index 07eb674..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/AppStatusGroupInactivateEvent.java
+++ /dev/null
@@ -1,48 +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.applications;
-
-import org.apache.stratos.messaging.event.Event;
-
-import java.io.Serializable;
-
-/**
- * This event is fired by cartridge agent when it has started the server and
- * applications are ready to serve the incoming requests.
- */
-public class AppStatusGroupInactivateEvent extends Event implements Serializable {
-    private static final long serialVersionUID = 2625412714611885089L;
-
-    private String groupId;
-    private String appId;
-
-    public AppStatusGroupInactivateEvent(String appId, String groupId) {
-        this.appId = appId;
-        this.groupId = groupId;
-    }
-
-    public String getGroupId() {
-        return this.groupId;
-    }
-
-    public String getAppId() {
-        return appId;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/c77a4e0e/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupInactivatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupInactivatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupInactivatedEvent.java
new file mode 100644
index 0000000..d3a1ef4
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/applications/GroupInactivatedEvent.java
@@ -0,0 +1,43 @@
+/*
+ * 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.applications;
+
+import org.apache.stratos.messaging.event.Event;
+
+import java.io.Serializable;
+
+public class GroupInactivatedEvent extends Event implements Serializable {
+
+    private String appId;
+    private String groupId;
+
+    public GroupInactivatedEvent (String appId, String groupId) {
+        this.appId = appId;
+        this.groupId = groupId;
+    }
+
+    public String getAppId() {
+        return appId;
+    }
+
+    public String getGroupId() {
+        return groupId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/c77a4e0e/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationActivatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationActivatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationActivatedMessageProcessor.java
index 0fd16b3..7dc0f4c 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationActivatedMessageProcessor.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationActivatedMessageProcessor.java
@@ -23,7 +23,7 @@ import org.apache.commons.logging.LogFactory;
 import org.apache.stratos.messaging.domain.applications.Application;
 import org.apache.stratos.messaging.domain.applications.ApplicationStatus;
 import org.apache.stratos.messaging.domain.applications.Applications;
-import org.apache.stratos.messaging.event.topology.ApplicationActivatedEvent;
+import org.apache.stratos.messaging.event.applications.ApplicationActivatedEvent;
 import org.apache.stratos.messaging.message.processor.MessageProcessor;
 import org.apache.stratos.messaging.message.processor.applications.updater.ApplicationsUpdater;
 import org.apache.stratos.messaging.util.Util;

http://git-wip-us.apache.org/repos/asf/stratos/blob/c77a4e0e/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupActivatedProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupActivatedProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupActivatedProcessor.java
index b73f703..add943a 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupActivatedProcessor.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupActivatedProcessor.java
@@ -24,7 +24,7 @@ import org.apache.stratos.messaging.domain.applications.Application;
 import org.apache.stratos.messaging.domain.applications.Applications;
 import org.apache.stratos.messaging.domain.applications.Group;
 import org.apache.stratos.messaging.domain.applications.GroupStatus;
-import org.apache.stratos.messaging.event.topology.GroupActivatedEvent;
+import org.apache.stratos.messaging.event.applications.GroupActivatedEvent;
 import org.apache.stratos.messaging.message.processor.MessageProcessor;
 import org.apache.stratos.messaging.message.processor.applications.updater.ApplicationsUpdater;
 import org.apache.stratos.messaging.util.Util;

http://git-wip-us.apache.org/repos/asf/stratos/blob/c77a4e0e/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupInActivateProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupInActivateProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupInActivateProcessor.java
index 5df4a62..8800608 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupInActivateProcessor.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupInActivateProcessor.java
@@ -24,7 +24,7 @@ import org.apache.stratos.messaging.domain.applications.Application;
 import org.apache.stratos.messaging.domain.applications.Applications;
 import org.apache.stratos.messaging.domain.applications.Group;
 import org.apache.stratos.messaging.domain.applications.GroupStatus;
-import org.apache.stratos.messaging.event.topology.GroupInactivateEvent;
+import org.apache.stratos.messaging.event.applications.GroupInactivatedEvent;
 import org.apache.stratos.messaging.message.processor.MessageProcessor;
 import org.apache.stratos.messaging.message.processor.applications.updater.ApplicationsUpdater;
 import org.apache.stratos.messaging.util.Util;
@@ -45,14 +45,14 @@ public class GroupInActivateProcessor extends MessageProcessor {
     public boolean process(String type, String message, Object object) {
         Applications applications = (Applications) object;
 
-        if (GroupInactivateEvent.class.getName().equals(type)) {
+        if (GroupInactivatedEvent.class.getName().equals(type)) {
             // Return if applications has not been initialized
             if (!applications.isInitialized())
                 return false;
 
             // Parse complete message and build event
-            GroupInactivateEvent event = (GroupInactivateEvent) Util.
-                    jsonToObject(message, GroupInactivateEvent.class);
+            GroupInactivatedEvent event = (GroupInactivatedEvent) Util.
+                    jsonToObject(message, GroupInactivatedEvent.class);
 
             ApplicationsUpdater.acquireWriteLockForApplication(event.getAppId());
 
@@ -73,7 +73,7 @@ public class GroupInActivateProcessor extends MessageProcessor {
         }
     }
 
-    private boolean doProcess(GroupInactivateEvent event, Applications applications) {
+    private boolean doProcess(GroupInactivatedEvent event, Applications applications) {
 
         // Validate event against the existing applications
         Application application = applications.getApplication(event.getAppId());

http://git-wip-us.apache.org/repos/asf/stratos/blob/c77a4e0e/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupTerminatedProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupTerminatedProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupTerminatedProcessor.java
index f03c21e..4dc8876 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupTerminatedProcessor.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupTerminatedProcessor.java
@@ -24,7 +24,7 @@ import org.apache.stratos.messaging.domain.applications.Application;
 import org.apache.stratos.messaging.domain.applications.Applications;
 import org.apache.stratos.messaging.domain.applications.Group;
 import org.apache.stratos.messaging.domain.applications.GroupStatus;
-import org.apache.stratos.messaging.event.topology.GroupTerminatedEvent;
+import org.apache.stratos.messaging.event.applications.GroupTerminatedEvent;
 import org.apache.stratos.messaging.message.processor.MessageProcessor;
 import org.apache.stratos.messaging.message.processor.applications.updater.ApplicationsUpdater;
 import org.apache.stratos.messaging.util.Util;

http://git-wip-us.apache.org/repos/asf/stratos/blob/c77a4e0e/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupTerminatingProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupTerminatingProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupTerminatingProcessor.java
index ccc7b8f..2123f77 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupTerminatingProcessor.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/GroupTerminatingProcessor.java
@@ -24,7 +24,7 @@ import org.apache.stratos.messaging.domain.applications.Application;
 import org.apache.stratos.messaging.domain.applications.Applications;
 import org.apache.stratos.messaging.domain.applications.Group;
 import org.apache.stratos.messaging.domain.applications.GroupStatus;
-import org.apache.stratos.messaging.event.topology.GroupTerminatingEvent;
+import org.apache.stratos.messaging.event.applications.GroupTerminatingEvent;
 import org.apache.stratos.messaging.message.processor.MessageProcessor;
 import org.apache.stratos.messaging.message.processor.applications.updater.ApplicationsUpdater;
 import org.apache.stratos.messaging.util.Util;


[2/2] git commit: correcting the message processor chain implementation in ClusterStatusEventMessageDelegator

Posted by is...@apache.org.
correcting the message processor chain implementation in ClusterStatusEventMessageDelegator


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

Branch: refs/heads/docker-grouping-merge
Commit: 4e2f473639f8e81329a3f4317f04554b960f1c8b
Parents: 8becdc8
Author: Isuru Haththotuwa <is...@apache.org>
Authored: Thu Nov 6 16:00:24 2014 +0530
Committer: Isuru Haththotuwa <is...@apache.org>
Committed: Thu Nov 6 16:10:17 2014 +0530

----------------------------------------------------------------------
 .../cluster/status/ClusterStatusEventMessageDelegator.java   | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/4e2f4736/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/cluster/status/ClusterStatusEventMessageDelegator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/cluster/status/ClusterStatusEventMessageDelegator.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/cluster/status/ClusterStatusEventMessageDelegator.java
index 4a67c5e..0405901 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/cluster/status/ClusterStatusEventMessageDelegator.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/cluster/status/ClusterStatusEventMessageDelegator.java
@@ -54,7 +54,7 @@ class ClusterStatusEventMessageDelegator implements Runnable {
     public void run() {
         try {
             if (log.isInfoEnabled()) {
-                log.info("Instance notifier event message delegator started");
+                log.info("Cluster Status event message delegator started");
             }
 
             while (!terminated) {
@@ -67,16 +67,16 @@ class ClusterStatusEventMessageDelegator implements Runnable {
                     // Retrieve the actual message
                     String json = message.getText();
                     if (log.isDebugEnabled()) {
-                        log.debug(String.format("Instance notifier event message received from queue: %s", type));
+                        log.debug(String.format("Cluster Status event message received from queue: %s", type));
                     }
 
                     // Delegate message to message processor chain
                     if (log.isDebugEnabled()) {
-                        log.debug(String.format("Delegating instance notifier event message: %s", type));
+                        log.debug(String.format("Delegating Cluster Status event message: %s", type));
                     }
                     processorChain.process(type, json, null);
                 } catch (Exception e) {
-                    log.error("Failed to retrieve instance notifier event message", e);
+                    log.error("Failed to retrieve Cluster Status event message", e);
                 }
             }
         } catch (Exception e) {