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 2015/02/20 11:04:24 UTC
stratos git commit: Updating startup time calculation in monitor
schedulers
Repository: stratos
Updated Branches:
refs/heads/master 954a1012f -> 935509c00
Updating startup time calculation in monitor schedulers
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/935509c0
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/935509c0
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/935509c0
Branch: refs/heads/master
Commit: 935509c00beca715d7352aa2aedd50ac24cc4f1d
Parents: 954a101
Author: Imesh Gunaratne <im...@apache.org>
Authored: Fri Feb 20 15:34:17 2015 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Fri Feb 20 15:34:17 2015 +0530
----------------------------------------------------------------------
.../monitor/component/ParentComponentMonitor.java | 3 ++-
.../stratos/autoscaler/util/AutoscalerUtil.java | 18 ++++++++++--------
2 files changed, 12 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/935509c0/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/ParentComponentMonitor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/ParentComponentMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/ParentComponentMonitor.java
index cc904d7..f26e913 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/ParentComponentMonitor.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/ParentComponentMonitor.java
@@ -770,6 +770,7 @@ public abstract class ParentComponentMonitor extends Monitor implements Runnable
public void run() {
long startTime = System.currentTimeMillis();
+ long endTime = startTime;
int retries = 5;
Monitor monitor = null;
boolean success = false;
@@ -805,6 +806,7 @@ public abstract class ParentComponentMonitor extends Monitor implements Runnable
retries--;
}
success = true;
+ endTime = System.currentTimeMillis();
}
if (monitor == null) {
@@ -819,7 +821,6 @@ public abstract class ParentComponentMonitor extends Monitor implements Runnable
pendingMonitorsList.remove(context.getId());
if (log.isInfoEnabled()) {
- long endTime = System.currentTimeMillis();
long startupTime = (endTime - startTime)/1000;
log.info(String.format("Monitor started successfully: [type] %s [component] %s [dependents] %s " +
"[startup-time] %d seconds", monitorTypeStr, context.getId(),
http://git-wip-us.apache.org/repos/asf/stratos/blob/935509c0/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java
index bc09979..19af96a 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java
@@ -271,13 +271,15 @@ public class AutoscalerUtil {
}
public void run() {
- ApplicationMonitor applicationMonitor = null;
+ long startTime = System.currentTimeMillis();
+ long endTime = startTime;
int retries = 5;
boolean success = false;
+ ApplicationMonitor applicationMonitor = null;
while (!success && retries != 0) {
try {
- long start = System.currentTimeMillis();
+ startTime = System.currentTimeMillis();
log.info("Starting monitor: [application] " + applicationId);
try {
applicationMonitor = MonitorFactory.getApplicationMonitor(applicationId);
@@ -286,10 +288,8 @@ public class AutoscalerUtil {
log.warn(msg, e);
retries--;
}
- long end = System.currentTimeMillis();
- log.debug("Monitor started in " + ((end - start) / 1000) + " seconds: " +
- "[application] " + applicationId);
success = true;
+ endTime = System.currentTimeMillis();
} catch (DependencyBuilderException e) {
String msg = "Monitor creation failed: [application] " + applicationId;
log.warn(msg, e);
@@ -308,12 +308,14 @@ public class AutoscalerUtil {
throw new RuntimeException(msg);
}
AutoscalerContext autoscalerContext = AutoscalerContext.getInstance();
-
autoscalerContext.removeAppMonitor(applicationId);
autoscalerContext.addAppMonitor(applicationMonitor);
+
+ long startupTime = ((endTime - startTime) / 1000);
if (log.isInfoEnabled()) {
- log.info(String.format("Monitor started successfully: [application] %s [dependents] %s",
- applicationMonitor.getId(), applicationMonitor.getStartupDependencyTree()));
+ log.info(String.format("Monitor started successfully: [application] %s [dependents] %s " +
+ "[startup-time] %d seconds", applicationMonitor.getId(),
+ applicationMonitor.getStartupDependencyTree(), startupTime));
}
}
}