Add instance id to log messages in autoscaler ClusterStatusActiveProcessor

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

Branch: refs/heads/stratos-4.1.x
Commit: 138bd5e0548b74072a561af5ca12f82884e439c7
Parents: c39d46f
Author: Akila Perera <[email protected]>
Authored: Mon Nov 30 00:16:32 2015 +0530
Committer: Akila Perera <[email protected]>
Committed: Mon Nov 30 00:33:47 2015 +0530

----------------------------------------------------------------------
 .../cluster/ClusterStatusActiveProcessor.java   | 22 ++++++++++----------
 1 file changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/138bd5e0/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/processor/cluster/ClusterStatusActiveProcessor.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/processor/cluster/ClusterStatusActiveProcessor.java
 
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/processor/cluster/ClusterStatusActiveProcessor.java
index a8521d5..8dd9a8e 100644
--- 
a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/processor/cluster/ClusterStatusActiveProcessor.java
+++ 
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/processor/cluster/ClusterStatusActiveProcessor.java
@@ -53,8 +53,9 @@ public class ClusterStatusActiveProcessor extends 
ClusterStatusProcessor {
                 // ask the next processor to take care of the message.
                 return nextProcessor.process(type, clusterId, instanceId);
             } else {
-                log.warn(String.format("No possible state change found for 
[type] %s [cluster] %s " +
-                        "[instance] %s", type, clusterId, instanceId));
+                log.warn(
+                        String.format("No possible state change found for 
[type] %s, [cluster] %s, [instance] %s", type,
+                                clusterId, instanceId));
             }
         }
         return false;
@@ -64,12 +65,10 @@ public class ClusterStatusActiveProcessor extends 
ClusterStatusProcessor {
         ClusterMonitor monitor = AutoscalerContext.getInstance().
                 getClusterMonitor(clusterId);
         boolean clusterActive = false;
-        for (NetworkPartitionContext clusterLevelNetworkPartitionContext :
-                monitor.getNetworkPartitionCtxts()) {
+        for (NetworkPartitionContext clusterLevelNetworkPartitionContext : 
monitor.getNetworkPartitionCtxts()) {
             //minimum check per partition
-            ClusterInstanceContext instanceContext =
-                    (ClusterInstanceContext) 
clusterLevelNetworkPartitionContext.
-                            getInstanceContext(instanceId);
+            ClusterInstanceContext instanceContext = (ClusterInstanceContext) 
clusterLevelNetworkPartitionContext.
+                    getInstanceContext(instanceId);
             if (instanceContext != null) {
                 if (instanceContext.getActiveMembers() >= 
instanceContext.getMinInstanceCount()) {
                     clusterActive = true;
@@ -79,12 +78,13 @@ public class ClusterStatusActiveProcessor extends 
ClusterStatusProcessor {
         }
         if (clusterActive) {
             if (log.isInfoEnabled()) {
-                log.info("Publishing cluster activated event for 
[application]: "
-                        + monitor.getAppId() + " [cluster]: " + clusterId);
+                log.info(String.format("Publishing cluster activated event for 
[application-id] %s, [cluster-id] %s, "
+                        + "[cluster-instance-id] %s", monitor.getAppId(), 
clusterId, instanceId));
             }
             //TODO service call
-            
ClusterStatusEventPublisher.sendClusterActivatedEvent(monitor.getAppId(),
-                    monitor.getServiceId(), monitor.getClusterId(), 
instanceId);
+            ClusterStatusEventPublisher
+                    .sendClusterActivatedEvent(monitor.getAppId(), 
monitor.getServiceId(), monitor.getClusterId(),
+                            instanceId);
         }
         return clusterActive;
     }

Reply via email to